sip_parser.c:pj_cis_match:
  151|  25.3k|{
  152|  25.3k|    return PJ_CIS_ISSET(cis, c);
  ------------------
  |  |   90|  25.3k|#define PJ_CIS_ISSET(cis,c) ((cis)->cis_buf[(int)c] & (1 << (cis)->cis_id))
  ------------------
  153|  25.3k|}
sip_parser.c:pj_scan_is_eof:
  253|   149k|{
  254|   149k|    return scanner->curptr >= scanner->end;
  255|   149k|}
sip_parser.c:pj_scan_get_col:
  541|  20.7k|{
  542|  20.7k|    return (int)(scanner->curptr - scanner->start_line);
  543|  20.7k|}
sip_auth_parser.c:pj_scan_is_eof:
  253|  26.1k|{
  254|  26.1k|    return scanner->curptr >= scanner->end;
  255|  26.1k|}
sip_tel_uri.c:pj_cis_match:
  151|  2.94k|{
  152|  2.94k|    return PJ_CIS_ISSET(cis, c);
  ------------------
  |  |   90|  2.94k|#define PJ_CIS_ISSET(cis,c) ((cis)->cis_buf[(int)c] & (1 << (cis)->cis_id))
  ------------------
  153|  2.94k|}
scanner.c:pj_scan_is_eof:
  253|   482k|{
  254|   482k|    return scanner->curptr >= scanner->end;
  255|   482k|}
scanner.c:pj_cis_match:
  151|  3.00M|{
  152|  3.00M|    return PJ_CIS_ISSET(cis, c);
  ------------------
  |  |   90|  3.00M|#define PJ_CIS_ISSET(cis,c) ((cis)->cis_buf[(int)c] & (1 << (cis)->cis_id))
  ------------------
  153|  3.00M|}

pjlib_util_init:
  178|      1|{
  179|      1|    pj_status_t status;
  180|       |    
  181|      1|    status = pj_register_strerror(PJLIB_UTIL_ERRNO_START, 
  ------------------
  |  |   35|      1|#define PJLIB_UTIL_ERRNO_START    (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*3)
  |  |  ------------------
  |  |  |  |  535|      1|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      1|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      1|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      1|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PJLIB_UTIL_ERRNO_START    (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*3)
  |  |  ------------------
  |  |  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  ------------------
  ------------------
  182|      1|                                  PJ_ERRNO_SPACE_SIZE, 
  ------------------
  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  ------------------
  183|      1|                                  &pjlib_util_strerror);
  184|      1|    pj_assert(status == PJ_SUCCESS);
  ------------------
  |  |   65|      1|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (184:5): [True: 0, False: 1]
  |  Branch (184:5): [True: 1, False: 0]
  ------------------
  185|       |
  186|      1|    return status;
  187|      1|}

pj_md5_init:
   58|  1.53k|{
   59|  1.53k|    ctx->buf[0] = 0x67452301;
   60|  1.53k|    ctx->buf[1] = 0xefcdab89;
   61|  1.53k|    ctx->buf[2] = 0x98badcfe;
   62|  1.53k|    ctx->buf[3] = 0x10325476;
   63|       |
   64|  1.53k|    ctx->bits[0] = 0;
   65|  1.53k|    ctx->bits[1] = 0;
   66|  1.53k|}
pj_md5_update:
   74|  7.41k|{
   75|  7.41k|    pj_uint32_t t;
   76|       |
   77|       |    /* Update bitcount */
   78|       |
   79|  7.41k|    t = ctx->bits[0];
   80|  7.41k|    if ((ctx->bits[0] = t + ((pj_uint32_t) len << 3)) < t)
  ------------------
  |  Branch (80:9): [True: 0, False: 7.41k]
  ------------------
   81|      0|        ctx->bits[1]++;         /* Carry from low to high */
   82|  7.41k|    ctx->bits[1] += len >> 29;
   83|       |
   84|  7.41k|    t = (t >> 3) & 0x3f;        /* Bytes already in shsInfo->data */
   85|       |
   86|       |    /* Handle any leading odd-sized chunks */
   87|       |
   88|  7.41k|    if (t) {
  ------------------
  |  Branch (88:9): [True: 5.84k, False: 1.56k]
  ------------------
   89|  5.84k|        unsigned char *p = (unsigned char *) ctx->in + t;
   90|       |
   91|  5.84k|        t = 64 - t;
   92|  5.84k|        if (len < t) {
  ------------------
  |  Branch (92:13): [True: 5.28k, False: 557]
  ------------------
   93|  5.28k|            pj_memcpy(p, buf, len);
   94|  5.28k|            return;
   95|  5.28k|        }
   96|    557|        pj_memcpy(p, buf, t);
   97|    557|        byteReverse(ctx->in, 16);
   98|    557|        MD5Transform(ctx->buf, (pj_uint32_t *) ctx->in);
   99|    557|        buf += t;
  100|    557|        len -= t;
  101|    557|    }
  102|       |    /* Process data in 64-byte chunks */
  103|       |
  104|  3.31k|    while (len >= 64) {
  ------------------
  |  Branch (104:12): [True: 1.19k, False: 2.12k]
  ------------------
  105|  1.19k|        pj_memcpy(ctx->in, buf, 64);
  106|  1.19k|        byteReverse(ctx->in, 16);
  107|  1.19k|        MD5Transform(ctx->buf, (pj_uint32_t *) ctx->in);
  108|  1.19k|        buf += 64;
  109|  1.19k|        len -= 64;
  110|  1.19k|    }
  111|       |
  112|       |    /* Handle any remaining bytes of data. */
  113|       |
  114|  2.12k|    pj_memcpy(ctx->in, buf, len);
  115|  2.12k|}
pj_md5_final:
  122|  1.53k|{
  123|  1.53k|    unsigned count;
  124|  1.53k|    unsigned char *p;
  125|       |
  126|       |    /* Compute number of bytes mod 64 */
  127|  1.53k|    count = (ctx->bits[0] >> 3) & 0x3F;
  128|       |
  129|       |    /* Set the first char of padding to 0x80.  This is safe since there is
  130|       |       always at least one byte free */
  131|  1.53k|    p = ctx->in + count;
  132|  1.53k|    *p++ = 0x80;
  133|       |
  134|       |    /* Bytes of padding needed to make 64 bytes */
  135|  1.53k|    count = 64 - 1 - count;
  136|       |
  137|       |    /* Pad out to 56 mod 64 */
  138|  1.53k|    if (count < 8) {
  ------------------
  |  Branch (138:9): [True: 25, False: 1.50k]
  ------------------
  139|       |        /* Two lots of padding:  Pad the first block to 64 bytes */
  140|     25|        pj_bzero(p, count);
  141|     25|        byteReverse(ctx->in, 16);
  142|     25|        MD5Transform(ctx->buf, (pj_uint32_t *) ctx->in);
  143|       |
  144|       |        /* Now fill the next block with 56 bytes */
  145|     25|        pj_bzero(ctx->in, 56);
  146|  1.50k|    } else {
  147|       |        /* Pad block to 56 bytes */
  148|  1.50k|        pj_bzero(p, count - 8);
  149|  1.50k|    }
  150|  1.53k|    byteReverse(ctx->in, 14);
  151|       |
  152|       |    /* Append length in bits and transform */
  153|       |    //((pj_uint32_t *) ctx->in)[14] = ctx->bits[0];
  154|       |    //((pj_uint32_t *) ctx->in)[15] = ctx->bits[1];
  155|  1.53k|    pj_memcpy(&ctx->in[14 << 2], &ctx->bits[0], sizeof(ctx->bits[0]));
  156|  1.53k|    pj_memcpy(&ctx->in[15 << 2], &ctx->bits[1], sizeof(ctx->bits[1]));
  157|       |
  158|  1.53k|    MD5Transform(ctx->buf, (pj_uint32_t *) ctx->in);
  159|  1.53k|    byteReverse((unsigned char *) ctx->buf, 4);
  160|  1.53k|    pj_memcpy(digest, ctx->buf, 16);
  161|  1.53k|    pj_bzero(ctx, sizeof(*ctx));        /* In case it's sensitive */
  162|  1.53k|}
md5.c:MD5Transform:
  184|  3.30k|{
  185|  3.30k|    register pj_uint32_t a, b, c, d;
  186|       |
  187|  3.30k|    a = buf[0];
  188|  3.30k|    b = buf[1];
  189|  3.30k|    c = buf[2];
  190|  3.30k|    d = buf[3];
  191|       |
  192|  3.30k|    MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  192|  3.30k|    MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  193|  3.30k|    MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  193|  3.30k|    MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  194|  3.30k|    MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  194|  3.30k|    MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  195|  3.30k|    MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  195|  3.30k|    MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  196|  3.30k|    MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  196|  3.30k|    MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  197|  3.30k|    MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  197|  3.30k|    MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  198|  3.30k|    MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  198|  3.30k|    MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  199|  3.30k|    MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  199|  3.30k|    MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  200|  3.30k|    MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  200|  3.30k|    MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  201|  3.30k|    MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  201|  3.30k|    MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  202|  3.30k|    MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  202|  3.30k|    MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  203|  3.30k|    MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  203|  3.30k|    MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  204|  3.30k|    MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  204|  3.30k|    MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  205|  3.30k|    MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  205|  3.30k|    MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  206|  3.30k|    MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  206|  3.30k|    MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  207|  3.30k|    MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  207|  3.30k|    MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  208|       |
  209|  3.30k|    MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  209|  3.30k|    MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  210|  3.30k|    MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  210|  3.30k|    MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  211|  3.30k|    MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  211|  3.30k|    MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  212|  3.30k|    MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  212|  3.30k|    MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  213|  3.30k|    MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  213|  3.30k|    MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  214|  3.30k|    MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  214|  3.30k|    MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  215|  3.30k|    MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  215|  3.30k|    MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  216|  3.30k|    MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  216|  3.30k|    MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  217|  3.30k|    MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  217|  3.30k|    MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  218|  3.30k|    MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  218|  3.30k|    MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  219|  3.30k|    MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  219|  3.30k|    MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  220|  3.30k|    MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  220|  3.30k|    MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  221|  3.30k|    MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  221|  3.30k|    MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  222|  3.30k|    MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  222|  3.30k|    MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  223|  3.30k|    MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  223|  3.30k|    MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  224|  3.30k|    MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  224|  3.30k|    MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
  |  |  |  |  ------------------
  |  |  |  |  |  |  170|  3.30k|#define F2(x, y, z) F1(z, x, y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  169|  3.30k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  225|       |
  226|  3.30k|    MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  226|  3.30k|    MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  227|  3.30k|    MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  227|  3.30k|    MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  228|  3.30k|    MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  228|  3.30k|    MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  229|  3.30k|    MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  229|  3.30k|    MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  230|  3.30k|    MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  230|  3.30k|    MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  231|  3.30k|    MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  231|  3.30k|    MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  232|  3.30k|    MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  232|  3.30k|    MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  233|  3.30k|    MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  233|  3.30k|    MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  234|  3.30k|    MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  234|  3.30k|    MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  235|  3.30k|    MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  235|  3.30k|    MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  236|  3.30k|    MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  236|  3.30k|    MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  237|  3.30k|    MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  237|  3.30k|    MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  238|  3.30k|    MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  238|  3.30k|    MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  239|  3.30k|    MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  239|  3.30k|    MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  240|  3.30k|    MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  240|  3.30k|    MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  241|  3.30k|    MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  241|  3.30k|    MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.30k|#define F3(x, y, z) (x ^ y ^ z)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  242|       |
  243|  3.30k|    MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  243|  3.30k|    MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  244|  3.30k|    MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  244|  3.30k|    MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  245|  3.30k|    MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  245|  3.30k|    MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  246|  3.30k|    MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  246|  3.30k|    MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  247|  3.30k|    MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  247|  3.30k|    MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  248|  3.30k|    MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  248|  3.30k|    MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  249|  3.30k|    MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  249|  3.30k|    MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  250|  3.30k|    MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  250|  3.30k|    MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  251|  3.30k|    MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  251|  3.30k|    MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  252|  3.30k|    MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  252|  3.30k|    MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  253|  3.30k|    MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  253|  3.30k|    MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  254|  3.30k|    MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  254|  3.30k|    MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  255|  3.30k|    MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  255|  3.30k|    MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  256|  3.30k|    MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  256|  3.30k|    MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  257|  3.30k|    MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  257|  3.30k|    MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  258|  3.30k|    MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
  ------------------
  |  |  176|  3.30k|        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
  |  |  ------------------
  |  |  |  |  258|  3.30k|    MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  3.30k|#define F4(x, y, z) (y ^ (x | ~z))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  259|       |
  260|  3.30k|    buf[0] += a;
  261|  3.30k|    buf[1] += b;
  262|  3.30k|    buf[2] += c;
  263|  3.30k|    buf[3] += d;
  264|  3.30k|}

pj_cis_add_range:
   51|     18|{
   52|       |    /* Can not set zero. This is the requirement of the parser. */
   53|     18|    pj_assert(cstart > 0);
  ------------------
  |  |   65|     18|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (53:5): [True: 0, False: 18]
  |  Branch (53:5): [True: 18, False: 0]
  ------------------
   54|       |
   55|    390|    while (cstart != cend) {
  ------------------
  |  Branch (55:12): [True: 372, False: 18]
  ------------------
   56|    372|        PJ_CIS_SET(cis, cstart);
  ------------------
  |  |   72|    372|#define PJ_CIS_SET(cis,c)   ((cis)->cis_buf[(int)(c)] |= (1 << (cis)->cis_id))
  ------------------
   57|    372|        ++cstart;
   58|    372|    }
   59|     18|}
pj_cis_add_alpha:
   62|      6|{
   63|      6|    pj_cis_add_range( cis, 'a', 'z'+1);
   64|      6|    pj_cis_add_range( cis, 'A', 'Z'+1);
   65|      6|}
pj_cis_add_num:
   68|      6|{
   69|      6|    pj_cis_add_range( cis, '0', '9'+1);
   70|      6|}
pj_cis_add_str:
   73|     23|{
   74|    290|    while (*str) {
  ------------------
  |  Branch (74:12): [True: 267, False: 23]
  ------------------
   75|    267|        PJ_CIS_SET(cis, *str);
  ------------------
  |  |   72|    267|#define PJ_CIS_SET(cis,c)   ((cis)->cis_buf[(int)(c)] |= (1 << (cis)->cis_id))
  ------------------
   76|    267|        ++str;
   77|    267|    }
   78|     23|}
pj_cis_add_cis:
   81|      1|{
   82|      1|    int i;
   83|    257|    for (i=0; i<256; ++i) {
  ------------------
  |  Branch (83:15): [True: 256, False: 1]
  ------------------
   84|    256|        if (PJ_CIS_ISSET(rhs, i))
  ------------------
  |  |   90|    256|#define PJ_CIS_ISSET(cis,c) ((cis)->cis_buf[(int)c] & (1 << (cis)->cis_id))
  |  |  ------------------
  |  |  |  Branch (90:29): [True: 79, False: 177]
  |  |  ------------------
  ------------------
   85|     79|            PJ_CIS_SET(cis, i);
  ------------------
  |  |   72|     79|#define PJ_CIS_SET(cis,c)   ((cis)->cis_buf[(int)(c)] |= (1 << (cis)->cis_id))
  ------------------
   86|    256|    }
   87|      1|}
pj_cis_del_str:
   98|      6|{
   99|     12|    while (*str) {
  ------------------
  |  Branch (99:12): [True: 6, False: 6]
  ------------------
  100|      6|        PJ_CIS_CLR(cis, *str);
  ------------------
  |  |   81|      6|#define PJ_CIS_CLR(cis,c)   ((cis)->cis_buf[(int)c] &= ~(1 << (cis)->cis_id))
  ------------------
  101|      6|        ++str;
  102|      6|    }
  103|      6|}
pj_cis_invert:
  106|      4|{
  107|      4|    unsigned i;
  108|       |    /* Can not set zero. This is the requirement of the parser. */
  109|  1.02k|    for (i=1; i<256; ++i) {
  ------------------
  |  Branch (109:15): [True: 1.02k, False: 4]
  ------------------
  110|  1.02k|        if (PJ_CIS_ISSET(cis,i))
  ------------------
  |  |   90|  1.02k|#define PJ_CIS_ISSET(cis,c) ((cis)->cis_buf[(int)c] & (1 << (cis)->cis_id))
  |  |  ------------------
  |  |  |  Branch (90:29): [True: 13, False: 1.00k]
  |  |  ------------------
  ------------------
  111|     13|            PJ_CIS_CLR(cis,i);
  ------------------
  |  |   81|     13|#define PJ_CIS_CLR(cis,c)   ((cis)->cis_buf[(int)c] &= ~(1 << (cis)->cis_id))
  ------------------
  112|  1.00k|        else
  113|  1.00k|            PJ_CIS_SET(cis,i);
  ------------------
  |  |   72|  1.00k|#define PJ_CIS_SET(cis,c)   ((cis)->cis_buf[(int)(c)] |= (1 << (cis)->cis_id))
  ------------------
  114|  1.02k|    }
  115|      4|}
pj_scan_init:
  120|  18.0k|{
  121|  18.0k|    PJ_CHECK_STACK();
  122|       |
  123|  18.0k|    scanner->begin = scanner->curptr = bufstart;
  124|  18.0k|    scanner->end = bufstart + buflen;
  125|  18.0k|    scanner->line = 1;
  126|  18.0k|    scanner->start_line = scanner->begin;
  127|  18.0k|    scanner->callback = callback;
  128|  18.0k|    scanner->skip_ws = options;
  129|       |
  130|  18.0k|    if (scanner->skip_ws) 
  ------------------
  |  Branch (130:9): [True: 10.1k, False: 7.88k]
  ------------------
  131|  10.1k|        pj_scan_skip_whitespace(scanner);
  132|  18.0k|}
pj_scan_fini:
  136|  14.6k|{
  137|  14.6k|    PJ_CHECK_STACK();
  138|  14.6k|    PJ_UNUSED_ARG(scanner);
  ------------------
  |  | 1537|  14.6k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  139|  14.6k|}
pj_scan_skip_whitespace:
  142|   109k|{
  143|   109k|    register char *s = scanner->curptr;
  144|       |
  145|   126k|    while (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_SPACE(*s)) {
  ------------------
  |  |   33|   252k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 122k, False: 3.92k]
  |  |  ------------------
  ------------------
                  while (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_SPACE(*s)) {
  ------------------
  |  |   30|   122k|#define PJ_SCAN_IS_SPACE(c)             ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (30:42): [True: 15.4k, False: 107k]
  |  |  |  Branch (30:54): [True: 1.64k, False: 105k]
  |  |  ------------------
  ------------------
  146|  17.1k|        ++s;
  147|  17.1k|    }
  148|       |
  149|   109k|    if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_NEWLINE(*s) &&
  ------------------
  |  |   33|   218k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 105k, False: 3.92k]
  |  |  ------------------
  ------------------
                  if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_NEWLINE(*s) &&
  ------------------
  |  |   31|   214k|#define PJ_SCAN_IS_NEWLINE(c)           ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (31:42): [True: 4.29k, False: 101k]
  |  |  |  Branch (31:55): [True: 33.7k, False: 67.3k]
  |  |  ------------------
  ------------------
  150|  38.0k|        (scanner->skip_ws & PJ_SCAN_AUTOSKIP_NEWLINE))
  ------------------
  |  Branch (150:9): [True: 0, False: 38.0k]
  ------------------
  151|      0|    {
  152|      0|        for (; PJ_SCAN_CHECK_EOF(s); ) {
  ------------------
  |  |   33|      0|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  153|      0|            if (*s == '\r') {
  ------------------
  |  Branch (153:17): [True: 0, False: 0]
  ------------------
  154|      0|                ++s;
  155|      0|                if (!PJ_SCAN_CHECK_EOF(s)) break;
  ------------------
  |  |   33|      0|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  ------------------
  |  Branch (155:21): [True: 0, False: 0]
  ------------------
  156|      0|                if (*s == '\n') ++s;
  ------------------
  |  Branch (156:21): [True: 0, False: 0]
  ------------------
  157|      0|                ++scanner->line;
  158|      0|                scanner->curptr = scanner->start_line = s;
  159|      0|            } else if (*s == '\n') {
  ------------------
  |  Branch (159:24): [True: 0, False: 0]
  ------------------
  160|      0|                ++s;
  161|      0|                ++scanner->line;
  162|      0|                scanner->curptr = scanner->start_line = s;
  163|      0|            } else if (PJ_SCAN_IS_SPACE(*s)) {
  ------------------
  |  |   30|      0|#define PJ_SCAN_IS_SPACE(c)             ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (30:42): [True: 0, False: 0]
  |  |  |  Branch (30:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  164|      0|                do {
  165|      0|                    ++s;
  166|      0|                } while (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_SPACE(*s));
  ------------------
  |  |   33|      0|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                              } while (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_SPACE(*s));
  ------------------
  |  |   30|      0|#define PJ_SCAN_IS_SPACE(c)             ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (30:42): [True: 0, False: 0]
  |  |  |  Branch (30:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  167|      0|            } else {
  168|      0|                break;
  169|      0|            }
  170|      0|        }
  171|      0|    }
  172|       |
  173|   109k|    if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_NEWLINE(*s) &&
  ------------------
  |  |   33|   218k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 105k, False: 3.92k]
  |  |  ------------------
  ------------------
                  if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_NEWLINE(*s) &&
  ------------------
  |  |   31|   214k|#define PJ_SCAN_IS_NEWLINE(c)           ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (31:42): [True: 4.29k, False: 101k]
  |  |  |  Branch (31:55): [True: 33.7k, False: 67.3k]
  |  |  ------------------
  ------------------
  174|  38.0k|        (scanner->skip_ws & PJ_SCAN_AUTOSKIP_WS_HEADER)==
  ------------------
  |  Branch (174:9): [True: 37.7k, False: 325]
  ------------------
  175|  38.0k|         PJ_SCAN_AUTOSKIP_WS_HEADER)
  176|  37.7k|    {
  177|       |        /* Check for header continuation. */
  178|  37.7k|        scanner->curptr = s;
  179|       |
  180|  37.7k|        if (*s == '\r') {
  ------------------
  |  Branch (180:13): [True: 4.12k, False: 33.5k]
  ------------------
  181|  4.12k|            ++s;
  182|  4.12k|        }
  183|  37.7k|        if (PJ_SCAN_CHECK_EOF(s) && *s == '\n') {
  ------------------
  |  |   33|  75.4k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 37.6k, False: 40]
  |  |  ------------------
  ------------------
  |  Branch (183:37): [True: 34.6k, False: 3.07k]
  ------------------
  184|  34.6k|            ++s;
  185|  34.6k|        }
  186|  37.7k|        scanner->start_line = s;
  187|       |
  188|  37.7k|        if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_SPACE(*s)) {
  ------------------
  |  |   33|  75.4k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 35.4k, False: 2.27k]
  |  |  ------------------
  ------------------
                      if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_SPACE(*s)) {
  ------------------
  |  |   30|  35.4k|#define PJ_SCAN_IS_SPACE(c)             ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (30:42): [True: 629, False: 34.8k]
  |  |  |  Branch (30:54): [True: 642, False: 34.1k]
  |  |  ------------------
  ------------------
  189|  1.27k|            register char *t = s;
  190|  1.68k|            do {
  191|  1.68k|                ++t;
  192|  1.68k|            } while (PJ_SCAN_CHECK_EOF(t) && PJ_SCAN_IS_SPACE(*t));
  ------------------
  |  |   33|  3.36k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 1.66k, False: 21]
  |  |  ------------------
  ------------------
                          } while (PJ_SCAN_CHECK_EOF(t) && PJ_SCAN_IS_SPACE(*t));
  ------------------
  |  |   30|  1.66k|#define PJ_SCAN_IS_SPACE(c)             ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (30:42): [True: 203, False: 1.46k]
  |  |  |  Branch (30:54): [True: 210, False: 1.25k]
  |  |  ------------------
  ------------------
  193|       |
  194|  1.27k|            ++scanner->line;
  195|  1.27k|            scanner->curptr = t;
  196|  1.27k|        }
  197|  71.6k|    } else {
  198|  71.6k|        scanner->curptr = s;
  199|  71.6k|    }
  200|   109k|}
pj_scan_skip_line:
  203|  21.7k|{
  204|  21.7k|    char *s;
  205|       |
  206|  21.7k|    if (pj_scan_is_eof(scanner)) {
  ------------------
  |  Branch (206:9): [True: 0, False: 21.7k]
  ------------------
  207|      0|        return;
  208|      0|    }
  209|       |
  210|  21.7k|    s = pj_memchr(scanner->curptr, '\n', scanner->end - scanner->curptr);
  211|  21.7k|    if (!s) {
  ------------------
  |  Branch (211:9): [True: 517, False: 21.1k]
  ------------------
  212|    517|        scanner->curptr = scanner->end;
  213|  21.1k|    } else {
  214|  21.1k|        scanner->curptr = scanner->start_line = s+1;
  215|  21.1k|        scanner->line++;
  216|  21.1k|   }
  217|  21.7k|}
pj_scan_peek:
  221|  60.6k|{
  222|  60.6k|    register char *s = scanner->curptr;
  223|       |
  224|  60.6k|    if (s >= scanner->end) {
  ------------------
  |  Branch (224:9): [True: 169, False: 60.4k]
  ------------------
  225|    169|        pj_scan_syntax_err(scanner);
  226|    169|        return -1;
  227|    169|    }
  228|       |
  229|  1.59M|    while (PJ_SCAN_CHECK_EOF(s) && pj_cis_match(spec, *s))
  ------------------
  |  |   33|  3.19M|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 1.59M, False: 4.32k]
  |  |  ------------------
  ------------------
  |  Branch (229:36): [True: 1.53M, False: 56.1k]
  ------------------
  230|  1.53M|        ++s;
  231|       |
  232|  60.4k|    pj_strset3(out, scanner->curptr, s);
  233|  60.4k|    return *s;
  234|  60.6k|}
pj_scan_get:
  273|   201k|{
  274|   201k|    register char *s = scanner->curptr;
  275|       |
  276|   201k|    pj_assert(pj_cis_match(spec,0)==0);
  ------------------
  |  |   65|   201k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (276:5): [True: 0, False: 201k]
  |  Branch (276:5): [True: 201k, False: 0]
  ------------------
  277|       |
  278|   201k|    if (pj_scan_is_eof(scanner) || !pj_cis_match(spec, *s)) {
  ------------------
  |  Branch (278:9): [True: 551, False: 200k]
  |  Branch (278:36): [True: 8.07k, False: 192k]
  ------------------
  279|  8.62k|        pj_scan_syntax_err(scanner);
  280|  8.62k|        return;
  281|  8.62k|    }
  282|       |
  283|  1.01M|    do {
  284|  1.01M|        ++s;
  285|  1.01M|    } while (PJ_SCAN_CHECK_EOF(s) && pj_cis_match(spec, *s));
  ------------------
  |  |   33|  2.02M|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 1.00M, False: 5.89k]
  |  |  ------------------
  ------------------
  |  Branch (285:38): [True: 821k, False: 187k]
  ------------------
  286|       |
  287|   192k|    pj_strset3(out, scanner->curptr, s);
  288|       |
  289|   192k|    scanner->curptr = s;
  290|       |
  291|   192k|    if (!pj_scan_is_eof(scanner) &&
  ------------------
  |  Branch (291:9): [True: 187k, False: 5.89k]
  ------------------
  292|   187k|        PJ_SCAN_IS_PROBABLY_SPACE(*s) && scanner->skip_ws)
  ------------------
  |  |   32|   379k|#define PJ_SCAN_IS_PROBABLY_SPACE(c)    ((c) <= 32)
  |  |  ------------------
  |  |  |  Branch (32:41): [True: 30.7k, False: 156k]
  |  |  ------------------
  ------------------
  |  Branch (292:42): [True: 27.4k, False: 3.26k]
  ------------------
  293|  27.4k|    {
  294|  27.4k|        pj_scan_skip_whitespace(scanner);    
  295|  27.4k|    }
  296|   192k|}
pj_scan_get_quote:
  358|  7.91k|{
  359|  7.91k|    char beg = (char)begin_quote;
  360|  7.91k|    char end = (char)end_quote;
  361|  7.91k|    pj_scan_get_quotes(scanner, &beg, &end, 1, out);
  362|  7.91k|}
pj_scan_get_quotes:
  367|  7.91k|{
  368|  7.91k|    register char *s = scanner->curptr;
  369|  7.91k|    int qpair = -1;
  370|  7.91k|    int i;
  371|       |
  372|  7.91k|    pj_assert(qsize > 0);
  ------------------
  |  |   65|  7.91k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (372:5): [True: 0, False: 7.91k]
  |  Branch (372:5): [True: 7.91k, False: 0]
  ------------------
  373|       |
  374|       |    /* Check and eat the begin_quote. */
  375|  7.91k|    for (i = 0; i < qsize; ++i) {
  ------------------
  |  Branch (375:17): [True: 7.91k, False: 0]
  ------------------
  376|  7.91k|        if (*s == begin_quote[i]) {
  ------------------
  |  Branch (376:13): [True: 7.91k, False: 0]
  ------------------
  377|  7.91k|            qpair = i;
  378|  7.91k|            break;
  379|  7.91k|        }
  380|  7.91k|    }
  381|  7.91k|    if (qpair == -1) {
  ------------------
  |  Branch (381:9): [True: 0, False: 7.91k]
  ------------------
  382|      0|        pj_scan_syntax_err(scanner);
  383|      0|        return;
  384|      0|    }
  385|  7.91k|    ++s;
  386|       |
  387|       |    /* Loop until end_quote is found. 
  388|       |     */
  389|  8.14k|    do {
  390|       |        /* loop until end_quote is found. */
  391|   175k|        while (PJ_SCAN_CHECK_EOF(s) && *s != '\n' && *s != end_quote[qpair]) {
  ------------------
  |  |   33|   350k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 175k, False: 47]
  |  |  ------------------
  ------------------
  |  Branch (391:40): [True: 174k, False: 485]
  |  Branch (391:54): [True: 167k, False: 7.61k]
  ------------------
  392|   167k|            ++s;
  393|   167k|        }
  394|       |
  395|       |        /* check that no backslash character precedes the end_quote. */
  396|  8.14k|        if (*s == end_quote[qpair]) {
  ------------------
  |  Branch (396:13): [True: 7.61k, False: 532]
  ------------------
  397|  7.61k|            if (*(s-1) == '\\') {
  ------------------
  |  Branch (397:17): [True: 444, False: 7.17k]
  ------------------
  398|    444|                char *q = s-2;
  399|    444|                char *r = s-2;
  400|       |
  401|    856|                while (r != scanner->begin && *r == '\\') {
  ------------------
  |  Branch (401:24): [True: 840, False: 16]
  |  Branch (401:47): [True: 412, False: 428]
  ------------------
  402|    412|                    --r;
  403|    412|                }
  404|       |                /* break from main loop if we have odd number of backslashes */
  405|    444|                if (((unsigned)(q-r) & 0x01) == 1) {
  ------------------
  |  Branch (405:21): [True: 210, False: 234]
  ------------------
  406|    210|                    break;
  407|    210|                }
  408|    234|                ++s;
  409|  7.17k|            } else {
  410|       |                /* end_quote is not preceeded by backslash. break now. */
  411|  7.17k|                break;
  412|  7.17k|            }
  413|  7.61k|        } else {
  414|       |            /* loop ended by non-end_quote character. break now. */
  415|    532|            break;
  416|    532|        }
  417|  8.14k|    } while (1);
  ------------------
  |  Branch (417:14): [True: 234, Folded]
  ------------------
  418|       |
  419|       |    /* Check and eat the end quote. */
  420|  7.91k|    if (*s != end_quote[qpair]) {
  ------------------
  |  Branch (420:9): [True: 532, False: 7.38k]
  ------------------
  421|    532|        pj_scan_syntax_err(scanner);
  422|    532|        return;
  423|    532|    }
  424|  7.38k|    ++s;
  425|       |
  426|  7.38k|    pj_strset3(out, scanner->curptr, s);
  427|       |
  428|  7.38k|    scanner->curptr = s;
  429|       |
  430|  7.38k|    if (!pj_scan_is_eof(scanner) &&
  ------------------
  |  Branch (430:9): [True: 7.21k, False: 163]
  ------------------
  431|  7.21k|        PJ_SCAN_IS_PROBABLY_SPACE(*s) && scanner->skip_ws)
  ------------------
  |  |   32|  14.6k|#define PJ_SCAN_IS_PROBABLY_SPACE(c)    ((c) <= 32)
  |  |  ------------------
  |  |  |  Branch (32:41): [True: 2.38k, False: 4.83k]
  |  |  ------------------
  ------------------
  |  Branch (431:42): [True: 2.18k, False: 204]
  ------------------
  432|  2.18k|    {
  433|  2.18k|        pj_scan_skip_whitespace(scanner);
  434|  2.18k|    }
  435|  7.38k|}
pj_scan_get_n:
  440|  8.57k|{
  441|  8.57k|    if (scanner->curptr + N > scanner->end) {
  ------------------
  |  Branch (441:9): [True: 349, False: 8.22k]
  ------------------
  442|    349|        pj_scan_syntax_err(scanner);
  443|    349|        return;
  444|    349|    }
  445|       |
  446|  8.22k|    pj_strset(out, scanner->curptr, N);
  447|       |    
  448|  8.22k|    scanner->curptr += N;
  449|       |
  450|  8.22k|    if (!pj_scan_is_eof(scanner) &&
  ------------------
  |  Branch (450:9): [True: 8.00k, False: 219]
  ------------------
  451|  8.00k|        PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && scanner->skip_ws)
  ------------------
  |  |   32|  16.2k|#define PJ_SCAN_IS_PROBABLY_SPACE(c)    ((c) <= 32)
  |  |  ------------------
  |  |  |  Branch (32:41): [True: 1.50k, False: 6.50k]
  |  |  ------------------
  ------------------
  |  Branch (451:56): [True: 1.50k, False: 0]
  ------------------
  452|  1.50k|    {
  453|  1.50k|        pj_scan_skip_whitespace(scanner);
  454|  1.50k|    }
  455|  8.22k|}
pj_scan_get_char:
  459|   181k|{
  460|   181k|    register char *s = scanner->curptr;
  461|   181k|    int chr;
  462|       |
  463|   181k|    if (s >= scanner->end || !*s) {
  ------------------
  |  Branch (463:9): [True: 268, False: 181k]
  |  Branch (463:30): [True: 417, False: 180k]
  ------------------
  464|    685|        pj_scan_syntax_err(scanner);
  465|    685|        return 0;
  466|    685|    }
  467|       |
  468|   180k|    chr = *s;
  469|       |
  470|   180k|    ++s;
  471|   180k|    scanner->curptr = s;
  472|   180k|    if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_PROBABLY_SPACE(*s) &&
  ------------------
  |  |   33|   361k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 178k, False: 2.12k]
  |  |  ------------------
  ------------------
                  if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_PROBABLY_SPACE(*s) &&
  ------------------
  |  |   32|   359k|#define PJ_SCAN_IS_PROBABLY_SPACE(c)    ((c) <= 32)
  |  |  ------------------
  |  |  |  Branch (32:41): [True: 23.3k, False: 155k]
  |  |  ------------------
  ------------------
  473|  23.3k|        scanner->skip_ws)
  ------------------
  |  Branch (473:9): [True: 21.6k, False: 1.64k]
  ------------------
  474|  21.6k|    {
  475|  21.6k|        pj_scan_skip_whitespace(scanner);
  476|  21.6k|    }
  477|   180k|    return chr;
  478|   181k|}
pj_scan_get_newline:
  482|  24.8k|{
  483|  24.8k|    if (pj_scan_is_eof(scanner) || !PJ_SCAN_IS_NEWLINE(*scanner->curptr)) {
  ------------------
  |  |   31|  24.8k|#define PJ_SCAN_IS_NEWLINE(c)           ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (31:42): [True: 3.10k, False: 21.7k]
  |  |  |  Branch (31:55): [True: 20.6k, False: 1.10k]
  |  |  ------------------
  ------------------
  |  Branch (483:9): [True: 8, False: 24.8k]
  ------------------
  484|  1.11k|        pj_scan_syntax_err(scanner);
  485|  1.11k|        return;
  486|  1.11k|    }
  487|       |
  488|       |    /* We have checked scanner->curptr validity above */
  489|  23.7k|    if (*scanner->curptr == '\r') {
  ------------------
  |  Branch (489:9): [True: 3.10k, False: 20.6k]
  ------------------
  490|  3.10k|        ++scanner->curptr;
  491|  3.10k|    }
  492|  23.7k|    if (!pj_scan_is_eof(scanner) && *scanner->curptr == '\n') {
  ------------------
  |  Branch (492:9): [True: 23.7k, False: 35]
  |  Branch (492:37): [True: 20.8k, False: 2.83k]
  ------------------
  493|  20.8k|        ++scanner->curptr;
  494|  20.8k|    }
  495|       |
  496|  23.7k|    ++scanner->line;
  497|  23.7k|    scanner->start_line = scanner->curptr;
  498|       |
  499|       |    /**
  500|       |     * This probably is a bug, see PROTOS test #2480.
  501|       |     * This would cause scanner to incorrectly eat two new lines, e.g.
  502|       |     * when parsing:
  503|       |     *   
  504|       |     *  Content-Length: 120\r\n
  505|       |     *  \r\n
  506|       |     *  <space><space><space>...
  507|       |     *
  508|       |     * When pj_scan_get_newline() is called to parse the first newline
  509|       |     * in the Content-Length header, it will eat the second newline
  510|       |     * too because it thinks that it's a header continuation.
  511|       |     *
  512|       |     * if (PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && scanner->skip_ws) {
  513|       |     *    pj_scan_skip_whitespace(scanner);
  514|       |     * }
  515|       |     */
  516|  23.7k|}
pj_scan_get_until_ch:
  547|  2.25k|{
  548|  2.25k|    register char *s = scanner->curptr;
  549|       |
  550|  2.25k|    if (s >= scanner->end) {
  ------------------
  |  Branch (550:9): [True: 9, False: 2.24k]
  ------------------
  551|      9|        pj_scan_syntax_err(scanner);
  552|      9|        return;
  553|      9|    }
  554|       |
  555|  37.2k|    while (PJ_SCAN_CHECK_EOF(s) && *s != until_char) {
  ------------------
  |  |   33|  74.5k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 37.0k, False: 199]
  |  |  ------------------
  ------------------
  |  Branch (555:36): [True: 35.0k, False: 2.04k]
  ------------------
  556|  35.0k|        ++s;
  557|  35.0k|    }
  558|       |
  559|  2.24k|    pj_strset3(out, scanner->curptr, s);
  560|       |
  561|  2.24k|    scanner->curptr = s;
  562|       |
  563|  2.24k|    if (!pj_scan_is_eof(scanner) && PJ_SCAN_IS_PROBABLY_SPACE(*s) &&
  ------------------
  |  |   32|  4.29k|#define PJ_SCAN_IS_PROBABLY_SPACE(c)    ((c) <= 32)
  |  |  ------------------
  |  |  |  Branch (32:41): [True: 0, False: 2.04k]
  |  |  ------------------
  ------------------
  |  Branch (563:9): [True: 2.04k, False: 199]
  ------------------
  564|      0|        scanner->skip_ws)
  ------------------
  |  Branch (564:9): [True: 0, False: 0]
  ------------------
  565|      0|    {
  566|      0|        pj_scan_skip_whitespace(scanner);
  567|      0|    }
  568|  2.24k|}
scanner.c:pj_scan_syntax_err:
   45|  11.4k|{
   46|  11.4k|    (*scanner->callback)(scanner);
   47|  11.4k|}

pj_cis_buf_init:
   26|      2|{
   27|      2|    pj_bzero(cis_buf->cis_buf, sizeof(cis_buf->cis_buf));
   28|      2|    cis_buf->use_mask = 0;
   29|      2|}
pj_cis_init:
   32|     32|{
   33|     32|    unsigned i;
   34|       |
   35|     32|    cis->cis_buf = cis_buf->cis_buf;
   36|       |
   37|    308|    for (i=0; i<PJ_CIS_MAX_INDEX; ++i) {
  ------------------
  |  |   44|    308|#define PJ_CIS_MAX_INDEX   (sizeof(pj_cis_elem_t) << 3)
  ------------------
  |  Branch (37:15): [True: 308, False: 0]
  ------------------
   38|    308|        if ((cis_buf->use_mask & (1 << i)) == 0) {
  ------------------
  |  Branch (38:13): [True: 32, False: 276]
  ------------------
   39|     32|            cis->cis_id = i;
   40|     32|            cis_buf->use_mask |= (1 << i);
   41|     32|            return PJ_SUCCESS;
   42|     32|        }
   43|    308|    }
   44|       |
   45|      0|    cis->cis_id = PJ_CIS_MAX_INDEX;
  ------------------
  |  |   44|      0|#define PJ_CIS_MAX_INDEX   (sizeof(pj_cis_elem_t) << 3)
  ------------------
   46|      0|    return PJ_ETOOMANY;
  ------------------
  |  |  423|      0|#define PJ_ETOOMANY         (PJ_ERRNO_START_STATUS + 10)/* 70010 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   47|     32|}
pj_cis_dup:
   50|     18|{
   51|     18|    pj_status_t status;
   52|     18|    unsigned i;
   53|       |
   54|       |    /* Warning: typecasting here! */
   55|     18|    status = pj_cis_init((pj_cis_buf_t*)existing->cis_buf, new_cis);
   56|     18|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (56:9): [True: 0, False: 18]
  ------------------
   57|      0|        return status;
   58|       |
   59|  4.62k|    for (i=0; i<256; ++i) {
  ------------------
  |  Branch (59:15): [True: 4.60k, False: 18]
  ------------------
   60|  4.60k|        if (PJ_CIS_ISSET(existing, i))
  ------------------
  |  |   90|  4.60k|#define PJ_CIS_ISSET(cis,c) ((cis)->cis_buf[(int)c] & (1 << (cis)->cis_id))
  |  |  ------------------
  |  |  |  Branch (90:29): [True: 1.23k, False: 3.37k]
  |  |  ------------------
  ------------------
   61|  1.23k|            PJ_CIS_SET(new_cis, i);
  ------------------
  |  |   72|  1.23k|#define PJ_CIS_SET(cis,c)   ((cis)->cis_buf[(int)(c)] |= (1 << (cis)->cis_id))
  ------------------
   62|  3.37k|        else
   63|  3.37k|            PJ_CIS_CLR(new_cis, i);
  ------------------
  |  |   81|  3.37k|#define PJ_CIS_CLR(cis,c)   ((cis)->cis_buf[(int)c] &= ~(1 << (cis)->cis_id))
  ------------------
   64|  4.60k|    }
   65|       |
   66|     18|    return PJ_SUCCESS;
   67|     18|}

pj_str_unescape:
   25|  16.5k|{
   26|  16.5k|    char *src = src_str->ptr;
   27|  16.5k|    char *end = src + src_str->slen;
   28|  16.5k|    pj_str_t dst_str;
   29|  16.5k|    char *dst;
   30|       |    
   31|  16.5k|    if (pj_strchr(src_str, '%')==NULL)
  ------------------
  |  Branch (31:9): [True: 15.2k, False: 1.33k]
  ------------------
   32|  15.2k|        return *src_str;
   33|       |
   34|  1.33k|    dst = dst_str.ptr = (char*) pj_pool_alloc(pool, src_str->slen);
   35|       |
   36|   107k|    while (src != end) {
  ------------------
  |  Branch (36:12): [True: 106k, False: 1.33k]
  ------------------
   37|   106k|        if (*src == '%' && src < end-2 && pj_isxdigit(*(src+1)) && 
  ------------------
  |  Branch (37:13): [True: 6.24k, False: 100k]
  |  Branch (37:28): [True: 5.25k, False: 984]
  |  Branch (37:43): [True: 2.78k, False: 2.47k]
  ------------------
   38|  2.78k|            pj_isxdigit(*(src+2))) 
  ------------------
  |  Branch (38:13): [True: 2.31k, False: 464]
  ------------------
   39|  2.31k|        {
   40|  2.31k|            *dst = (pj_uint8_t) ((pj_hex_digit_to_val(*(src+1)) << 4) + 
   41|  2.31k|                                 pj_hex_digit_to_val(*(src+2)));
   42|  2.31k|            ++dst;
   43|  2.31k|            src += 3;
   44|   104k|        } else {
   45|   104k|            *dst++ = *src++;
   46|   104k|        }
   47|   106k|    }
   48|  1.33k|    dst_str.slen = dst - dst_str.ptr;
   49|  1.33k|    return dst_str;
   50|  16.5k|}

sip_multipart.c:pj_isspace:
   83|  24.8k|PJ_INLINE(int) pj_isspace(unsigned char c) { return isspace(c); }
sip_parser.c:pj_tolower:
  118|    215|PJ_INLINE(int) pj_tolower(unsigned char c) { return tolower(c); }
  ------------------
  |  Branch (118:53): [True: 0, False: 0]
  |  Branch (118:53): [True: 0, False: 0]
  |  Branch (118:53): [Folded, False: 215]
  ------------------
sip_auth_client.c:pj_val_to_hex_digit:
  149|  24.4k|{
  150|  24.4k|    *p++ = pj_hex_digits[ (value & 0xF0) >> 4 ];
  ------------------
  |  |  140|  24.4k|#define pj_hex_digits   "0123456789abcdef"
  ------------------
  151|  24.4k|    *p   = pj_hex_digits[ (value & 0x0F) ];
  ------------------
  |  |  140|  24.4k|#define pj_hex_digits   "0123456789abcdef"
  ------------------
  152|  24.4k|}
sip_auth_client.c:pj_tolower:
  118|  15.6k|PJ_INLINE(int) pj_tolower(unsigned char c) { return tolower(c); }
  ------------------
  |  Branch (118:53): [True: 0, False: 0]
  |  Branch (118:53): [True: 0, False: 0]
  |  Branch (118:53): [Folded, False: 15.6k]
  ------------------
sip_tel_uri.c:pj_tolower:
  118|  1.81k|PJ_INLINE(int) pj_tolower(unsigned char c) { return tolower(c); }
  ------------------
  |  Branch (118:53): [True: 0, False: 0]
  |  Branch (118:53): [True: 0, False: 0]
  |  Branch (118:53): [Folded, False: 1.81k]
  ------------------
string.c:pj_isxdigit:
  134|  8.04k|PJ_INLINE(int) pj_isxdigit(unsigned char c){ return isxdigit(c); }
string.c:pj_hex_digit_to_val:
  160|  4.63k|{
  161|  4.63k|    if (c <= '9')
  ------------------
  |  Branch (161:9): [True: 2.06k, False: 2.57k]
  ------------------
  162|  2.06k|        return (c-'0') & 0x0F;
  163|  2.57k|    else if (c <= 'F')
  ------------------
  |  Branch (163:14): [True: 543, False: 2.03k]
  ------------------
  164|    543|        return  (c-'A'+10) & 0x0F;
  165|  2.03k|    else
  166|  2.03k|        return (c-'a'+10) & 0x0F;
  167|  4.63k|}
string.c:pj_isdigit:
   74|  4.36k|PJ_INLINE(int) pj_isdigit(unsigned char c) { return isdigit(c); }
string.c:pj_isspace:
   83|  23.5k|PJ_INLINE(int) pj_isspace(unsigned char c) { return isspace(c); }
hash.c:pj_tolower:
  118|  50.2k|PJ_INLINE(int) pj_tolower(unsigned char c) { return tolower(c); }
  ------------------
  |  Branch (118:53): [True: 0, False: 0]
  |  Branch (118:53): [True: 0, False: 0]
  |  Branch (118:53): [Folded, False: 50.2k]
  ------------------

fuzz-sip.c:pj_list_init:
   88|  6.18k|{
   89|  6.18k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  6.18k|}
fuzz-sip.c:pj_list_push_back:
  125|  3.35k|{
  126|  3.35k|    pj_list_insert_before(list, node);
  127|  3.35k|}
fuzz-sip.c:pj_list_empty:
  102|     87|{
  103|     87|    return ((pj_list*)node)->next == node;
  104|     87|}
sip_multipart.c:pj_list_init:
   88|  13.1k|{
   89|  13.1k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  13.1k|}
sip_multipart.c:pj_list_push_back:
  125|  13.1k|{
  126|  13.1k|    pj_list_insert_before(list, node);
  127|  13.1k|}
sip_multipart.c:pj_list_empty:
  102|     71|{
  103|     71|    return ((pj_list*)node)->next == node;
  104|     71|}
sip_msg.c:pj_list_init:
   88|  85.6k|{
   89|  85.6k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  85.6k|}
sip_parser.c:pj_list_push_back:
  125|  1.24k|{
  126|  1.24k|    pj_list_insert_before(list, node);
  127|  1.24k|}
sip_uri.c:pj_list_init:
   88|  50.0k|{
   89|  50.0k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  50.0k|}
sip_endpoint.c:pj_list_init:
   88|      4|{
   89|      4|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|      4|}
sip_util.c:pj_list_push_back:
  125|     87|{
  126|     87|    pj_list_insert_before(list, node);
  127|     87|}
sip_transport.c:pj_list_init:
   88|    624|{
   89|    624|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|    624|}
sip_transport.c:pj_list_empty:
  102|      1|{
  103|      1|    return ((pj_list*)node)->next == node;
  104|      1|}
sip_transport.c:pj_list_push_back:
  125|     16|{
  126|     16|    pj_list_insert_before(list, node);
  127|     16|}
sip_transport_loop.c:pj_list_empty:
  102|  2.19k|{
  103|  2.19k|    return ((pj_list*)node)->next == node;
  104|  2.19k|}
sip_transport_loop.c:pj_list_init:
   88|      4|{
   89|      4|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|      4|}
sip_auth_client.c:pj_list_init:
   88|  1.33k|{
   89|  1.33k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  1.33k|}
sip_auth_msg.c:pj_list_init:
   88|  15.7k|{
   89|  15.7k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  15.7k|}
sip_auth_parser.c:pj_list_init:
   88|  4.79k|{
   89|  4.79k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  4.79k|}
sip_dialog.c:pj_list_push_back:
  125|  3.35k|{
  126|  3.35k|    pj_list_insert_before(list, node);
  127|  3.35k|}
sip_dialog.c:pj_list_init:
   88|    514|{
   89|    514|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|    514|}
sip_dialog.c:pj_list_empty:
  102|     87|{
  103|     87|    return ((pj_list*)node)->next == node;
  104|     87|}
sip_ua_layer.c:pj_list_push_back:
  125|    174|{
  126|    174|    pj_list_insert_before(list, node);
  127|    174|}
sip_ua_layer.c:pj_list_init:
   88|     88|{
   89|     88|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|     88|}
sip_ua_layer.c:pj_list_empty:
  102|    174|{
  103|    174|    return ((pj_list*)node)->next == node;
  104|    174|}
sip_tel_uri.c:pj_list_init:
   88|  2.57k|{
   89|  2.57k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  2.57k|}
ioqueue_select.c:pj_list_init:
   88|      3|{
   89|      3|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|      3|}
ioqueue_select.c:pj_list_push_back:
  125|     64|{
  126|     64|    pj_list_insert_before(list, node);
  127|     64|}
list.c:pj_list_init:
   88|  21.6k|{
   89|  21.6k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  21.6k|}
lock.c:pj_list_init:
   88|    176|{
   89|    176|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|    176|}
lock.c:pj_list_push_back:
  125|    175|{
  126|    175|    pj_list_insert_before(list, node);
  127|    175|}
pool.c:pj_list_init:
   88|    100|{
   89|    100|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|    100|}
pool_caching.c:pj_list_init:
   88|     17|{
   89|     17|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|     17|}
pool_caching.c:pj_list_empty:
  102|  8.04k|{
  103|  8.04k|    return ((pj_list*)node)->next == node;
  104|  8.04k|}

pj_list_insert_after:
   29|   153k|{
   30|   153k|    ((pj_list*)node)->prev = pos;
   31|   153k|    ((pj_list*)node)->next = ((pj_list*)pos)->next;
   32|   153k|    ((pj_list*) ((pj_list*)pos)->next) ->prev = node;
   33|   153k|    ((pj_list*)pos)->next = node;
   34|   153k|}
pj_list_insert_before:
   38|   139k|{
   39|   139k|    pj_list_insert_after(((pj_list*)pos)->prev, node);
   40|   139k|}
pj_list_insert_nodes_after:
   44|  22.2k|{
   45|  22.2k|    pj_list *lst_last = (pj_list *) ((pj_list*)lst)->prev;
   46|  22.2k|    pj_list *pos_next = (pj_list *) ((pj_list*)pos)->next;
   47|       |
   48|  22.2k|    pj_link_node(pos, lst);
   49|  22.2k|    pj_link_node(lst_last, pos_next);
   50|  22.2k|}
pj_list_insert_nodes_before:
   53|  22.2k|{
   54|  22.2k|    pj_list_insert_nodes_after(((pj_list*)pos)->prev, lst);
   55|  22.2k|}
pj_list_erase:
   93|  21.6k|{
   94|  21.6k|    pj_link_node( ((pj_list*)node)->prev, ((pj_list*)node)->next);
   95|       |
   96|       |    /* It'll be safer to init the next/prev fields to itself, to
   97|       |     * prevent multiple erase() from corrupting the list. See
   98|       |     * ticket #520 for one sample bug.
   99|       |     */
  100|  21.6k|    pj_list_init(node);
  101|  21.6k|}
pj_list_find_node:
  105|  6.62k|{
  106|  6.62k|    pj_list *p = (pj_list *) ((pj_list*)list)->next;
  107|  2.40M|    while (p != list && p != node)
  ------------------
  |  Branch (107:12): [True: 2.40M, False: 10]
  |  Branch (107:25): [True: 2.39M, False: 6.61k]
  ------------------
  108|  2.39M|        p = (pj_list *) p->next;
  109|       |
  110|  6.62k|    return p==node ? p : NULL;
  ------------------
  |  Branch (110:12): [True: 6.61k, False: 10]
  ------------------
  111|  6.62k|}
pj_list_search:
  116|     10|{
  117|     10|    pj_list *p = (pj_list *) ((pj_list*)list)->next;
  118|     30|    while (p != list && (*comp)(value, p) != 0)
  ------------------
  |  Branch (118:12): [True: 20, False: 10]
  |  Branch (118:25): [True: 20, False: 0]
  ------------------
  119|     20|        p = (pj_list *) p->next;
  120|       |
  121|     10|    return p==list ? NULL : p;
  ------------------
  |  Branch (121:12): [True: 10, False: 0]
  ------------------
  122|     10|}
list.c:pj_link_node:
   23|  66.0k|{
   24|  66.0k|    ((pj_list*)prev)->next = next;
   25|  66.0k|    ((pj_list*)next)->prev = prev;
   26|  66.0k|}

sip_multipart.c:pj_pool_zalloc:
  552|  26.3k|{
  553|  26.3k|    return pj_pool_calloc(pool, 1, size);
  554|  26.3k|}
sip_uri.c:pj_pool_zalloc:
  552|  9.49k|{
  553|  9.49k|    return pj_pool_calloc(pool, 1, size);
  554|  9.49k|}
sip_endpoint.c:pj_pool_zalloc:
  552|      1|{
  553|      1|    return pj_pool_calloc(pool, 1, size);
  554|      1|}
sip_util.c:pj_pool_zalloc:
  552|     87|{
  553|     87|    return pj_pool_calloc(pool, 1, size);
  554|     87|}
sip_resolve.c:pj_pool_zalloc:
  552|      1|{
  553|      1|    return pj_pool_calloc(pool, 1, size);
  554|      1|}
sip_transport.c:pj_pool_zalloc:
  552|    622|{
  553|    622|    return pj_pool_calloc(pool, 1, size);
  554|    622|}
sip_transport_loop.c:pj_pool_zalloc:
  552|      1|{
  553|      1|    return pj_pool_calloc(pool, 1, size);
  554|      1|}
sip_auth_client.c:pj_pool_zalloc:
  552|  1.10k|{
  553|  1.10k|    return pj_pool_calloc(pool, 1, size);
  554|  1.10k|}
sip_auth_msg.c:pj_pool_zalloc:
  552|  7.85k|{
  553|  7.85k|    return pj_pool_calloc(pool, 1, size);
  554|  7.85k|}
sip_dialog.c:pj_pool_zalloc:
  552|     87|{
  553|     87|    return pj_pool_calloc(pool, 1, size);
  554|     87|}
sip_tel_uri.c:pj_pool_zalloc:
  552|  2.57k|{
  553|  2.57k|    return pj_pool_calloc(pool, 1, size);
  554|  2.57k|}
os_core_unix.c:pj_pool_zalloc:
  552|    696|{
  553|    696|    return pj_pool_calloc(pool, 1, size);
  554|    696|}
ioqueue_select.c:pj_pool_zalloc:
  552|      1|{
  553|      1|    return pj_pool_calloc(pool, 1, size);
  554|      1|}
lock.c:pj_pool_zalloc:
  552|    263|{
  553|    263|    return pj_pool_calloc(pool, 1, size);
  554|    263|}
timer.c:pj_pool_zalloc:
  552|      1|{
  553|      1|    return pj_pool_calloc(pool, 1, size);
  554|      1|}

pj_pool_get_capacity:
   28|  31.8k|{
   29|  31.8k|    return pool->capacity;
   30|  31.8k|}
pj_pool_get_used_size:
   33|    510|{
   34|    510|    pj_pool_block *b = pool->block_list.next;
   35|    510|    pj_size_t used_size = sizeof(pj_pool_t);
   36|  2.91k|    while (b != &pool->block_list) {
  ------------------
  |  Branch (36:12): [True: 2.40k, False: 510]
  ------------------
   37|  2.40k|        used_size += (b->cur - b->buf) + sizeof(pj_pool_block);
   38|  2.40k|        b = b->next;
   39|  2.40k|    }
   40|    510|    return used_size;
   41|    510|}
pj_pool_alloc_from_block:
   45|   376k|{
   46|   376k|    unsigned char *ptr;
   47|       |
   48|   376k|    pj_assert(PJ_IS_POWER_OF_TWO(alignment));
  ------------------
  |  |   65|   376k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (48:5): [True: 0, False: 376k]
  |  Branch (48:5): [True: 0, False: 0]
  |  Branch (48:5): [True: 376k, False: 0]
  |  Branch (48:5): [True: 376k, False: 0]
  ------------------
   49|       |    // Size should be already aligned.
   50|       |    // this code was moved up to pj_pool_aligned_alloc. 
   51|       |    // ...and then removed there
   52|       |    //
   53|       |    ///* The operation below is valid for size==0. 
   54|       |    // * When size==0, the function will return the pointer to the pool
   55|       |    // * memory address, but no memory will be allocated.
   56|       |    // */
   57|       |    //if (size & (alignment -1)) {
   58|       |    //    size = (size + alignment) & ~(alignment -1);
   59|       |    //}
   60|   376k|    ptr = PJ_POOL_ALIGN_PTR(block->cur, alignment);
  ------------------
  |  |   23|   376k|#define PJ_POOL_ALIGN_PTR(PTR,ALIGNMENT)    (PTR + (-(pj_ssize_t)(PTR) & (ALIGNMENT-1)))
  ------------------
   61|   376k|    if (block->cur <= ptr && /* check pointer overflow */
  ------------------
  |  Branch (61:9): [True: 376k, False: 0]
  ------------------
   62|   376k|        block->end - ptr >= (pj_ssize_t)size) /* check available size */
  ------------------
  |  Branch (62:9): [True: 346k, False: 30.2k]
  ------------------
   63|   346k|    {
   64|       |    //if (ptr + size <= block->end &&
   65|       |    //    /* here we check pointer overflow */
   66|       |    //    block->cur <= ptr && ptr <= ptr + size) {
   67|   346k|        block->cur = ptr + size;
   68|   346k|        return ptr;
   69|   346k|    }
   70|  30.2k|    return NULL;
   71|   376k|}
pj_pool_alloc:
   74|   346k|{
   75|   346k|    return pj_pool_aligned_alloc(pool, 0, size);
   76|   346k|}
pj_pool_aligned_alloc:
   80|   346k|{
   81|   346k|    void *ptr;
   82|       |
   83|   346k|    PJ_ASSERT_RETURN(!alignment || PJ_IS_POWER_OF_TWO(alignment), NULL);
  ------------------
  |  |   97|   346k|            do { \
  |  |   98|   346k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 0, False: 0]
  |  |  |  Branch (98:23): [True: 0, False: 0]
  |  |  |  Branch (98:23): [True: 346k, False: 0]
  |  |  ------------------
  |  |   99|   346k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 346k]
  |  |  ------------------
  ------------------
  |  Branch (83:5): [True: 0, False: 0]
  |  Branch (83:5): [True: 0, False: 0]
  |  Branch (83:5): [True: 0, False: 0]
  |  Branch (83:5): [True: 0, False: 0]
  |  Branch (83:5): [True: 0, False: 0]
  |  Branch (83:5): [True: 0, False: 0]
  ------------------
   84|       |
   85|   346k|    if (!alignment)
  ------------------
  |  Branch (85:9): [True: 346k, False: 0]
  ------------------
   86|   346k|        alignment = pool->alignment;
   87|       |
   88|       |#if 0
   89|       |    //Rounding up is the compiler's job, not the allocator's.
   90|       |
   91|       |    /* The operation below is valid for size==0. 
   92|       |     * When size==0, the function will return the pointer to the pool
   93|       |     * memory address, but no memory will be allocated.
   94|       |     */
   95|       |    if (size & (alignment -1)) {
   96|       |        size = (size + alignment) & ~(alignment -1);
   97|       |    }
   98|       |    pj_assert(PJ_IS_ALIGNED(size, alignment));
   99|       |#endif
  100|       |
  101|   346k|    ptr = pj_pool_alloc_from_block(pool->block_list.next, 
  102|   346k|                                   alignment, size);
  103|   346k|    if (!ptr)
  ------------------
  |  Branch (103:9): [True: 6.33k, False: 340k]
  ------------------
  104|  6.33k|        ptr = pj_pool_allocate_find(pool, alignment, size);
  105|   346k|    return ptr;
  106|   346k|}
pj_pool_calloc:
  110|  49.1k|{
  111|  49.1k|    void *buf = pj_pool_alloc( pool, size*count);
  112|  49.1k|    if (buf)
  ------------------
  |  Branch (112:9): [True: 49.1k, False: 0]
  ------------------
  113|  49.1k|        pj_bzero(buf, size * count);
  114|  49.1k|    return buf;
  115|  49.1k|}
pj_pool_create:
  127|  8.04k|{
  128|  8.04k|    return pj_pool_aligned_create(f, name, initial_size, increment_size, 0, callback);
  129|  8.04k|}
pj_pool_aligned_create:
  137|  8.04k|{
  138|  8.04k|    return (*f->create_pool)(f, name, initial_size, increment_size, alignment, callback);
  139|  8.04k|}
pj_pool_release:
  142|  8.03k|{
  143|       |#if PJ_POOL_RELEASE_WIPE_DATA
  144|       |    pj_pool_block *b;
  145|       |
  146|       |    b = pool->block_list.next;
  147|       |    while (b != &pool->block_list) {
  148|       |        volatile unsigned char *p = b->buf;
  149|       |        while (p < b->end) *p++ = 0;
  150|       |        b = b->next;
  151|       |    }
  152|       |#endif
  153|       |
  154|  8.03k|    if (pool->factory->release_pool)
  ------------------
  |  Branch (154:9): [True: 8.03k, False: 0]
  ------------------
  155|  8.03k|        (*pool->factory->release_pool)(pool->factory, pool);
  156|  8.03k|}

fuzz-sip.c:pj_bzero:
  820|  7.22k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  7.22k|    memset(dst, 0, size);
  825|  7.22k|#endif
  826|  7.22k|}
fuzz-sip.c:pj_memcpy:
  853|  5.97k|{
  854|  5.97k|    return memcpy(dst, src, size);
  855|  5.97k|}
sip_multipart.c:pj_memcpy:
  853|    636|{
  854|    636|    return memcpy(dst, src, size);
  855|    636|}
sip_multipart.c:pj_strset:
  117|    613|{
  118|    613|    str->ptr = ptr;
  119|    613|    str->slen = (pj_ssize_t)length;
  120|    613|    return str;
  121|    613|}
sip_msg.c:pj_memcmp:
  881|  13.9k|{
  882|  13.9k|    return memcmp(buf1, buf2, size);
  883|  13.9k|}
sip_msg.c:pj_memcpy:
  853|    605|{
  854|    605|    return memcpy(dst, src, size);
  855|    605|}
sip_msg.c:pj_bzero:
  820|  30.4k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  30.4k|    memset(dst, 0, size);
  825|  30.4k|#endif
  826|  30.4k|}
sip_parser.c:pj_memcpy:
  853|  6.44k|{
  854|  6.44k|    return memcpy(dst, src, size);
  855|  6.44k|}
sip_parser.c:pj_memchr:
  896|  3.14k|{
  897|  3.14k|    return (void*)memchr((void*)buf, c, size);
  898|  3.14k|}
sip_parser.c:pj_bzero:
  820|  3.38k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  3.38k|    memset(dst, 0, size);
  825|  3.38k|#endif
  826|  3.38k|}
sip_parser.c:pj_memcmp:
  881|  35.5k|{
  882|  35.5k|    return memcmp(buf1, buf2, size);
  883|  35.5k|}
sip_parser.c:pj_memmove:
  867|     51|{
  868|     51|    return memmove(dst, src, size);
  869|     51|}
sip_uri.c:pj_memcpy:
  853|  2.35k|{
  854|  2.35k|    return memcpy(dst, src, size);
  855|  2.35k|}
sip_uri.c:pj_memchr:
  896|  1.17k|{
  897|  1.17k|    return (void*)memchr((void*)buf, c, size);
  898|  1.17k|}
sip_uri.c:pj_bzero:
  820|  15.6k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  15.6k|    memset(dst, 0, size);
  825|  15.6k|#endif
  826|  15.6k|}
sip_endpoint.c:pj_cstr:
  101|      1|{
  102|      1|    str->ptr = (char*)s;
  103|      1|    str->slen = s ? (pj_ssize_t)strlen(s) : 0;
  ------------------
  |  Branch (103:17): [True: 1, False: 0]
  ------------------
  104|      1|    return str;
  105|      1|}
sip_util.c:pj_memcpy:
  853|    605|{
  854|    605|    return memcpy(dst, src, size);
  855|    605|}
sip_transport.c:pj_memcpy:
  853|  3.59k|{
  854|  3.59k|    return memcpy(dst, src, size);
  855|  3.59k|}
sip_transport.c:pj_bzero:
  820|  5.97k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  5.97k|    memset(dst, 0, size);
  825|  5.97k|#endif
  826|  5.97k|}
sip_auth_client.c:pj_bzero:
  820|  1.23k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  1.23k|    memset(dst, 0, size);
  825|  1.23k|#endif
  826|  1.23k|}
sip_auth_client.c:pj_strchr:
  481|    272|{
  482|    272|    if (str->slen == 0)
  ------------------
  |  Branch (482:9): [True: 0, False: 272]
  ------------------
  483|      0|        return NULL;
  484|    272|    return (char*) memchr((char*)str->ptr, chr, str->slen);
  485|    272|}
sip_auth_client.c:pj_strlen:
  282|    115|{
  283|    115|    return str->slen;
  284|    115|}
sip_dialog.c:pj_bzero:
  820|     87|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|     87|    memset(dst, 0, size);
  825|     87|#endif
  826|     87|}
md5.c:pj_memcpy:
  853|  13.7k|{
  854|  13.7k|    return memcpy(dst, src, size);
  855|  13.7k|}
md5.c:pj_bzero:
  820|  3.08k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  3.08k|    memset(dst, 0, size);
  825|  3.08k|#endif
  826|  3.08k|}
scanner.c:pj_bzero:
  820|      2|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|      2|    memset(dst, 0, size);
  825|      2|#endif
  826|      2|}
scanner.c:pj_memchr:
  896|  21.7k|{
  897|  21.7k|    return (void*)memchr((void*)buf, c, size);
  898|  21.7k|}
scanner.c:pj_strset3:
  149|   263k|{
  150|   263k|    str->ptr = begin;
  151|   263k|    str->slen = (pj_ssize_t)(end-begin);
  152|   263k|    return str;
  153|   263k|}
scanner.c:pj_strset:
  117|  8.22k|{
  118|  8.22k|    str->ptr = ptr;
  119|  8.22k|    str->slen = (pj_ssize_t)length;
  120|  8.22k|    return str;
  121|  8.22k|}
string.c:pj_strchr:
  481|  16.5k|{
  482|  16.5k|    if (str->slen == 0)
  ------------------
  |  Branch (482:9): [True: 0, False: 16.5k]
  ------------------
  483|      0|        return NULL;
  484|  16.5k|    return (char*) memchr((char*)str->ptr, chr, str->slen);
  485|  16.5k|}
string.c:pj_memcpy:
  853|   100k|{
  854|   100k|    return memcpy(dst, src, size);
  855|   100k|}
string.c:pj_memcmp:
  881|  15.3k|{
  882|  15.3k|    return memcmp(buf1, buf2, size);
  883|  15.3k|}
os_core_unix.c:pj_bzero:
  820|      1|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|      1|    memset(dst, 0, size);
  825|      1|#endif
  826|      1|}
os_core_unix.c:pj_strlen:
  282|      1|{
  283|      1|    return str->slen;
  284|      1|}
ioqueue_select.c:pj_bzero:
  820|    606|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|    606|    memset(dst, 0, size);
  825|    606|#endif
  826|    606|}
lock.c:pj_memcpy:
  853|    157|{
  854|    157|    return memcpy(dst, src, size);
  855|    157|}
pool.c:pj_bzero:
  820|  49.2k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  49.2k|    memset(dst, 0, size);
  825|  49.2k|#endif
  826|  49.2k|}
pool_caching.c:pj_bzero:
  820|      1|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|      1|    memset(dst, 0, size);
  825|      1|#endif
  826|      1|}
pool_caching.c:pj_memcpy:
  853|      1|{
  854|      1|    return memcpy(dst, src, size);
  855|      1|}

pj_str:
   24|  90.2k|{
   25|  90.2k|    pj_str_t dst;
   26|  90.2k|    dst.ptr = str;
   27|  90.2k|    dst.slen = str ? pj_ansi_strlen(str) : 0;
  ------------------
  |  |   69|  90.2k|#define pj_ansi_strlen          strlen
  ------------------
  |  Branch (27:16): [True: 90.2k, False: 0]
  ------------------
   28|  90.2k|    return dst;
   29|  90.2k|}
pj_strdup:
   34|   145k|{
   35|   145k|    pj_assert(src->slen >= 0);
  ------------------
  |  |   65|   145k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (35:5): [True: 0, False: 145k]
  |  Branch (35:5): [True: 145k, False: 0]
  ------------------
   36|       |
   37|       |    /* Without this, destination will be corrupted */
   38|   145k|    if (dst == src)
  ------------------
  |  Branch (38:9): [True: 0, False: 145k]
  ------------------
   39|      0|        return dst;
   40|       |
   41|   145k|    if (src->slen > 0) {
  ------------------
  |  Branch (41:9): [True: 95.1k, False: 50.1k]
  ------------------
   42|  95.1k|        dst->ptr = (char*)pj_pool_alloc(pool, src->slen);
   43|  95.1k|        pj_memcpy(dst->ptr, src->ptr, src->slen);
   44|  95.1k|    }
   45|   145k|    dst->slen = (src->slen < 0)? 0: src->slen;
  ------------------
  |  Branch (45:17): [True: 0, False: 145k]
  ------------------
   46|   145k|    return dst;
   47|   145k|}
pj_strdup_with_null:
   52|  3.56k|{
   53|  3.56k|    pj_ssize_t src_slen = src->slen;
   54|       |
   55|  3.56k|    pj_assert(src->slen >= 0);
  ------------------
  |  |   65|  3.56k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (55:5): [True: 0, False: 3.56k]
  |  Branch (55:5): [True: 3.56k, False: 0]
  ------------------
   56|       |
   57|       |    /* Check if the source's length is invalid */
   58|  3.56k|    if (src_slen < 0)
  ------------------
  |  Branch (58:9): [True: 0, False: 3.56k]
  ------------------
   59|      0|        src_slen = 0;
   60|       |
   61|  3.56k|    dst->ptr = (char*)pj_pool_alloc(pool, src_slen+1);
   62|  3.56k|    if (src_slen) {
  ------------------
  |  Branch (62:9): [True: 3.56k, False: 0]
  ------------------
   63|  3.56k|        pj_memcpy(dst->ptr, src->ptr, src_slen);
   64|  3.56k|    }
   65|  3.56k|    dst->slen = src_slen;
   66|  3.56k|    dst->ptr[dst->slen] = '\0';
   67|  3.56k|    return dst;
   68|  3.56k|}
pj_strassign:
  105|    104|{
  106|    104|    dst->ptr = src->ptr;
  107|    104|    dst->slen = src->slen;
  108|    104|    return dst;
  109|    104|}
pj_strcpy:
  112|    415|{
  113|    415|    pj_assert(src->slen >= 0);
  ------------------
  |  |   65|    415|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (113:5): [True: 0, False: 415]
  |  Branch (113:5): [True: 415, False: 0]
  ------------------
  114|       |
  115|    415|    dst->slen = (src->slen < 0)? 0: src->slen;
  ------------------
  |  Branch (115:17): [True: 0, False: 415]
  ------------------
  116|    415|    if (src->slen > 0)
  ------------------
  |  Branch (116:9): [True: 415, False: 0]
  ------------------
  117|    415|        pj_memcpy(dst->ptr, src->ptr, src->slen);
  118|    415|    return dst;
  119|    415|}
pj_strcmp:
  162|  3.02k|{
  163|  3.02k|    pj_assert(str1->slen >= 0);
  ------------------
  |  |   65|  3.02k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (163:5): [True: 0, False: 3.02k]
  |  Branch (163:5): [True: 3.02k, False: 0]
  ------------------
  164|  3.02k|    pj_assert(str2->slen >= 0);
  ------------------
  |  |   65|  3.02k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (164:5): [True: 0, False: 3.02k]
  |  Branch (164:5): [True: 3.02k, False: 0]
  ------------------
  165|       |
  166|  3.02k|    if (str1->slen <= 0) {
  ------------------
  |  Branch (166:9): [True: 1.67k, False: 1.34k]
  ------------------
  167|  1.67k|        return str2->slen<=0 ? 0 : -1;
  ------------------
  |  Branch (167:16): [True: 1.45k, False: 223]
  ------------------
  168|  1.67k|    } else if (str2->slen <= 0) {
  ------------------
  |  Branch (168:16): [True: 234, False: 1.11k]
  ------------------
  169|    234|        return 1;
  170|  1.11k|    } else {
  171|  1.11k|        pj_size_t min = (str1->slen < str2->slen)? str1->slen : str2->slen;
  ------------------
  |  Branch (171:25): [True: 209, False: 903]
  ------------------
  172|  1.11k|        int res = pj_memcmp(str1->ptr, str2->ptr, min);
  173|  1.11k|        if (res == 0) {
  ------------------
  |  Branch (173:13): [True: 373, False: 739]
  ------------------
  174|    373|            return (str1->slen < str2->slen) ? -1 :
  ------------------
  |  Branch (174:20): [True: 66, False: 307]
  ------------------
  175|    373|                    (str1->slen == str2->slen ? 0 : 1);
  ------------------
  |  Branch (175:22): [True: 266, False: 41]
  ------------------
  176|    739|        } else {
  177|    739|            return res;
  178|    739|        }
  179|  1.11k|    }
  180|  3.02k|}
pj_stricmp:
  236|  10.0M|{
  237|  10.0M|    pj_assert(str1->slen >= 0);
  ------------------
  |  |   65|  10.0M|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (237:5): [True: 0, False: 10.0M]
  |  Branch (237:5): [True: 10.0M, False: 0]
  ------------------
  238|  10.0M|    pj_assert(str2->slen >= 0);
  ------------------
  |  |   65|  10.0M|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (238:5): [True: 0, False: 10.0M]
  |  Branch (238:5): [True: 10.0M, False: 0]
  ------------------
  239|       |
  240|  10.0M|    if (str1->slen <= 0) {
  ------------------
  |  Branch (240:9): [True: 5.29k, False: 9.99M]
  ------------------
  241|  5.29k|        return str2->slen<=0 ? 0 : -1;
  ------------------
  |  Branch (241:16): [True: 4.34k, False: 954]
  ------------------
  242|  9.99M|    } else if (str2->slen <= 0) {
  ------------------
  |  Branch (242:16): [True: 2.03k, False: 9.99M]
  ------------------
  243|  2.03k|        return 1;
  244|  9.99M|    } else {
  245|  9.99M|        pj_size_t min = (str1->slen < str2->slen)? str1->slen : str2->slen;
  ------------------
  |  Branch (245:25): [True: 5.06M, False: 4.92M]
  ------------------
  246|  9.99M|        int res = pj_ansi_strnicmp(str1->ptr, str2->ptr, min);
  ------------------
  |  |   96|  9.99M|#define pj_ansi_strnicmp        strncasecmp
  ------------------
  247|  9.99M|        if (res == 0) {
  ------------------
  |  Branch (247:13): [True: 101k, False: 9.89M]
  ------------------
  248|   101k|            return (str1->slen < str2->slen) ? -1 :
  ------------------
  |  Branch (248:20): [True: 12.4k, False: 88.9k]
  ------------------
  249|   101k|                    (str1->slen == str2->slen ? 0 : 1);
  ------------------
  |  Branch (249:22): [True: 88.5k, False: 330]
  ------------------
  250|  9.89M|        } else {
  251|  9.89M|            return res;
  252|  9.89M|        }
  253|  9.99M|    }
  254|  10.0M|}
pj_stricmp2:
  328|  13.6k|{
  329|  13.6k|    pj_str_t copy2;
  330|       |
  331|  13.6k|    if (str2) {
  ------------------
  |  Branch (331:9): [True: 13.6k, False: 0]
  ------------------
  332|  13.6k|        copy2.ptr = (char*)str2;
  333|  13.6k|        copy2.slen = pj_ansi_strlen(str2);
  ------------------
  |  |   69|  13.6k|#define pj_ansi_strlen          strlen
  ------------------
  334|  13.6k|    } else {
  335|      0|        copy2.ptr = NULL;
  336|      0|        copy2.slen = 0;
  337|      0|    }
  338|       |
  339|  13.6k|    return pj_stricmp(str1, &copy2);
  340|  13.6k|}
pj_strcat:
  378|    415|{
  379|    415|    pj_assert(src->slen >= 0);
  ------------------
  |  |   65|    415|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (379:5): [True: 0, False: 415]
  |  Branch (379:5): [True: 415, False: 0]
  ------------------
  380|    415|    pj_assert(dst->slen >= 0);
  ------------------
  |  |   65|    415|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (380:5): [True: 0, False: 415]
  |  Branch (380:5): [True: 415, False: 0]
  ------------------
  381|       |
  382|    415|    if (src->slen > 0 && dst->slen >= 0) {
  ------------------
  |  Branch (382:9): [True: 415, False: 0]
  |  Branch (382:26): [True: 415, False: 0]
  ------------------
  383|    415|        pj_memcpy(dst->ptr + dst->slen, src->ptr, src->slen);
  384|    415|        dst->slen += src->slen;
  385|    415|    }
  386|    415|}
pj_strcat2:
  389|    415|{
  390|    415|    pj_size_t len = str? pj_ansi_strlen(str) : 0;
  ------------------
  |  |   69|    415|#define pj_ansi_strlen          strlen
  ------------------
  |  Branch (390:21): [True: 415, False: 0]
  ------------------
  391|       |
  392|    415|    pj_assert(dst->slen >= 0);
  ------------------
  |  |   65|    415|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (392:5): [True: 0, False: 415]
  |  Branch (392:5): [True: 415, False: 0]
  ------------------
  393|       |
  394|    415|    if (len && dst->slen >= 0) {
  ------------------
  |  Branch (394:9): [True: 415, False: 0]
  |  Branch (394:16): [True: 415, False: 0]
  ------------------
  395|    415|        pj_memcpy(dst->ptr + dst->slen, str, len);
  396|    415|        dst->slen += len;
  397|    415|    }
  398|    415|}
pj_strtrim:
  401|    892|{
  402|    892|    pj_strltrim(str);
  403|    892|    pj_strrtrim(str);
  404|    892|    return str;
  405|    892|}

pj_register_strerror:
  122|      2|{
  123|      2|    unsigned i;
  124|       |
  125|       |    /* Check arguments. */
  126|      2|    PJ_ASSERT_RETURN(start && space && f, PJ_EINVAL);
  ------------------
  |  |   97|      2|            do { \
  |  |   98|      8|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 2, False: 0]
  |  |  |  Branch (98:23): [True: 2, False: 0]
  |  |  |  Branch (98:23): [True: 2, False: 0]
  |  |  ------------------
  |  |   99|      2|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 2]
  |  |  ------------------
  ------------------
  |  Branch (126:5): [True: 0, False: 0]
  |  Branch (126:5): [True: 0, False: 0]
  |  Branch (126:5): [True: 0, False: 0]
  |  Branch (126:5): [True: 0, False: 0]
  |  Branch (126:5): [True: 0, False: 0]
  |  Branch (126:5): [True: 0, False: 0]
  ------------------
  127|       |
  128|       |    /* Check if there aren't too many handlers registered. */
  129|      2|    PJ_ASSERT_RETURN(err_msg_hnd_cnt < PJ_ARRAY_SIZE(err_msg_hnd),
  ------------------
  |  |   97|      2|            do { \
  |  |   98|      2|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 2]
  |  |  ------------------
  |  |   99|      2|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 2]
  |  |  ------------------
  ------------------
  |  Branch (129:5): [True: 0, False: 0]
  |  Branch (129:5): [True: 0, False: 0]
  ------------------
  130|      2|                     PJ_ETOOMANY);
  131|       |
  132|       |    /* Start error must be greater than PJ_ERRNO_START_USER */
  133|      2|    PJ_ASSERT_RETURN(start >= PJ_ERRNO_START_USER, PJ_EEXISTS);
  ------------------
  |  |   97|      2|            do { \
  |  |   98|      2|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 2]
  |  |  ------------------
  |  |   99|      2|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 2]
  |  |  ------------------
  ------------------
  |  Branch (133:5): [True: 0, False: 0]
  |  Branch (133:5): [True: 0, False: 0]
  ------------------
  134|       |
  135|       |    /* Check that no existing handler has covered the specified range. */
  136|      3|    for (i=0; i<err_msg_hnd_cnt; ++i) {
  ------------------
  |  Branch (136:15): [True: 1, False: 2]
  ------------------
  137|      1|        if (IN_RANGE(start, err_msg_hnd[i].begin, err_msg_hnd[i].end) ||
  ------------------
  |  |  116|      2|#define IN_RANGE(val,start,end)     ((val)>=(start) && (val)<(end))
  |  |  ------------------
  |  |  |  Branch (116:38): [True: 0, False: 1]
  |  |  |  Branch (116:56): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  138|      1|            IN_RANGE(start+space-1, err_msg_hnd[i].begin, err_msg_hnd[i].end))
  ------------------
  |  |  116|      1|#define IN_RANGE(val,start,end)     ((val)>=(start) && (val)<(end))
  |  |  ------------------
  |  |  |  Branch (116:38): [True: 0, False: 1]
  |  |  |  Branch (116:56): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  139|      0|        {
  140|      0|            if (err_msg_hnd[i].begin == start && 
  ------------------
  |  Branch (140:17): [True: 0, False: 0]
  ------------------
  141|      0|                err_msg_hnd[i].end == (start+space) &&
  ------------------
  |  Branch (141:17): [True: 0, False: 0]
  ------------------
  142|      0|                err_msg_hnd[i].strerror == f)
  ------------------
  |  Branch (142:17): [True: 0, False: 0]
  ------------------
  143|      0|            {
  144|       |                /* The same range and handler has already been registered */
  145|      0|                return PJ_SUCCESS;
  146|      0|            }
  147|       |
  148|      0|            return PJ_EEXISTS;
  ------------------
  |  |  448|      0|#define PJ_EEXISTS          (PJ_ERRNO_START_STATUS + 15)/* 70015 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  149|      0|        }
  150|      1|    }
  151|       |
  152|       |    /* Register the handler. */
  153|      2|    err_msg_hnd[err_msg_hnd_cnt].begin = start;
  154|      2|    err_msg_hnd[err_msg_hnd_cnt].end = start + space;
  155|      2|    err_msg_hnd[err_msg_hnd_cnt].strerror = f;
  156|       |
  157|      2|    ++err_msg_hnd_cnt;
  158|       |
  159|      2|    return PJ_SUCCESS;
  160|      2|}

pj_throw_exception_:
   41|  29.1k|{
   42|  29.1k|    struct pj_exception_state_t *handler;
   43|       |
   44|  29.1k|    handler = (struct pj_exception_state_t*) 
   45|  29.1k|              pj_thread_local_get(thread_local_id);
   46|  29.1k|    if (handler == NULL) {
  ------------------
  |  Branch (46:9): [True: 0, False: 29.1k]
  ------------------
   47|      0|        PJ_LOG(1,("except.c", "!!!FATAL: unhandled exception %s!\n", 
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  432|      0|    #define pj_log_wrapper_1(arg)       pj_log_1 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
   48|      0|                   pj_exception_id_name(exception_id)));
   49|      0|        pj_assert(handler != NULL);
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (49:9): [True: 0, False: 0]
  |  Branch (49:9): [True: 0, False: 0]
  ------------------
   50|       |        /* This will crash the system! */
   51|      0|    }
   52|  29.1k|    pj_pop_exception_handler_(handler);
   53|  29.1k|    pj_longjmp(handler->state, exception_id);
  ------------------
  |  |   34|  29.1k|#    define pj_longjmp(buf,d)   longjmp(buf,d)
  ------------------
   54|  29.1k|}
pj_push_exception_handler_:
   75|  38.1k|{
   76|  38.1k|    struct pj_exception_state_t *parent_handler = NULL;
   77|       |
   78|  38.1k|    if (thread_local_id == -1) {
  ------------------
  |  Branch (78:9): [True: 1, False: 38.1k]
  ------------------
   79|      1|        pj_thread_local_alloc(&thread_local_id);
   80|      1|        pj_assert(thread_local_id != -1);
  ------------------
  |  |   65|      1|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (80:9): [True: 0, False: 1]
  |  Branch (80:9): [True: 1, False: 0]
  ------------------
   81|      1|        pj_atexit(&exception_cleanup);
   82|      1|    }
   83|  38.1k|    parent_handler = (struct pj_exception_state_t *)
   84|  38.1k|                      pj_thread_local_get(thread_local_id);
   85|  38.1k|    rec->prev = parent_handler;
   86|  38.1k|    pj_thread_local_set(thread_local_id, rec);
   87|  38.1k|}
pj_pop_exception_handler_:
   90|  47.7k|{
   91|  47.7k|    struct pj_exception_state_t *handler;
   92|       |
   93|  47.7k|    handler = (struct pj_exception_state_t *)
   94|  47.7k|              pj_thread_local_get(thread_local_id);
   95|  47.7k|    if (handler && handler==rec) {
  ------------------
  |  Branch (95:9): [True: 47.7k, False: 17]
  |  Branch (95:20): [True: 41.2k, False: 6.48k]
  ------------------
   96|  41.2k|        pj_thread_local_set(thread_local_id, handler->prev);
   97|  41.2k|    }
   98|  47.7k|}
pj_exception_id_alloc:
  104|      3|{
  105|      3|    unsigned i;
  106|       |
  107|      3|    pj_enter_critical_section();
  108|       |
  109|       |    /*
  110|       |     * Start from 1 (not 0)!!!
  111|       |     * Exception 0 is reserved for normal path of setjmp()!!!
  112|       |     */
  113|      6|    for (i=1; i<PJ_MAX_EXCEPTION_ID; ++i) {
  ------------------
  |  |  947|      6|#   define PJ_MAX_EXCEPTION_ID      16
  ------------------
  |  Branch (113:15): [True: 6, False: 0]
  ------------------
  114|      6|        if (exception_id_names[i] == NULL) {
  ------------------
  |  Branch (114:13): [True: 3, False: 3]
  ------------------
  115|      3|            exception_id_names[i] = name;
  116|      3|            *id = i;
  117|      3|            pj_leave_critical_section();
  118|      3|            return PJ_SUCCESS;
  119|      3|        }
  120|      6|    }
  121|       |
  122|      0|    pj_leave_critical_section();
  123|      0|    return PJ_ETOOMANY;
  ------------------
  |  |  423|      0|#define PJ_ETOOMANY         (PJ_ERRNO_START_STATUS + 10)/* 70010 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  124|      3|}

pj_create_unique_string:
   35|  1.65k|{
   36|  1.65k|    str->ptr = (char*)pj_pool_alloc(pool, PJ_GUID_STRING_LENGTH);
   37|  1.65k|    pj_generate_unique_string(str);
   38|  1.65k|}

pj_generate_unique_string:
   52|  1.65k|{
   53|  1.65k|    char *p, *end;
   54|       |
   55|  1.65k|    PJ_CHECK_STACK();
   56|       |
   57|  1.65k|    if (guid_chars[0] == '\0') {
  ------------------
  |  Branch (57:9): [True: 1, False: 1.65k]
  ------------------
   58|      1|        pj_enter_critical_section();
   59|      1|        if (guid_chars[0] == '\0') {
  ------------------
  |  Branch (59:13): [True: 1, False: 0]
  ------------------
   60|      1|            init_guid_chars();
   61|      1|        }
   62|      1|        pj_leave_critical_section();
   63|      1|    }
   64|       |
   65|       |    /* This would only work if PJ_GUID_STRING_LENGTH is multiple of 2 bytes */
   66|  1.65k|    pj_assert(PJ_GUID_STRING_LENGTH % 2 == 0);
  ------------------
  |  |   65|  1.65k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (66:5): [True: 0, Folded]
  |  Branch (66:5): [True: 1.65k, Folded]
  ------------------
   67|       |
   68|  14.9k|    for (p=str->ptr, end=p+PJ_GUID_STRING_LENGTH; p<end; ) {
  ------------------
  |  Branch (68:51): [True: 13.2k, False: 1.65k]
  ------------------
   69|  13.2k|        pj_uint32_t rand_val = pj_rand();
   70|  13.2k|        pj_uint32_t rand_idx = RAND_MAX;
   71|       |
   72|  66.2k|        for ( ; rand_idx>0 && p<end; rand_idx>>=8, rand_val>>=8, p++) {
  ------------------
  |  Branch (72:17): [True: 52.9k, False: 13.2k]
  |  Branch (72:31): [True: 52.9k, False: 0]
  ------------------
   73|  52.9k|            *p = guid_chars[(rand_val & 0xFF) & 63];
   74|  52.9k|        }
   75|  13.2k|    }
   76|       |
   77|  1.65k|    str->slen = PJ_GUID_STRING_LENGTH;
   78|  1.65k|    return str;
   79|  1.65k|}
guid_simple.c:init_guid_chars:
   35|      1|{
   36|      1|    char *p = guid_chars;
   37|      1|    unsigned i;
   38|       |
   39|     11|    for (i=0; i<10; ++i)
  ------------------
  |  Branch (39:15): [True: 10, False: 1]
  ------------------
   40|     10|        *p++ = '0'+i;
   41|       |
   42|     27|    for (i=0; i<26; ++i) {
  ------------------
  |  Branch (42:15): [True: 26, False: 1]
  ------------------
   43|     26|        *p++ = 'a'+i;
   44|     26|        *p++ = 'A'+i;
   45|     26|    }
   46|       |
   47|      1|    *p++ = '-';
   48|      1|    *p++ = '.';
   49|      1|}

pj_hash_calc:
   54|  39.5k|{
   55|  39.5k|    PJ_CHECK_STACK();
   56|       |
   57|  39.5k|    if (keylen==PJ_HASH_KEY_STRING) {
  ------------------
  |  |   45|  39.5k|#define PJ_HASH_KEY_STRING      ((unsigned)-1)
  ------------------
  |  Branch (57:9): [True: 0, False: 39.5k]
  ------------------
   58|      0|        const pj_uint8_t *p = (const pj_uint8_t*)key;
   59|      0|        for ( ; *p; ++p ) {
  ------------------
  |  Branch (59:17): [True: 0, False: 0]
  ------------------
   60|      0|            hash = (hash * PJ_HASH_MULTIPLIER) + *p;
  ------------------
  |  |   30|      0|#define PJ_HASH_MULTIPLIER      33
  ------------------
   61|      0|        }
   62|  39.5k|    } else {
   63|  39.5k|        const pj_uint8_t *p = (const pj_uint8_t*)key,
   64|  39.5k|                              *end = p + keylen;
   65|   227k|        for ( ; p!=end; ++p) {
  ------------------
  |  Branch (65:17): [True: 187k, False: 39.5k]
  ------------------
   66|   187k|            hash = (hash * PJ_HASH_MULTIPLIER) + *p;
  ------------------
  |  |   30|   187k|#define PJ_HASH_MULTIPLIER      33
  ------------------
   67|   187k|        }
   68|  39.5k|    }
   69|  39.5k|    return hash;
   70|  39.5k|}
pj_hash_calc_tolower:
   75|  18.8k|{
   76|  18.8k|    long i;
   77|       |
   78|  69.1k|    for (i=0; i<key->slen; ++i) {
  ------------------
  |  Branch (78:15): [True: 50.2k, False: 18.8k]
  ------------------
   79|  50.2k|        int lower = pj_tolower(key->ptr[i]);
   80|  50.2k|        if (result)
  ------------------
  |  Branch (80:13): [True: 47.4k, False: 2.78k]
  ------------------
   81|  47.4k|            result[i] = (char)lower;
   82|       |
   83|  50.2k|        hval = hval * PJ_HASH_MULTIPLIER + lower;
  ------------------
  |  |   30|  50.2k|#define PJ_HASH_MULTIPLIER      33
  ------------------
   84|  50.2k|    }
   85|       |
   86|  18.8k|    return hval;
   87|  18.8k|}
pj_hash_create:
   91|      4|{
   92|      4|    pj_hash_table_t *h;
   93|      4|    unsigned table_size;
   94|       |    
   95|       |    /* Check that PJ_HASH_ENTRY_BUF_SIZE is correct. */
   96|      4|    PJ_ASSERT_RETURN(sizeof(pj_hash_entry)<=PJ_HASH_ENTRY_BUF_SIZE, NULL);
  ------------------
  |  |   97|      4|            do { \
  |  |   98|      4|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [Folded, False: 4]
  |  |  ------------------
  |  |   99|      4|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 4]
  |  |  ------------------
  ------------------
  |  Branch (96:5): [True: 0, Folded]
  |  Branch (96:5): [True: 0, Folded]
  ------------------
   97|       |
   98|      4|    h = PJ_POOL_ALLOC_T(pool, pj_hash_table_t);
  ------------------
  |  |  569|      4|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
   99|      4|    h->count = 0;
  100|       |
  101|      4|    PJ_LOG( 6, ("hashtbl", "hash table %p created from pool %s", h, pj_pool_getobjname(pool)));
  ------------------
  |  |  106|      4|#define PJ_LOG(level,arg)       do { \
  |  |  107|      4|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      8|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 4]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      4|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 4]
  |  |  ------------------
  ------------------
  102|       |
  103|       |    /* size must be 2^n - 1.
  104|       |       round-up the size to this rule, except when size is 2^n, then size
  105|       |       will be round-down to 2^n-1.
  106|       |     */
  107|      4|    table_size = 8;
  108|     22|    do {
  109|     22|        table_size <<= 1;    
  110|     22|    } while (table_size < size);
  ------------------
  |  Branch (110:14): [True: 18, False: 4]
  ------------------
  111|      4|    table_size -= 1;
  112|       |    
  113|      4|    h->rows = table_size;
  114|      4|    h->table = (pj_hash_entry**)
  115|      4|               pj_pool_calloc(pool, table_size+1, sizeof(pj_hash_entry*));
  116|      4|    return h;
  117|      4|}
pj_hash_get:
  214|  5.97k|{
  215|  5.97k|    pj_hash_entry *entry;
  216|  5.97k|    entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL, PJ_FALSE);
  217|  5.97k|    return entry ? entry->value : NULL;
  ------------------
  |  Branch (217:12): [True: 0, False: 5.97k]
  ------------------
  218|  5.97k|}
pj_hash_get_lower:
  223|    174|{
  224|    174|    pj_hash_entry *entry;
  225|    174|    entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL, PJ_TRUE);
  226|    174|    return entry ? entry->value : NULL;
  ------------------
  |  Branch (226:12): [True: 87, False: 87]
  ------------------
  227|    174|}
pj_hash_set_lower:
  263|     87|{
  264|       |    hash_set(pool, ht, key, keylen, hval, value, NULL, PJ_TRUE);
  265|     87|}
pj_hash_set_np:
  271|      1|{
  272|       |    hash_set(NULL, ht, key, keylen, hval, value, (void *)entry_buf, PJ_FALSE);
  273|      1|}
pj_hash_set_np_lower:
  280|     87|{
  281|       |    hash_set(NULL, ht, key, keylen, hval, value, (void *)entry_buf, PJ_TRUE);
  282|     87|}
hash.c:find_entry:
  123|  6.32k|{
  124|  6.32k|    pj_uint32_t hash;
  125|  6.32k|    pj_hash_entry **p_entry, *entry;
  126|       |
  127|  6.32k|    if (hval && *hval != 0) {
  ------------------
  |  Branch (127:9): [True: 350, False: 5.97k]
  |  Branch (127:17): [True: 349, False: 1]
  ------------------
  128|    349|        hash = *hval;
  129|    349|        if (keylen==PJ_HASH_KEY_STRING) {
  ------------------
  |  |   45|    349|#define PJ_HASH_KEY_STRING      ((unsigned)-1)
  ------------------
  |  Branch (129:13): [True: 0, False: 349]
  ------------------
  130|      0|            keylen = (unsigned)pj_ansi_strlen((const char*)key);
  ------------------
  |  |   69|      0|#define pj_ansi_strlen          strlen
  ------------------
  131|      0|        }
  132|  5.97k|    } else {
  133|       |        /* This slightly differs with pj_hash_calc() because we need 
  134|       |         * to get the keylen when keylen is PJ_HASH_KEY_STRING.
  135|       |         */
  136|  5.97k|        hash=0;
  137|  5.97k|        if (keylen==PJ_HASH_KEY_STRING) {
  ------------------
  |  |   45|  5.97k|#define PJ_HASH_KEY_STRING      ((unsigned)-1)
  ------------------
  |  Branch (137:13): [True: 0, False: 5.97k]
  ------------------
  138|      0|            const pj_uint8_t *p = (const pj_uint8_t*)key;
  139|      0|            for ( ; *p; ++p ) {
  ------------------
  |  Branch (139:21): [True: 0, False: 0]
  ------------------
  140|      0|                if (lower)
  ------------------
  |  Branch (140:21): [True: 0, False: 0]
  ------------------
  141|      0|                    hash = hash * PJ_HASH_MULTIPLIER + pj_tolower(*p);
  ------------------
  |  |   30|      0|#define PJ_HASH_MULTIPLIER      33
  ------------------
  142|      0|                else 
  143|      0|                    hash = hash * PJ_HASH_MULTIPLIER + *p;
  ------------------
  |  |   30|      0|#define PJ_HASH_MULTIPLIER      33
  ------------------
  144|      0|            }
  145|      0|            keylen = (unsigned)(p - (const unsigned char*)key);
  146|  5.97k|        } else {
  147|  5.97k|            const pj_uint8_t *p = (const pj_uint8_t*)key,
  148|  5.97k|                                  *end = p + keylen;
  149|   149k|            for ( ; p!=end; ++p) {
  ------------------
  |  Branch (149:21): [True: 143k, False: 5.97k]
  ------------------
  150|   143k|                if (lower)
  ------------------
  |  Branch (150:21): [True: 0, False: 143k]
  ------------------
  151|      0|                    hash = hash * PJ_HASH_MULTIPLIER + pj_tolower(*p);
  ------------------
  |  |   30|      0|#define PJ_HASH_MULTIPLIER      33
  ------------------
  152|   143k|                else
  153|   143k|                    hash = hash * PJ_HASH_MULTIPLIER + *p;
  ------------------
  |  |   30|   143k|#define PJ_HASH_MULTIPLIER      33
  ------------------
  154|   143k|            }
  155|  5.97k|        }
  156|       |
  157|       |        /* Report back the computed hash. */
  158|  5.97k|        if (hval)
  ------------------
  |  Branch (158:13): [True: 1, False: 5.97k]
  ------------------
  159|      1|            *hval = hash;
  160|  5.97k|    }
  161|       |
  162|       |    /* scan the linked list */
  163|  6.32k|    for (p_entry = &ht->table[hash & ht->rows], entry=*p_entry; 
  164|  6.32k|         entry; 
  ------------------
  |  Branch (164:10): [True: 174, False: 6.15k]
  ------------------
  165|  6.32k|         p_entry = &entry->next, entry = *p_entry)
  166|    174|    {
  167|    174|        if (entry->hash==hash && entry->keylen==keylen &&
  ------------------
  |  Branch (167:13): [True: 174, False: 0]
  |  Branch (167:34): [True: 174, False: 0]
  ------------------
  168|    174|            ((lower && pj_ansi_strnicmp((const char*)entry->key,
  ------------------
  |  |   96|    174|#define pj_ansi_strnicmp        strncasecmp
  ------------------
  |  Branch (168:15): [True: 174, False: 0]
  |  Branch (168:24): [True: 174, False: 0]
  ------------------
  169|    174|                                        (const char*)key, keylen)==0) ||
  170|      0|             (!lower && pj_memcmp(entry->key, key, keylen)==0)))
  ------------------
  |  Branch (170:15): [True: 0, False: 0]
  |  Branch (170:25): [True: 0, False: 0]
  ------------------
  171|    174|        {
  172|    174|            break;
  173|    174|        }
  174|    174|    }
  175|       |
  176|  6.32k|    if (entry || val==NULL)
  ------------------
  |  Branch (176:9): [True: 174, False: 6.15k]
  |  Branch (176:18): [True: 6.06k, False: 88]
  ------------------
  177|  6.24k|        return p_entry;
  178|       |
  179|       |    /* Entry not found, create a new one. 
  180|       |     * If entry_buf is specified, use it. Otherwise allocate from pool.
  181|       |     */
  182|     88|    if (entry_buf) {
  ------------------
  |  Branch (182:9): [True: 88, False: 0]
  ------------------
  183|     88|        entry = (pj_hash_entry*)entry_buf;
  184|     88|    } else {
  185|       |        /* Pool must be specified! */
  186|      0|        PJ_ASSERT_RETURN(pool != NULL, NULL);
  ------------------
  |  |   97|      0|            do { \
  |  |   98|      0|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 0]
  |  |  ------------------
  |  |   99|      0|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (186:9): [True: 0, False: 0]
  |  Branch (186:9): [True: 0, False: 0]
  ------------------
  187|       |
  188|      0|        entry = PJ_POOL_ALLOC_T(pool, pj_hash_entry);
  ------------------
  |  |  569|      0|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  189|      0|        PJ_LOG(6, ("hashtbl", 
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 0]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  190|      0|                   "%p: New p_entry %p created, pool used=%lu, cap=%lu", 
  191|      0|                   ht, entry,  (unsigned long)pj_pool_get_used_size(pool),
  192|      0|                   (unsigned long)pj_pool_get_capacity(pool)));
  193|      0|    }
  194|     88|    entry->next = NULL;
  195|     88|    entry->hash = hash;
  196|     88|    if (pool) {
  ------------------
  |  Branch (196:9): [True: 0, False: 88]
  ------------------
  197|      0|        entry->key = pj_pool_alloc(pool, keylen);
  198|      0|        pj_memcpy(entry->key, key, keylen);
  199|     88|    } else {
  200|     88|        entry->key = (void*)key;
  201|     88|    }
  202|     88|    entry->keylen = keylen;
  203|     88|    entry->value = val;
  204|     88|    *p_entry = entry;
  205|       |    
  206|     88|    ++ht->count;
  207|       |    
  208|     88|    return p_entry;
  209|     88|}
hash.c:hash_set:
  232|    175|{
  233|    175|    pj_hash_entry **p_entry;
  234|       |
  235|    175|    p_entry = find_entry( pool, ht, key, keylen, value, &hval, entry_buf,
  236|    175|                          lower);
  237|    175|    if (*p_entry) {
  ------------------
  |  Branch (237:9): [True: 175, False: 0]
  ------------------
  238|    175|        if (value == NULL) {
  ------------------
  |  Branch (238:13): [True: 87, False: 88]
  ------------------
  239|       |            /* delete entry */
  240|     87|            PJ_LOG(6, ("hashtbl", "%p: p_entry %p deleted", ht, *p_entry));
  ------------------
  |  |  106|     87|#define PJ_LOG(level,arg)       do { \
  |  |  107|     87|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    174|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 87]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|     87|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 87]
  |  |  ------------------
  ------------------
  241|     87|            *p_entry = (*p_entry)->next;
  242|     87|            --ht->count;
  243|       |            
  244|     88|        } else {
  245|       |            /* overwrite */
  246|     88|            (*p_entry)->value = value;
  247|     88|            PJ_LOG(6, ("hashtbl", "%p: p_entry %p value set to %p", ht, 
  ------------------
  |  |  106|     88|#define PJ_LOG(level,arg)       do { \
  |  |  107|     88|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    176|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 88]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|     88|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 88]
  |  |  ------------------
  ------------------
  248|     88|                       *p_entry, value));
  249|     88|        }
  250|    175|    }
  251|    175|}

pj_ioqueue_cfg_default:
   40|      1|{
   41|      1|    pj_bzero(cfg, sizeof(*cfg));
   42|      1|    cfg->epoll_flags = PJ_IOQUEUE_DEFAULT_EPOLL_FLAGS;
  ------------------
  |  |  810|      1|#   define PJ_IOQUEUE_DEFAULT_EPOLL_FLAGS PJ_IOQUEUE_EPOLL_AUTO
  ------------------
   43|      1|    cfg->default_concurrency = PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY;
  ------------------
  |  |  775|      1|#   define PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY   1
  ------------------
   44|      1|}
pj_ioqueue_set_lock:
   68|      1|{
   69|      1|    PJ_ASSERT_RETURN(ioqueue && lock, PJ_EINVAL);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      2|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (69:5): [True: 0, False: 0]
  |  Branch (69:5): [True: 0, False: 0]
  |  Branch (69:5): [True: 0, False: 0]
  |  Branch (69:5): [True: 0, False: 0]
  ------------------
   70|       |
   71|      1|    if (ioqueue->auto_delete_lock && ioqueue->lock) {
  ------------------
  |  Branch (71:9): [True: 0, False: 1]
  |  Branch (71:38): [True: 0, False: 0]
  ------------------
   72|      0|        pj_lock_destroy(ioqueue->lock);
   73|      0|    }
   74|       |
   75|      1|    ioqueue->lock = lock;
   76|      1|    ioqueue->auto_delete_lock = auto_delete;
   77|       |
   78|      1|    return PJ_SUCCESS;
   79|      1|}
pj_ioqueue_op_key_init:
 1444|    605|{
 1445|    605|    pj_bzero(op_key, size);
 1446|    605|}
ioqueue_select.c:ioqueue_init:
   47|      1|{
   48|       |    ioqueue->lock = NULL;
   49|      1|    ioqueue->auto_delete_lock = 0;
   50|      1|}

pj_ioqueue_create:
  196|      1|{
  197|       |    return pj_ioqueue_create2(pool, max_fd, NULL, p_ioqueue);
  198|      1|}
pj_ioqueue_create2:
  210|      1|{
  211|      1|    pj_ioqueue_t *ioqueue;
  212|      1|    pj_lock_t *lock;
  213|      1|    pj_size_t i;
  214|      1|    pj_status_t rc;
  215|       |
  216|       |    /* Check that arguments are valid. */
  217|      1|    PJ_ASSERT_RETURN(pool != NULL && p_ioqueue != NULL && 
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      6|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (217:5): [True: 0, False: 0]
  |  Branch (217:5): [True: 0, False: 0]
  |  Branch (217:5): [True: 0, False: 0]
  |  Branch (217:5): [True: 0, False: 0]
  |  Branch (217:5): [True: 0, False: 0]
  |  Branch (217:5): [True: 0, False: 0]
  |  Branch (217:5): [True: 0, False: 0]
  |  Branch (217:5): [True: 0, False: 0]
  ------------------
  218|      1|                     max_fd > 0 && max_fd <= PJ_IOQUEUE_MAX_HANDLES, 
  219|      1|                     PJ_EINVAL);
  220|       |
  221|       |    /* Check that size of pj_ioqueue_op_key_t is sufficient */
  222|      1|    PJ_ASSERT_RETURN(sizeof(pj_ioqueue_op_key_t)-sizeof(void*) >=
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [Folded, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (222:5): [True: 0, Folded]
  |  Branch (222:5): [True: 0, Folded]
  ------------------
  223|      1|                     sizeof(union operation_key), PJ_EBUG);
  224|       |
  225|       |    /* Create and init common ioqueue stuffs */
  226|      1|    ioqueue = PJ_POOL_ZALLOC_T(pool, pj_ioqueue_t);
  ------------------
  |  |  583|      1|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  227|      1|    ioqueue_init(ioqueue);
  228|       |
  229|      1|    if (cfg)
  ------------------
  |  Branch (229:9): [True: 0, False: 1]
  ------------------
  230|      0|        pj_memcpy(&ioqueue->cfg, cfg, sizeof(*cfg));
  231|      1|    else
  232|      1|        pj_ioqueue_cfg_default(&ioqueue->cfg);
  233|      1|    ioqueue->max = (unsigned)max_fd;
  234|      1|    ioqueue->count = 0;
  235|      1|    PJ_FD_ZERO(&ioqueue->rfdset);
  236|      1|    PJ_FD_ZERO(&ioqueue->wfdset);
  237|      1|#if PJ_HAS_TCP
  238|      1|    PJ_FD_ZERO(&ioqueue->xfdset);
  239|      1|#endif
  240|      1|    pj_list_init(&ioqueue->active_list);
  241|       |
  242|      1|    rescan_fdset(ioqueue);
  243|       |
  244|      1|#if PJ_IOQUEUE_HAS_SAFE_UNREG
  245|       |    /* When safe unregistration is used (the default), we pre-create
  246|       |     * all keys and put them in the free list.
  247|       |     */
  248|       |
  249|       |    /* Mutex to protect key's reference counter 
  250|       |     * We don't want to use key's mutex or ioqueue's mutex because
  251|       |     * that would create deadlock situation in some cases.
  252|       |     */
  253|      1|    rc = pj_mutex_create_simple(pool, NULL, &ioqueue->ref_cnt_mutex);
  254|      1|    if (rc != PJ_SUCCESS)
  ------------------
  |  Branch (254:9): [True: 0, False: 1]
  ------------------
  255|      0|        return rc;
  256|       |
  257|       |
  258|       |    /* Init key list */
  259|      1|    pj_list_init(&ioqueue->free_list);
  260|      1|    pj_list_init(&ioqueue->closing_list);
  261|       |
  262|       |
  263|       |    /* Pre-create all keys according to max_fd */
  264|     65|    for (i=0; i<max_fd; ++i) {
  ------------------
  |  Branch (264:15): [True: 64, False: 1]
  ------------------
  265|     64|        pj_ioqueue_key_t *key;
  266|       |
  267|     64|        key = PJ_POOL_ALLOC_T(pool, pj_ioqueue_key_t);
  ------------------
  |  |  569|     64|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  268|     64|        key->ref_count = 0;
  269|     64|        rc = pj_lock_create_recursive_mutex(pool, NULL, &key->lock);
  270|     64|        if (rc != PJ_SUCCESS) {
  ------------------
  |  Branch (270:13): [True: 0, False: 64]
  ------------------
  271|      0|            key = ioqueue->free_list.next;
  272|      0|            while (key != &ioqueue->free_list) {
  ------------------
  |  Branch (272:20): [True: 0, False: 0]
  ------------------
  273|      0|                pj_lock_destroy(key->lock);
  274|      0|                key = key->next;
  275|      0|            }
  276|      0|            pj_mutex_destroy(ioqueue->ref_cnt_mutex);
  277|      0|            return rc;
  278|      0|        }
  279|       |
  280|     64|        pj_list_push_back(&ioqueue->free_list, key);
  281|     64|    }
  282|      1|#endif
  283|       |
  284|       |    /* Create and init ioqueue mutex */
  285|      1|    rc = pj_lock_create_simple_mutex(pool, "ioq%p", &lock);
  286|      1|    if (rc != PJ_SUCCESS)
  ------------------
  |  Branch (286:9): [True: 0, False: 1]
  ------------------
  287|      0|        return rc;
  288|       |
  289|      1|    rc = pj_ioqueue_set_lock(ioqueue, lock, PJ_TRUE);
  290|      1|    if (rc != PJ_SUCCESS)
  ------------------
  |  Branch (290:9): [True: 0, False: 1]
  ------------------
  291|      0|        return rc;
  292|       |
  293|      1|    PJ_LOG(4, ("pjlib", "select() I/O Queue created (%p)", ioqueue));
  ------------------
  |  |  106|      1|#define PJ_LOG(level,arg)       do { \
  |  |  107|      1|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      2|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 1, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 1]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      1|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 1]
  |  |  ------------------
  ------------------
  294|       |
  295|      1|    *p_ioqueue = ioqueue;
  296|      1|    return PJ_SUCCESS;
  297|      1|}
ioqueue_select.c:rescan_fdset:
  182|      1|{
  183|       |    ioqueue->nfds = FD_SETSIZE-1;
  184|      1|}

pj_lock_create_simple_mutex:
   87|      2|{
   88|      2|    return create_mutex_lock(pool, name, PJ_MUTEX_SIMPLE, lock);
   89|      2|}
pj_lock_create_recursive_mutex:
   94|    155|{
   95|    155|    return create_mutex_lock(pool, name, PJ_MUTEX_RECURSE, lock);
   96|    155|}
pj_lock_create_null_mutex:
  120|    605|{
  121|    605|    PJ_UNUSED_ARG(name);
  ------------------
  |  | 1537|    605|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  122|    605|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|    605|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  123|       |
  124|    605|    PJ_ASSERT_RETURN(lock, PJ_EINVAL);
  ------------------
  |  |   97|    605|            do { \
  |  |   98|    605|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 605]
  |  |  ------------------
  |  |   99|    605|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 605]
  |  |  ------------------
  ------------------
  |  Branch (124:5): [True: 0, False: 0]
  |  Branch (124:5): [True: 0, False: 0]
  ------------------
  125|       |
  126|    605|    *lock = &null_lock_template;
  127|    605|    return PJ_SUCCESS;
  128|    605|}
pj_lock_acquire:
  177|  19.9k|{
  178|  19.9k|    PJ_ASSERT_RETURN(lock != NULL, PJ_EINVAL);
  ------------------
  |  |   97|  19.9k|            do { \
  |  |   98|  19.9k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 19.9k]
  |  |  ------------------
  |  |   99|  19.9k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 19.9k]
  |  |  ------------------
  ------------------
  |  Branch (178:5): [True: 0, False: 0]
  |  Branch (178:5): [True: 0, False: 0]
  ------------------
  179|  19.9k|    return (*lock->acquire)(lock->lock_object);
  180|  19.9k|}
pj_lock_release:
  189|  19.9k|{
  190|  19.9k|    PJ_ASSERT_RETURN(lock != NULL, PJ_EINVAL);
  ------------------
  |  |   97|  19.9k|            do { \
  |  |   98|  19.9k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 19.9k]
  |  |  ------------------
  |  |   99|  19.9k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 19.9k]
  |  |  ------------------
  ------------------
  |  Branch (190:5): [True: 0, False: 0]
  |  Branch (190:5): [True: 0, False: 0]
  ------------------
  191|  19.9k|    return (*lock->release)(lock->lock_object);
  192|  19.9k|}
pj_lock_destroy:
  195|    692|{
  196|    692|    PJ_ASSERT_RETURN(lock != NULL, PJ_EINVAL);
  ------------------
  |  |   97|    692|            do { \
  |  |   98|    692|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 692]
  |  |  ------------------
  |  |   99|    692|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 692]
  |  |  ------------------
  ------------------
  |  Branch (196:5): [True: 0, False: 0]
  |  Branch (196:5): [True: 0, False: 0]
  ------------------
  197|    692|    return (*lock->destroy)(lock->lock_object);
  198|    692|}
pj_grp_lock_create:
  413|     88|{
  414|     88|    pj_grp_lock_t *glock;
  415|     88|    grp_lock_item *own_lock;
  416|     88|    pj_status_t status;
  417|       |
  418|     88|    PJ_ASSERT_RETURN(pool && p_grp_lock, PJ_EINVAL);
  ------------------
  |  |   97|     88|            do { \
  |  |   98|    176|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 88, False: 0]
  |  |  |  Branch (98:23): [True: 88, False: 0]
  |  |  ------------------
  |  |   99|     88|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 88]
  |  |  ------------------
  ------------------
  |  Branch (418:5): [True: 0, False: 0]
  |  Branch (418:5): [True: 0, False: 0]
  |  Branch (418:5): [True: 0, False: 0]
  |  Branch (418:5): [True: 0, False: 0]
  ------------------
  419|       |
  420|     88|    PJ_UNUSED_ARG(cfg);
  ------------------
  |  | 1537|     88|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  421|       |
  422|     88|    pool = pj_pool_create(pool->factory, "glck%p", 512, 512, NULL);
  423|     88|    if (!pool)
  ------------------
  |  Branch (423:9): [True: 0, False: 88]
  ------------------
  424|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  425|       |
  426|     88|    glock = PJ_POOL_ZALLOC_T(pool, pj_grp_lock_t);
  ------------------
  |  |  583|     88|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  427|     88|    glock->base.lock_object = glock;
  428|     88|    glock->base.acquire = &grp_lock_acquire;
  429|     88|    glock->base.tryacquire = &grp_lock_tryacquire;
  430|     88|    glock->base.release = &grp_lock_release;
  431|     88|    glock->base.destroy = &grp_lock_destroy;
  432|       |
  433|     88|    glock->pool = pool;
  434|     88|    pj_list_init(&glock->lock_list);
  435|     88|    pj_list_init(&glock->destroy_list);
  436|       |#if PJ_GRP_LOCK_DEBUG
  437|       |    pj_list_init(&glock->ref_list);
  438|       |    pj_list_init(&glock->ref_free_list);
  439|       |#endif
  440|       |
  441|     88|    status = pj_atomic_create(pool, 0, &glock->ref_cnt);
  442|     88|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (442:9): [True: 0, False: 88]
  ------------------
  443|      0|        goto on_error;
  444|       |
  445|     88|    status = pj_lock_create_recursive_mutex(pool, pool->obj_name,
  446|     88|                                            &glock->own_lock);
  447|     88|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (447:9): [True: 0, False: 88]
  ------------------
  448|      0|        goto on_error;
  449|       |
  450|     88|    own_lock = PJ_POOL_ZALLOC_T(pool, grp_lock_item);
  ------------------
  |  |  583|     88|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  451|     88|    own_lock->lock = glock->own_lock;
  452|     88|    pj_list_push_back(&glock->lock_list, own_lock);
  453|       |
  454|     88|    *p_grp_lock = glock;
  455|     88|    return PJ_SUCCESS;
  456|       |
  457|      0|on_error:
  458|      0|    grp_lock_destroy(glock);
  459|      0|    return status;
  460|     88|}
pj_grp_lock_acquire:
  485|    253|{
  486|    253|    return grp_lock_acquire(grp_lock);
  487|    253|}
pj_grp_lock_release:
  495|    253|{
  496|    253|    return grp_lock_release(grp_lock);
  497|    253|}
pj_grp_lock_add_handler:
  527|     87|{
  528|     87|    return grp_lock_add_handler(glock, pool, comp, destroy, PJ_TRUE);
  529|     87|}
pj_grp_lock_add_ref:
  648|    594|{
  649|    594|    return grp_lock_add_ref(glock);
  650|    594|}
pj_grp_lock_dec_ref:
  653|    593|{
  654|    593|    return grp_lock_dec_ref(glock);
  655|    593|}
lock.c:create_mutex_lock:
   62|    157|{
   63|    157|    pj_lock_t *p_lock;
   64|    157|    pj_mutex_t *mutex;
   65|    157|    pj_status_t rc;
   66|       |
   67|    157|    PJ_ASSERT_RETURN(pool && lock, PJ_EINVAL);
  ------------------
  |  |   97|    157|            do { \
  |  |   98|    314|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 157, False: 0]
  |  |  |  Branch (98:23): [True: 157, False: 0]
  |  |  ------------------
  |  |   99|    157|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 157]
  |  |  ------------------
  ------------------
  |  Branch (67:5): [True: 0, False: 0]
  |  Branch (67:5): [True: 0, False: 0]
  |  Branch (67:5): [True: 0, False: 0]
  |  Branch (67:5): [True: 0, False: 0]
  ------------------
   68|       |
   69|    157|    p_lock = PJ_POOL_ALLOC_T(pool, pj_lock_t);
  ------------------
  |  |  569|    157|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
   70|    157|    if (!p_lock)
  ------------------
  |  Branch (70:9): [True: 0, False: 157]
  ------------------
   71|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   72|       |
   73|    157|    pj_memcpy(p_lock, &mutex_lock_template, sizeof(pj_lock_t));
   74|    157|    rc = pj_mutex_create(pool, name, type, &mutex);
   75|    157|    if (rc != PJ_SUCCESS)
  ------------------
  |  Branch (75:9): [True: 0, False: 157]
  ------------------
   76|      0|        return rc;
   77|       |
   78|    157|    p_lock->lock_object = mutex;
   79|    157|    *lock = p_lock;
   80|    157|    return PJ_SUCCESS;
   81|    157|}
lock.c:null_op:
  103|    605|{
  104|    605|    PJ_UNUSED_ARG(arg);
  ------------------
  |  | 1537|    605|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  105|    605|    return PJ_SUCCESS;
  106|    605|}
lock.c:grp_lock_acquire:
  289|    340|{
  290|    340|    pj_grp_lock_t *glock = (pj_grp_lock_t*)p;
  291|    340|    grp_lock_item *lck;
  292|       |
  293|    340|    pj_assert(pj_atomic_get(glock->ref_cnt) > 0);
  ------------------
  |  |   65|    340|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (293:5): [True: 0, False: 340]
  |  Branch (293:5): [True: 340, False: 0]
  ------------------
  294|       |
  295|    340|    lck = glock->lock_list.next;
  296|    680|    while (lck != &glock->lock_list) {
  ------------------
  |  Branch (296:12): [True: 340, False: 340]
  ------------------
  297|    340|        pj_lock_acquire(lck->lock);
  298|    340|        lck = lck->next;
  299|    340|    }
  300|    340|    grp_lock_set_owner_thread(glock);
  301|    340|    pj_grp_lock_add_ref(glock);
  302|    340|    return PJ_SUCCESS;
  303|    340|}
lock.c:grp_lock_set_owner_thread:
  260|    340|{
  261|    340|    if (!glock->owner) {
  ------------------
  |  Branch (261:9): [True: 261, False: 79]
  ------------------
  262|    261|#if PJ_HAS_THREADS
  263|    261|        glock->owner = pj_thread_this();
  264|       |#else
  265|       |        glock->owner = (pj_thread_t *) -1;
  266|       |#endif
  267|    261|        glock->owner_cnt = 1;
  268|    261|    } else {
  269|     79|#if PJ_HAS_THREADS
  270|     79|        pj_assert(glock->owner == pj_thread_this());
  ------------------
  |  |   65|     79|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (270:9): [True: 0, False: 79]
  |  Branch (270:9): [True: 79, False: 0]
  ------------------
  271|     79|#endif
  272|     79|        glock->owner_cnt++;
  273|     79|    }
  274|    340|}
lock.c:grp_lock_release:
  331|    340|{
  332|    340|    pj_grp_lock_t *glock = (pj_grp_lock_t*)p;
  333|    340|    grp_lock_item *lck;
  334|       |
  335|    340|    grp_lock_unset_owner_thread(glock);
  336|       |
  337|    340|    lck = glock->lock_list.prev;
  338|    680|    while (lck != &glock->lock_list) {
  ------------------
  |  Branch (338:12): [True: 340, False: 340]
  ------------------
  339|    340|        pj_lock_release(lck->lock);
  340|    340|        lck = lck->prev;
  341|    340|    }
  342|    340|    return pj_grp_lock_dec_ref(glock);
  343|    340|}
lock.c:grp_lock_unset_owner_thread:
  277|    340|{
  278|    340|#if PJ_HAS_THREADS
  279|    340|    pj_assert(glock->owner == pj_thread_this());
  ------------------
  |  |   65|    340|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (279:5): [True: 0, False: 340]
  |  Branch (279:5): [True: 340, False: 0]
  ------------------
  280|    340|#endif
  281|    340|    pj_assert(glock->owner_cnt > 0);
  ------------------
  |  |   65|    340|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (281:5): [True: 0, False: 340]
  |  Branch (281:5): [True: 340, False: 0]
  ------------------
  282|    340|    if (--glock->owner_cnt <= 0) {
  ------------------
  |  Branch (282:9): [True: 261, False: 79]
  ------------------
  283|       |        glock->owner = NULL;
  284|    261|        glock->owner_cnt = 0;
  285|    261|    }
  286|    340|}
lock.c:grp_lock_destroy:
  371|     87|{
  372|     87|    pj_grp_lock_t *glock = (pj_grp_lock_t*)p;
  373|     87|    pj_pool_t *pool = glock->pool;
  374|     87|    grp_lock_item *lck;
  375|     87|    grp_destroy_callback *cb;
  376|       |
  377|     87|    if (!glock->pool) {
  ------------------
  |  Branch (377:9): [True: 0, False: 87]
  ------------------
  378|       |        /* already destroyed?! */
  379|      0|        return PJ_EINVAL;
  ------------------
  |  |  393|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  380|      0|    }
  381|       |
  382|       |    /* Release all chained locks */
  383|     87|    lck = glock->lock_list.next;
  384|    174|    while (lck != &glock->lock_list) {
  ------------------
  |  Branch (384:12): [True: 87, False: 87]
  ------------------
  385|     87|        if (lck->lock != glock->own_lock) {
  ------------------
  |  Branch (385:13): [True: 0, False: 87]
  ------------------
  386|      0|            int i;
  387|      0|            for (i=0; i<glock->owner_cnt; ++i)
  ------------------
  |  Branch (387:23): [True: 0, False: 0]
  ------------------
  388|      0|                pj_lock_release(lck->lock);
  389|      0|        }
  390|     87|        lck = lck->next;
  391|     87|    }
  392|       |
  393|       |    /* Call callbacks */
  394|     87|    cb = glock->destroy_list.next;
  395|    174|    while (cb != &glock->destroy_list) {
  ------------------
  |  Branch (395:12): [True: 87, False: 87]
  ------------------
  396|     87|        grp_destroy_callback *next = cb->next;
  397|     87|        cb->handler(cb->comp);
  398|     87|        cb = next;
  399|     87|    }
  400|       |
  401|     87|    pj_lock_destroy(glock->own_lock);
  402|     87|    pj_atomic_destroy(glock->ref_cnt);
  403|     87|    glock->pool = NULL;
  404|     87|    pj_pool_release(pool);
  405|       |
  406|     87|    return PJ_SUCCESS;
  407|     87|}
lock.c:grp_lock_add_handler:
  350|     87|{
  351|     87|    grp_destroy_callback *cb;
  352|       |
  353|     87|    if (acquire_lock)
  ------------------
  |  Branch (353:9): [True: 87, False: 0]
  ------------------
  354|     87|        grp_lock_acquire(glock);
  355|       |
  356|     87|    if (pool == NULL)
  ------------------
  |  Branch (356:9): [True: 0, False: 87]
  ------------------
  357|      0|        pool = glock->pool;
  358|       |
  359|     87|    cb = PJ_POOL_ZALLOC_T(pool, grp_destroy_callback);
  ------------------
  |  |  583|     87|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  360|     87|    cb->comp = comp;
  361|     87|    cb->handler = destroy;
  362|     87|    pj_list_push_back(&glock->destroy_list, cb);
  363|       |
  364|     87|    if (acquire_lock)
  ------------------
  |  Branch (364:9): [True: 87, False: 0]
  ------------------
  365|     87|        grp_lock_release(glock);
  366|       |
  367|     87|    return PJ_SUCCESS;
  368|     87|}
lock.c:grp_lock_add_ref:
  554|    594|{
  555|    594|    pj_atomic_inc(glock->ref_cnt);
  556|    594|    return PJ_SUCCESS;
  557|    594|}
lock.c:grp_lock_dec_ref:
  560|    593|{
  561|    593|    int cnt; /* for debugging */
  562|    593|    if ((cnt=pj_atomic_dec_and_get(glock->ref_cnt)) == 0) {
  ------------------
  |  Branch (562:9): [True: 87, False: 506]
  ------------------
  563|     87|        grp_lock_destroy(glock);
  564|     87|        return PJ_EGONE;
  ------------------
  |  |  489|     87|#define PJ_EGONE            (PJ_ERRNO_START_STATUS + 23)/* 70023 */
  |  |  ------------------
  |  |  |  |  521|     87|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|     87|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|     87|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  565|     87|    }
  566|    506|    pj_assert(cnt > 0);
  ------------------
  |  |   65|    506|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (566:5): [True: 0, False: 506]
  |  Branch (566:5): [True: 506, False: 0]
  ------------------
  567|    506|    return PJ_SUCCESS;
  568|    506|}

pj_log_init:
  149|      1|{
  150|      1|#if PJ_HAS_THREADS
  151|      1|    if (thread_suspended_tls_id == -1) {
  ------------------
  |  Branch (151:9): [True: 1, False: 0]
  ------------------
  152|      1|        pj_status_t status;
  153|      1|        status = pj_thread_local_alloc(&thread_suspended_tls_id);
  154|      1|        if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (154:13): [True: 0, False: 1]
  ------------------
  155|      0|            thread_suspended_tls_id = -1;
  156|      0|            return status;
  157|      0|        }
  158|       |
  159|      1|#  if PJ_LOG_ENABLE_INDENT
  160|      1|        status = pj_thread_local_alloc(&thread_indent_tls_id);
  161|      1|        if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (161:13): [True: 0, False: 1]
  ------------------
  162|      0|            pj_thread_local_free(thread_suspended_tls_id);
  163|      0|            thread_suspended_tls_id = -1;
  164|      0|            thread_indent_tls_id = -1;
  165|      0|            return status;
  166|      0|        }
  167|      1|#  endif
  168|      1|        pj_atexit(&logging_shutdown);
  169|      1|    }
  170|      1|#endif
  171|      1|    g_last_thread = NULL;
  172|       |
  173|       |    /* Normalize log decor, e.g: unset thread flags when threading is
  174|       |     * disabled.
  175|       |     */
  176|      1|    pj_log_set_decor(pj_log_get_decor());
  177|       |
  178|      1|    return PJ_SUCCESS;
  179|      1|}
pj_log_set_decor:
  182|      1|{
  183|      1|    log_decor = decor;
  184|       |
  185|       |#if !PJ_HAS_THREADS
  186|       |    /* Unset thread related flags */
  187|       |    if (log_decor & PJ_LOG_HAS_THREAD_ID) {
  188|       |       log_decor &= ~(PJ_LOG_HAS_THREAD_ID);
  189|       |    }
  190|       |    if (log_decor & PJ_LOG_HAS_THREAD_SWC) {
  191|       |       log_decor &= ~(PJ_LOG_HAS_THREAD_SWC);
  192|       |    }
  193|       |#endif
  194|      1|}
pj_log_get_decor:
  197|      1|{
  198|      1|    return log_decor;
  199|      1|}
pj_log_set_level:
  252|      1|{
  253|      1|    pj_log_max_level = level;
  254|      1|}
pj_log_get_level:
  258|  12.5k|{
  259|  12.5k|    return pj_log_max_level;
  260|  12.5k|}

pj_init:
  202|      1|{
  203|      1|    char dummy_guid[PJ_GUID_MAX_LENGTH];
  204|      1|    pj_str_t guid;
  205|      1|    pj_status_t rc;
  206|       |
  207|       |    /* Check if PJLIB have been initialized */
  208|      1|    if (initialized) {
  ------------------
  |  Branch (208:9): [True: 0, False: 1]
  ------------------
  209|      0|        ++initialized;
  210|      0|        return PJ_SUCCESS;
  211|      0|    }
  212|       |
  213|       |    /* Init logging */
  214|      1|    pj_log_init();
  215|       |
  216|      1|#if PJ_HAS_THREADS
  217|       |    /* Init this thread's TLS. */
  218|      1|    if ((rc=pj_thread_init()) != 0) {
  ------------------
  |  Branch (218:9): [True: 0, False: 1]
  ------------------
  219|      0|        return rc;
  220|      0|    }
  221|       |
  222|       |    /* Critical section. */
  223|      1|    if ((rc=init_mutex(&critical_section, "critsec", PJ_MUTEX_RECURSE)) != 0)
  ------------------
  |  Branch (223:9): [True: 0, False: 1]
  ------------------
  224|      0|        return rc;
  225|       |
  226|      1|#endif
  227|       |
  228|       |    /* Initialize exception ID for the pool.
  229|       |     * Must do so after critical section is configured.
  230|       |     */
  231|      1|    rc = pj_exception_id_alloc("PJLIB/No memory", &PJ_NO_MEMORY_EXCEPTION);
  232|      1|    if (rc != PJ_SUCCESS)
  ------------------
  |  Branch (232:9): [True: 0, False: 1]
  ------------------
  233|      0|        return rc;
  234|       |
  235|       |    /* Init random seed. */
  236|       |    /* Or probably not. Let application in charge of this */
  237|       |    /* pj_srand( clock() ); */
  238|       |
  239|       |    /* Startup GUID. */
  240|      1|    guid.ptr = dummy_guid;
  241|      1|    pj_generate_unique_string( &guid );
  242|       |
  243|       |    /* Startup timestamp */
  244|      1|#if defined(PJ_HAS_HIGH_RES_TIMER) && PJ_HAS_HIGH_RES_TIMER != 0
  245|      1|    {
  246|      1|        pj_timestamp dummy_ts;
  247|      1|        if ((rc=pj_get_timestamp(&dummy_ts)) != 0) {
  ------------------
  |  Branch (247:13): [True: 0, False: 1]
  ------------------
  248|      0|            return rc;
  249|      0|        }
  250|      1|    }
  251|      1|#endif
  252|       |
  253|       |    /* Flag PJLIB as initialized */
  254|      1|    ++initialized;
  255|      1|    pj_assert(initialized == 1);
  ------------------
  |  |   65|      1|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (255:5): [True: 0, False: 1]
  |  Branch (255:5): [True: 1, False: 0]
  ------------------
  256|       |
  257|      1|    PJ_LOG(4,(THIS_FILE, "pjlib %s for POSIX initialized",
  ------------------
  |  |  106|      1|#define PJ_LOG(level,arg)       do { \
  |  |  107|      1|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      2|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 1, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 1]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      1|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 1]
  |  |  ------------------
  ------------------
  258|      1|              PJ_VERSION));
  259|       |
  260|      1|    return PJ_SUCCESS;
  261|      1|}
pj_atexit:
  267|      3|{
  268|      3|    if (atexit_count >= PJ_ARRAY_SIZE(atexit_func))
  ------------------
  |  |  315|      3|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (268:9): [True: 0, False: 3]
  ------------------
  269|      0|        return PJ_ETOOMANY;
  ------------------
  |  |  423|      0|#define PJ_ETOOMANY         (PJ_ERRNO_START_STATUS + 10)/* 70010 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  270|       |
  271|      3|    atexit_func[atexit_count++] = func;
  272|      3|    return PJ_SUCCESS;
  273|      3|}
pj_thread_register:
  608|      1|{
  609|      1|#if PJ_HAS_THREADS
  610|      1|    char stack_ptr;
  611|      1|    pj_status_t rc;
  612|      1|    pj_thread_t *thread = (pj_thread_t *)desc;
  613|      1|    pj_str_t thread_name = pj_str((char*)cstr_thread_name);
  614|       |
  615|       |    /* Size sanity check. */
  616|      1|    if (sizeof(pj_thread_desc) < sizeof(pj_thread_t)) {
  ------------------
  |  Branch (616:9): [Folded, False: 1]
  ------------------
  617|      0|        pj_assert(!"Not enough pj_thread_desc size!");
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (617:9): [Folded, False: 0]
  |  Branch (617:9): [Folded, False: 0]
  ------------------
  618|      0|        return PJ_EBUG;
  ------------------
  |  |  413|      0|#define PJ_EBUG             (PJ_ERRNO_START_STATUS + 8) /* 70008 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  619|      0|    }
  620|       |
  621|       |    /* Warn if this thread has been registered before */
  622|      1|    if (pj_thread_local_get (thread_tls_id) != 0) {
  ------------------
  |  Branch (622:9): [True: 0, False: 1]
  ------------------
  623|       |        // 2006-02-26 bennylp:
  624|       |        //  This wouldn't work in all cases!.
  625|       |        //  If thread is created by external module (e.g. sound thread),
  626|       |        //  thread may be reused while the pool used for the thread descriptor
  627|       |        //  has been deleted by application.
  628|       |        //*thread_ptr = (pj_thread_t*)pj_thread_local_get (thread_tls_id);
  629|       |        //return PJ_SUCCESS;
  630|      0|        PJ_LOG(4,(THIS_FILE, "Info: possibly re-registering existing "
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  631|      0|                             "thread"));
  632|      0|    }
  633|       |
  634|       |    /* On the other hand, also warn if the thread descriptor buffer seem to
  635|       |     * have been used to register other threads.
  636|       |     */
  637|      1|    pj_assert(thread->signature1 != SIGNATURE1 ||
  ------------------
  |  |   65|      1|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (637:5): [True: 1, False: 0]
  |  Branch (637:5): [True: 0, False: 0]
  |  Branch (637:5): [True: 0, False: 0]
  |  Branch (637:5): [True: 1, False: 0]
  |  Branch (637:5): [True: 0, False: 0]
  |  Branch (637:5): [True: 0, False: 0]
  ------------------
  638|      1|              thread->signature2 != SIGNATURE2 ||
  639|      1|              (thread->thread == pthread_self()));
  640|       |
  641|       |    /* Initialize and set the thread entry. */
  642|      1|    pj_bzero(desc, sizeof(struct pj_thread_t));
  643|      1|    thread->thread = pthread_self();
  644|      1|    thread->signature1 = SIGNATURE1;
  ------------------
  |  |   70|      1|#define SIGNATURE1  0xDEAFBEEF
  ------------------
  645|      1|    thread->signature2 = SIGNATURE2;
  ------------------
  |  |   71|      1|#define SIGNATURE2  0xDEADC0DE
  ------------------
  646|       |
  647|      1|    if(cstr_thread_name && pj_strlen(&thread_name) < sizeof(thread->obj_name)-1)
  ------------------
  |  Branch (647:8): [True: 1, False: 0]
  |  Branch (647:28): [True: 1, False: 0]
  ------------------
  648|      1|        pj_ansi_snprintf(thread->obj_name, sizeof(thread->obj_name),
  ------------------
  |  |  114|      1|#define pj_ansi_snprintf        snprintf
  ------------------
  649|      1|                         cstr_thread_name, thread->thread);
  650|      0|    else
  651|      0|        pj_ansi_snprintf(thread->obj_name, sizeof(thread->obj_name),
  ------------------
  |  |  114|      0|#define pj_ansi_snprintf        snprintf
  ------------------
  652|      0|                         "thr%p", (void*)thread->thread);
  653|       |
  654|      1|    rc = pj_thread_local_set(thread_tls_id, thread);
  655|      1|    if (rc != PJ_SUCCESS) {
  ------------------
  |  Branch (655:9): [True: 0, False: 1]
  ------------------
  656|      0|        pj_bzero(desc, sizeof(struct pj_thread_t));
  657|      0|        return rc;
  658|      0|    }
  659|       |
  660|       |#if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0
  661|       |    thread->stk_start = &stack_ptr;
  662|       |    thread->stk_size = 0xFFFFFFFFUL;
  663|       |    thread->stk_max_usage = 0;
  664|       |#else
  665|      1|    PJ_UNUSED_ARG(stack_ptr);
  ------------------
  |  | 1537|      1|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  666|      1|#endif
  667|       |
  668|      1|    *ptr_thread = thread;
  669|      1|    return PJ_SUCCESS;
  670|       |#else
  671|       |    pj_thread_t *thread = (pj_thread_t*)desc;
  672|       |    *ptr_thread = thread;
  673|       |    return PJ_SUCCESS;
  674|       |#endif
  675|      1|}
pj_thread_init:
  681|      1|{
  682|      1|#if PJ_HAS_THREADS
  683|      1|    pj_status_t rc;
  684|      1|    pj_thread_t *dummy;
  685|       |
  686|      1|    rc = pj_thread_local_alloc(&thread_tls_id );
  687|      1|    if (rc != PJ_SUCCESS) {
  ------------------
  |  Branch (687:9): [True: 0, False: 1]
  ------------------
  688|      0|        return rc;
  689|      0|    }
  690|      1|    return pj_thread_register("thr%p", main_thread_desc, &dummy);
  691|       |#else
  692|       |    PJ_LOG(2,(THIS_FILE, "Thread init error. Threading is not enabled!"));
  693|       |    return PJ_EINVALIDOP;
  694|       |#endif
  695|      1|}
pj_thread_create:
  863|      1|{
  864|      1|#if PJ_HAS_THREADS
  865|      1|    pj_status_t status;
  866|      1|    pj_thread_t *rec;
  867|      1|    void *stack_addr = NULL;
  868|      1|    int rc;
  869|       |
  870|      1|    PJ_CHECK_STACK();
  871|      1|    PJ_ASSERT_RETURN(pool && proc && ptr_thread, PJ_EINVAL);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      4|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (871:5): [True: 0, False: 0]
  |  Branch (871:5): [True: 0, False: 0]
  |  Branch (871:5): [True: 0, False: 0]
  |  Branch (871:5): [True: 0, False: 0]
  |  Branch (871:5): [True: 0, False: 0]
  |  Branch (871:5): [True: 0, False: 0]
  ------------------
  872|       |
  873|       |    /* Create thread record and assign name for the thread */
  874|      1|    rec = (struct pj_thread_t*) pj_pool_zalloc(pool, sizeof(pj_thread_t));
  875|      1|    PJ_ASSERT_RETURN(rec, PJ_ENOMEM);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (875:5): [True: 0, False: 0]
  |  Branch (875:5): [True: 0, False: 0]
  ------------------
  876|       |
  877|       |#if defined(PJ_THREAD_ALLOCATE_STACK) && PJ_THREAD_ALLOCATE_STACK!=0
  878|       |    /* Allocate memory for the stack */
  879|       |    stack_addr = pj_pool_alloc(pool, stack_size);
  880|       |    PJ_ASSERT_RETURN(stack_addr, PJ_ENOMEM);
  881|       |#endif  /* PJ_THREAD_ALLOCATE_STACK */
  882|       |
  883|       |    /* Emulate suspended thread with mutex. */
  884|      1|    if (flags & PJ_THREAD_SUSPENDED) {
  ------------------
  |  Branch (884:9): [True: 1, False: 0]
  ------------------
  885|      1|        rc = pj_mutex_create_simple(pool, NULL, &rec->suspended_mutex);
  886|      1|        if (rc != PJ_SUCCESS) {
  ------------------
  |  Branch (886:13): [True: 0, False: 1]
  ------------------
  887|      0|            return rc;
  888|      0|        }
  889|       |
  890|      1|        pj_mutex_lock(rec->suspended_mutex);
  891|      1|    } else {
  892|      0|        pj_assert(rec->suspended_mutex == NULL);
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (892:9): [True: 0, False: 0]
  |  Branch (892:9): [True: 0, False: 0]
  ------------------
  893|      0|    }
  894|       |
  895|      1|    status = create_thread(thread_name, proc, arg, stack_size, stack_addr, rec);
  896|      1|    if (status == PJ_SUCCESS) {
  ------------------
  |  Branch (896:9): [True: 1, False: 0]
  ------------------
  897|       |        /* Success! */
  898|      1|        *ptr_thread = rec;
  899|      1|    }
  900|      1|    return status;
  901|       |
  902|       |#else
  903|       |    pj_assert(!"Threading is disabled!");
  904|       |    return PJ_EINVALIDOP;
  905|       |#endif
  906|      1|}
pj_thread_resume:
  952|      1|{
  953|      1|    pj_status_t rc;
  954|       |
  955|      1|    PJ_CHECK_STACK();
  956|      1|    PJ_ASSERT_RETURN(p, PJ_EINVAL);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (956:5): [True: 0, False: 0]
  |  Branch (956:5): [True: 0, False: 0]
  ------------------
  957|       |
  958|      1|    rc = pj_mutex_unlock(p->suspended_mutex);
  959|       |
  960|      1|    return rc;
  961|      1|}
pj_thread_this:
  967|  40.9k|{
  968|  40.9k|#if PJ_HAS_THREADS
  969|  40.9k|    pj_thread_t *rec = (pj_thread_t*)pj_thread_local_get(thread_tls_id);
  970|       |
  971|  40.9k|    if (rec == NULL) {
  ------------------
  |  Branch (971:9): [True: 0, False: 40.9k]
  ------------------
  972|      0|        pj_assert(!"Calling pjlib from unknown/external thread. You must "
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (972:9): [Folded, False: 0]
  |  Branch (972:9): [Folded, False: 0]
  ------------------
  973|      0|                   "register external threads with pj_thread_register() "
  974|      0|                   "before calling any pjlib functions.");
  975|      0|    }
  976|       |
  977|       |    /*
  978|       |     * MUST NOT check stack because this function is called
  979|       |     * by PJ_CHECK_STACK() itself!!!
  980|       |     *
  981|       |     */
  982|       |
  983|  40.9k|    return rec;
  984|       |#else
  985|       |    pj_assert(!"Threading is not enabled!");
  986|       |    return NULL;
  987|       |#endif
  988|  40.9k|}
pj_thread_sleep:
 1081|    550|{
 1082|       |/* TODO: should change this to something like PJ_OS_HAS_NANOSLEEP */
 1083|       |#if defined(PJ_RTEMS) && PJ_RTEMS!=0
 1084|       |    enum { NANOSEC_PER_MSEC = 1000000 };
 1085|       |    struct timespec req;
 1086|       |
 1087|       |    PJ_CHECK_STACK();
 1088|       |    req.tv_sec = msec / 1000;
 1089|       |    req.tv_nsec = (msec % 1000) * NANOSEC_PER_MSEC;
 1090|       |
 1091|       |    if (nanosleep(&req, NULL) == 0)
 1092|       |        return PJ_SUCCESS;
 1093|       |
 1094|       |    return PJ_RETURN_OS_ERROR(pj_get_native_os_error());
 1095|       |#else
 1096|    550|    PJ_CHECK_STACK();
 1097|       |
 1098|    550|    pj_set_os_error(0);
 1099|       |
 1100|    550|    usleep(msec * 1000);
 1101|       |
 1102|       |    /* MacOS X (reported on 10.5) seems to always set errno to ETIMEDOUT.
 1103|       |     * It does so because usleep() is declared to return int, and we're
 1104|       |     * supposed to check for errno only when usleep() returns non-zero.
 1105|       |     * Unfortunately, usleep() is declared to return void in other platforms
 1106|       |     * so it's not possible to always check for the return value (unless
 1107|       |     * we add a detection routine in autoconf).
 1108|       |     *
 1109|       |     * As a workaround, here we check if ETIMEDOUT is returned and
 1110|       |     * return successfully if it is.
 1111|       |     */
 1112|    550|    if (pj_get_native_os_error() == ETIMEDOUT)
  ------------------
  |  |   33|    550|#   define pj_get_native_os_error()         (errno)
  ------------------
  |  Branch (1112:9): [True: 0, False: 550]
  ------------------
 1113|      0|        return PJ_SUCCESS;
 1114|       |
 1115|    550|    return pj_get_os_error();
 1116|       |
 1117|    550|#endif  /* PJ_RTEMS */
 1118|    550|}
pj_atomic_create:
 1183|    695|{
 1184|       |#if EMULATE_ATOMICS
 1185|       |    pj_status_t rc;
 1186|       |#endif
 1187|    695|    pj_atomic_t *atomic_var;
 1188|       |
 1189|    695|    atomic_var = PJ_POOL_ZALLOC_T(pool, pj_atomic_t);
  ------------------
  |  |  583|    695|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
 1190|       |
 1191|    695|    PJ_ASSERT_RETURN(atomic_var, PJ_ENOMEM);
  ------------------
  |  |   97|    695|            do { \
  |  |   98|    695|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 695]
  |  |  ------------------
  |  |   99|    695|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 695]
  |  |  ------------------
  ------------------
  |  Branch (1191:5): [True: 0, False: 0]
  |  Branch (1191:5): [True: 0, False: 0]
  ------------------
 1192|       |
 1193|    695|#if HAS_STD_ATOMICS
 1194|    695|    atomic_init(&atomic_var->value, initial);
 1195|       |#elif EMULATE_ATOMICS
 1196|       |    rc = pj_mutex_create(pool, "atm%p", PJ_MUTEX_SIMPLE, &atomic_var->mutex);
 1197|       |    if (rc != PJ_SUCCESS)
 1198|       |        return rc;
 1199|       |    atomic_var->value = initial;
 1200|       |#else
 1201|       |    atomic_var->value = initial;
 1202|       |#endif
 1203|       |
 1204|    695|    *ptr_atomic = atomic_var;
 1205|    695|    return PJ_SUCCESS;
 1206|    695|}
pj_atomic_destroy:
 1212|    692|{
 1213|       |#if EMULATE_ATOMICS
 1214|       |    pj_status_t status;
 1215|       |#endif
 1216|       |
 1217|    692|    PJ_ASSERT_RETURN(atomic_var, PJ_EINVAL);
  ------------------
  |  |   97|    692|            do { \
  |  |   98|    692|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 692]
  |  |  ------------------
  |  |   99|    692|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 692]
  |  |  ------------------
  ------------------
  |  Branch (1217:5): [True: 0, False: 0]
  |  Branch (1217:5): [True: 0, False: 0]
  ------------------
 1218|       |
 1219|       |#if EMULATE_ATOMICS
 1220|       |    status = pj_mutex_destroy( atomic_var->mutex );
 1221|       |    if (status == PJ_SUCCESS) {
 1222|       |        atomic_var->mutex = NULL;
 1223|       |    }
 1224|       |    return status;
 1225|       |#else
 1226|    692|    return 0;
 1227|    692|#endif
 1228|    692|}
pj_atomic_get:
 1260|    340|{
 1261|    340|    pj_atomic_value_t oldval;
 1262|       |
 1263|    340|    PJ_CHECK_STACK();
 1264|       |
 1265|    340|#if HAS_STD_ATOMICS
 1266|    340|    oldval = atomic_load(&atomic_var->value);
 1267|       |#elif EMULATE_ATOMICS
 1268|       |    pj_mutex_lock( atomic_var->mutex );
 1269|       |    oldval = atomic_var->value;
 1270|       |    pj_mutex_unlock( atomic_var->mutex);
 1271|       |#else
 1272|       |    oldval = atomic_var->value;
 1273|       |#endif
 1274|       |
 1275|    340|    return oldval;
 1276|    340|}
pj_atomic_inc_and_get:
 1282|  2.08k|{
 1283|  2.08k|    pj_atomic_value_t new_value;
 1284|       |
 1285|  2.08k|    PJ_CHECK_STACK();
 1286|       |
 1287|  2.08k|#if HAS_STD_ATOMICS
 1288|  2.08k|    new_value = atomic_fetch_add(&atomic_var->value, 1) + 1;
 1289|       |#elif EMULATE_ATOMICS
 1290|       |    pj_mutex_lock( atomic_var->mutex );
 1291|       |    new_value = ++atomic_var->value;
 1292|       |    pj_mutex_unlock( atomic_var->mutex);
 1293|       |#else
 1294|       |    new_value = ++atomic_var->value;
 1295|       |#endif
 1296|       |
 1297|  2.08k|    return new_value;
 1298|  2.08k|}
pj_atomic_inc:
 1303|  2.08k|{
 1304|  2.08k|    PJ_ASSERT_ON_FAIL(atomic_var, return);
  ------------------
  |  |  111|  2.08k|            { \
  |  |  112|  2.08k|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   65|  2.08k|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  113|  2.08k|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (113:21): [True: 0, False: 2.08k]
  |  |  ------------------
  |  |  114|  2.08k|            }
  ------------------
  |  Branch (1304:5): [True: 0, False: 2.08k]
  |  Branch (1304:5): [True: 2.08k, False: 0]
  ------------------
 1305|  2.08k|    pj_atomic_inc_and_get(atomic_var);
 1306|  2.08k|}
pj_atomic_dec_and_get:
 1312|  2.08k|{
 1313|  2.08k|    pj_atomic_value_t new_value;
 1314|       |
 1315|  2.08k|    PJ_CHECK_STACK();
 1316|       |
 1317|  2.08k|#if HAS_STD_ATOMICS
 1318|  2.08k|    new_value = atomic_fetch_sub(&atomic_var->value, 1) - 1;
 1319|       |#elif EMULATE_ATOMICS
 1320|       |    pj_mutex_lock( atomic_var->mutex );
 1321|       |    new_value = --atomic_var->value;
 1322|       |    pj_mutex_unlock( atomic_var->mutex);
 1323|       |#else
 1324|       |    new_value = --atomic_var->value;
 1325|       |#endif
 1326|       |
 1327|  2.08k|    return new_value;
 1328|  2.08k|}
pj_atomic_dec:
 1334|    605|{
 1335|    605|    PJ_ASSERT_ON_FAIL(atomic_var, return);
  ------------------
  |  |  111|    605|            { \
  |  |  112|    605|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   65|    605|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  113|    605|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (113:21): [True: 0, False: 605]
  |  |  ------------------
  |  |  114|    605|            }
  ------------------
  |  Branch (1335:5): [True: 0, False: 605]
  |  Branch (1335:5): [True: 605, False: 0]
  ------------------
 1336|    605|    pj_atomic_dec_and_get(atomic_var);
 1337|    605|}
pj_thread_local_alloc:
 1375|      6|{
 1376|      6|#if PJ_HAS_THREADS
 1377|      6|    pthread_key_t key;
 1378|      6|    int rc;
 1379|       |
 1380|      6|    PJ_ASSERT_RETURN(p_index != NULL, PJ_EINVAL);
  ------------------
  |  |   97|      6|            do { \
  |  |   98|      6|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 6]
  |  |  ------------------
  |  |   99|      6|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 6]
  |  |  ------------------
  ------------------
  |  Branch (1380:5): [True: 0, False: 0]
  |  Branch (1380:5): [True: 0, False: 0]
  ------------------
 1381|       |
 1382|      6|    pj_assert( sizeof(pthread_key_t) <= sizeof(long));
  ------------------
  |  |   65|      6|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (1382:5): [True: 0, Folded]
  |  Branch (1382:5): [True: 6, Folded]
  ------------------
 1383|      6|    if ((rc=pthread_key_create(&key, NULL)) != 0)
  ------------------
  |  Branch (1383:9): [True: 0, False: 6]
  ------------------
 1384|      0|        return PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1385|       |
 1386|      6|    *p_index = key;
 1387|      6|    return PJ_SUCCESS;
 1388|       |#else
 1389|       |    int i;
 1390|       |    for (i=0; i<MAX_THREADS; ++i) {
 1391|       |        if (tls_flag[i] == 0)
 1392|       |            break;
 1393|       |    }
 1394|       |    if (i == MAX_THREADS)
 1395|       |        return PJ_ETOOMANY;
 1396|       |
 1397|       |    tls_flag[i] = 1;
 1398|       |    tls[i] = NULL;
 1399|       |
 1400|       |    *p_index = i;
 1401|       |    return PJ_SUCCESS;
 1402|       |#endif
 1403|      6|}
pj_thread_local_set:
 1422|  79.4k|{
 1423|       |    //Can't check stack because this function is called in the
 1424|       |    //beginning before main thread is initialized.
 1425|       |    //PJ_CHECK_STACK();
 1426|  79.4k|#if PJ_HAS_THREADS
 1427|  79.4k|    int rc=pthread_setspecific(index, value);
 1428|  79.4k|    return rc==0 ? PJ_SUCCESS : PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1428:12): [True: 79.4k, False: 0]
  ------------------
 1429|       |#else
 1430|       |    pj_assert(index >= 0 && index < MAX_THREADS);
 1431|       |    tls[index] = value;
 1432|       |    return PJ_SUCCESS;
 1433|       |#endif
 1434|  79.4k|}
pj_thread_local_get:
 1437|   155k|{
 1438|       |    //Can't check stack because this function is called
 1439|       |    //by PJ_CHECK_STACK() itself!!!
 1440|       |    //PJ_CHECK_STACK();
 1441|   155k|#if PJ_HAS_THREADS
 1442|   155k|    return pthread_getspecific(index);
 1443|       |#else
 1444|       |    pj_assert(index >= 0 && index < MAX_THREADS);
 1445|       |    return tls[index];
 1446|       |#endif
 1447|   155k|}
pj_enter_critical_section:
 1451|      5|{
 1452|      5|#if PJ_HAS_THREADS
 1453|      5|    pj_mutex_lock(&critical_section);
 1454|      5|#endif
 1455|      5|}
pj_leave_critical_section:
 1458|      5|{
 1459|      5|#if PJ_HAS_THREADS
 1460|      5|    pj_mutex_unlock(&critical_section);
 1461|      5|#endif
 1462|      5|}
pj_mutex_create:
 1562|    162|{
 1563|    162|#if PJ_HAS_THREADS
 1564|    162|    pj_status_t rc;
 1565|    162|    pj_mutex_t *mutex;
 1566|       |
 1567|    162|    PJ_ASSERT_RETURN(pool && ptr_mutex, PJ_EINVAL);
  ------------------
  |  |   97|    162|            do { \
  |  |   98|    324|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 162, False: 0]
  |  |  |  Branch (98:23): [True: 162, False: 0]
  |  |  ------------------
  |  |   99|    162|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 162]
  |  |  ------------------
  ------------------
  |  Branch (1567:5): [True: 0, False: 0]
  |  Branch (1567:5): [True: 0, False: 0]
  |  Branch (1567:5): [True: 0, False: 0]
  |  Branch (1567:5): [True: 0, False: 0]
  ------------------
 1568|       |
 1569|    162|    mutex = PJ_POOL_ALLOC_T(pool, pj_mutex_t);
  ------------------
  |  |  569|    162|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1570|    162|    PJ_ASSERT_RETURN(mutex, PJ_ENOMEM);
  ------------------
  |  |   97|    162|            do { \
  |  |   98|    162|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 162]
  |  |  ------------------
  |  |   99|    162|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 162]
  |  |  ------------------
  ------------------
  |  Branch (1570:5): [True: 0, False: 0]
  |  Branch (1570:5): [True: 0, False: 0]
  ------------------
 1571|       |
 1572|    162|    if ((rc=init_mutex(mutex, name, type)) != PJ_SUCCESS)
  ------------------
  |  Branch (1572:9): [True: 0, False: 162]
  ------------------
 1573|      0|        return rc;
 1574|       |
 1575|    162|    *ptr_mutex = mutex;
 1576|    162|    return PJ_SUCCESS;
 1577|       |#else /* PJ_HAS_THREADS */
 1578|       |    *ptr_mutex = (pj_mutex_t*)1;
 1579|       |    return PJ_SUCCESS;
 1580|       |#endif
 1581|    162|}
pj_mutex_create_simple:
 1589|      2|{
 1590|      2|    return pj_mutex_create(pool, name, PJ_MUTEX_SIMPLE, mutex);
 1591|      2|}
pj_mutex_create_recursive:
 1599|      3|{
 1600|      3|    return pj_mutex_create(pool, name, PJ_MUTEX_RECURSE, mutex);
 1601|      3|}
pj_mutex_lock:
 1607|  20.1k|{
 1608|  20.1k|#if PJ_HAS_THREADS
 1609|  20.1k|    pj_status_t status;
 1610|       |
 1611|  20.1k|    PJ_CHECK_STACK();
 1612|  20.1k|    PJ_ASSERT_RETURN(mutex, PJ_EINVAL);
  ------------------
  |  |   97|  20.1k|            do { \
  |  |   98|  20.1k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 20.1k]
  |  |  ------------------
  |  |   99|  20.1k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 20.1k]
  |  |  ------------------
  ------------------
  |  Branch (1612:5): [True: 0, False: 0]
  |  Branch (1612:5): [True: 0, False: 0]
  ------------------
 1613|       |
 1614|  20.1k|#if PJ_DEBUG
 1615|  20.1k|    PJ_LOG(6,(mutex->obj_name, "Mutex: thread %s is waiting (mutex owner=%s)",
  ------------------
  |  |  106|  20.1k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  20.1k|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|  40.2k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 20.1k]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  20.1k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 20.1k]
  |  |  ------------------
  ------------------
 1616|  20.1k|                                pj_thread_this()->obj_name,
 1617|  20.1k|                                mutex->owner_name));
 1618|       |#else
 1619|       |    PJ_LOG(6,(mutex->obj_name, "Mutex: thread %s is waiting",
 1620|       |                                pj_thread_this()->obj_name));
 1621|       |#endif
 1622|       |
 1623|  20.1k|    status = pthread_mutex_lock( &mutex->mutex );
 1624|       |
 1625|       |
 1626|  20.1k|#if PJ_DEBUG
 1627|  20.1k|    if (status == PJ_SUCCESS) {
  ------------------
  |  Branch (1627:9): [True: 20.1k, False: 0]
  ------------------
 1628|  20.1k|        mutex->owner = pj_thread_this();
 1629|  20.1k|        pj_ansi_strxcpy(mutex->owner_name, mutex->owner->obj_name,
 1630|  20.1k|                        sizeof(mutex->owner_name));
 1631|  20.1k|        ++mutex->nesting_level;
 1632|  20.1k|    }
 1633|       |
 1634|  20.1k|    PJ_LOG(6,(mutex->obj_name,
  ------------------
  |  |  106|  20.1k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  20.1k|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|  40.2k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 20.1k]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  20.1k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 20.1k]
  |  |  ------------------
  ------------------
 1635|  20.1k|              (status==0 ?
 1636|  20.1k|                "Mutex acquired by thread %s (level=%d)" :
 1637|  20.1k|                "Mutex acquisition FAILED by %s (level=%d)"),
 1638|  20.1k|              pj_thread_this()->obj_name,
 1639|  20.1k|              mutex->nesting_level));
 1640|       |#else
 1641|       |    PJ_LOG(6,(mutex->obj_name,
 1642|       |              (status==0 ? "Mutex acquired by thread %s" : "FAILED by %s"),
 1643|       |              pj_thread_this()->obj_name));
 1644|       |#endif
 1645|       |
 1646|  20.1k|    if (status == 0)
  ------------------
  |  Branch (1646:9): [True: 20.1k, False: 0]
  ------------------
 1647|  20.1k|        return PJ_SUCCESS;
 1648|      0|    else
 1649|      0|        return PJ_RETURN_OS_ERROR(status);
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1650|       |#else   /* PJ_HAS_THREADS */
 1651|       |    pj_assert( mutex == (pj_mutex_t*)1 );
 1652|       |    return PJ_SUCCESS;
 1653|       |#endif
 1654|  20.1k|}
pj_mutex_unlock:
 1660|  20.1k|{
 1661|  20.1k|#if PJ_HAS_THREADS
 1662|  20.1k|    pj_status_t status;
 1663|       |
 1664|  20.1k|    PJ_CHECK_STACK();
 1665|  20.1k|    PJ_ASSERT_RETURN(mutex, PJ_EINVAL);
  ------------------
  |  |   97|  20.1k|            do { \
  |  |   98|  20.1k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 20.1k]
  |  |  ------------------
  |  |   99|  20.1k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 20.1k]
  |  |  ------------------
  ------------------
  |  Branch (1665:5): [True: 0, False: 0]
  |  Branch (1665:5): [True: 0, False: 0]
  ------------------
 1666|       |
 1667|  20.1k|#if PJ_DEBUG
 1668|  20.1k|    pj_assert(mutex->owner == pj_thread_this());
  ------------------
  |  |   65|  20.1k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (1668:5): [True: 0, False: 20.1k]
  |  Branch (1668:5): [True: 20.1k, False: 0]
  ------------------
 1669|  20.1k|    if (--mutex->nesting_level == 0) {
  ------------------
  |  Branch (1669:9): [True: 20.0k, False: 81]
  ------------------
 1670|  20.0k|        mutex->owner = NULL;
 1671|  20.0k|        mutex->owner_name[0] = '\0';
 1672|  20.0k|    }
 1673|       |
 1674|  20.1k|    PJ_LOG(6,(mutex->obj_name, "Mutex released by thread %s (level=%d)",
  ------------------
  |  |  106|  20.1k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  20.1k|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|  40.2k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 20.1k]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  20.1k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 20.1k]
  |  |  ------------------
  ------------------
 1675|  20.1k|                                pj_thread_this()->obj_name,
 1676|  20.1k|                                mutex->nesting_level));
 1677|       |#else
 1678|       |    PJ_LOG(6,(mutex->obj_name, "Mutex released by thread %s",
 1679|       |                                pj_thread_this()->obj_name));
 1680|       |#endif
 1681|       |
 1682|  20.1k|    status = pthread_mutex_unlock( &mutex->mutex );
 1683|  20.1k|    if (status == 0)
  ------------------
  |  Branch (1683:9): [True: 20.1k, False: 0]
  ------------------
 1684|  20.1k|        return PJ_SUCCESS;
 1685|      0|    else
 1686|      0|        return PJ_RETURN_OS_ERROR(status);
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1687|       |
 1688|       |#else /* PJ_HAS_THREADS */
 1689|       |    pj_assert( mutex == (pj_mutex_t*)1 );
 1690|       |    return PJ_SUCCESS;
 1691|       |#endif
 1692|  20.1k|}
pj_mutex_destroy:
 1743|     87|{
 1744|     87|    enum { RETRY = 4 };
 1745|     87|    int status = 0;
 1746|     87|    unsigned retry;
 1747|       |
 1748|     87|    PJ_CHECK_STACK();
 1749|     87|    PJ_ASSERT_RETURN(mutex, PJ_EINVAL);
  ------------------
  |  |   97|     87|            do { \
  |  |   98|     87|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 87]
  |  |  ------------------
  |  |   99|     87|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 87]
  |  |  ------------------
  ------------------
  |  Branch (1749:5): [True: 0, False: 0]
  |  Branch (1749:5): [True: 0, False: 0]
  ------------------
 1750|       |
 1751|     87|#if PJ_HAS_THREADS
 1752|     87|    PJ_LOG(6,(mutex->obj_name, "Mutex destroyed by thread %s",
  ------------------
  |  |  106|     87|#define PJ_LOG(level,arg)       do { \
  |  |  107|     87|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    174|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 87]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|     87|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 87]
  |  |  ------------------
  ------------------
 1753|     87|                               pj_thread_this()->obj_name));
 1754|       |
 1755|     87|    for (retry=0; retry<RETRY; ++retry) {
  ------------------
  |  Branch (1755:19): [True: 87, False: 0]
  ------------------
 1756|     87|        status = pthread_mutex_destroy( &mutex->mutex );
 1757|     87|        if (status == PJ_SUCCESS)
  ------------------
  |  Branch (1757:13): [True: 87, False: 0]
  ------------------
 1758|     87|            break;
 1759|      0|        else if (retry<RETRY-1 && status == EBUSY)
  ------------------
  |  Branch (1759:18): [True: 0, False: 0]
  |  Branch (1759:35): [True: 0, False: 0]
  ------------------
 1760|      0|            pthread_mutex_unlock(&mutex->mutex);
 1761|     87|    }
 1762|       |
 1763|     87|    if (status == 0)
  ------------------
  |  Branch (1763:9): [True: 87, False: 0]
  ------------------
 1764|     87|        return PJ_SUCCESS;
 1765|      0|    else {
 1766|      0|        return PJ_RETURN_OS_ERROR(status);
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1767|      0|    }
 1768|       |#else
 1769|       |    pj_assert( mutex == (pj_mutex_t*)1 );
 1770|       |    status = PJ_SUCCESS;
 1771|       |    return status;
 1772|       |#endif
 1773|     87|}
pj_rwmutex_create:
 1805|      1|{
 1806|      1|    pj_rwmutex_t *rwm;
 1807|      1|    pj_status_t status;
 1808|       |
 1809|      1|    PJ_UNUSED_ARG(name);
  ------------------
  |  | 1537|      1|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1810|       |
 1811|      1|    rwm = PJ_POOL_ALLOC_T(pool, pj_rwmutex_t);
  ------------------
  |  |  569|      1|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1812|      1|    PJ_ASSERT_RETURN(rwm, PJ_ENOMEM);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (1812:5): [True: 0, False: 0]
  |  Branch (1812:5): [True: 0, False: 0]
  ------------------
 1813|       |
 1814|      1|    status = pthread_rwlock_init(&rwm->rwlock, NULL);
 1815|      1|    if (status != 0)
  ------------------
  |  Branch (1815:9): [True: 0, False: 1]
  ------------------
 1816|      0|        return PJ_RETURN_OS_ERROR(status);
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1817|       |
 1818|      1|    *p_mutex = rwm;
 1819|      1|    return PJ_SUCCESS;
 1820|      1|}
pj_rwmutex_lock_write:
 1842|      5|{
 1843|      5|    pj_status_t status;
 1844|       |
 1845|      5|    status = pthread_rwlock_wrlock(&mutex->rwlock);
 1846|      5|    if (status != 0)
  ------------------
  |  Branch (1846:9): [True: 0, False: 5]
  ------------------
 1847|      0|        return PJ_RETURN_OS_ERROR(status);
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1848|       |
 1849|      5|    return PJ_SUCCESS;
 1850|      5|}
pj_rwmutex_unlock_write:
 1866|      5|{
 1867|      5|    pj_status_t status;
 1868|       |
 1869|      5|    status = pthread_rwlock_unlock(&mutex->rwlock);
 1870|      5|    if (status != 0)
  ------------------
  |  Branch (1870:9): [True: 0, False: 5]
  ------------------
 1871|      0|        return PJ_RETURN_OS_ERROR(status);
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1872|       |
 1873|      5|    return PJ_SUCCESS;
 1874|      5|}
os_core_unix.c:create_thread:
  779|      1|{
  780|      1|    pthread_attr_t thread_attr;
  781|      1|    int rc;
  782|      1|    const char *ch;
  783|       |
  784|      1|    PJ_UNUSED_ARG(stack_addr);
  ------------------
  |  | 1537|      1|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  785|       |
  786|      1|    PJ_CHECK_STACK();
  787|      1|    PJ_ASSERT_RETURN(proc && rec, PJ_EINVAL);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      2|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (787:5): [True: 0, False: 0]
  |  Branch (787:5): [True: 0, False: 0]
  |  Branch (787:5): [True: 0, False: 0]
  |  Branch (787:5): [True: 0, False: 0]
  ------------------
  788|       |
  789|       |    /* Set name. */
  790|      1|    if (!thread_name)
  ------------------
  |  Branch (790:9): [True: 0, False: 1]
  ------------------
  791|      0|        thread_name = "thr%p";
  792|       |
  793|      1|    ch = pj_ansi_strchr(thread_name, '%');
  ------------------
  |  |   92|      1|#define pj_ansi_strchr          strchr
  ------------------
  794|      1|    if (ch && *(ch+1) == 'p') {
  ------------------
  |  Branch (794:9): [True: 0, False: 1]
  |  Branch (794:15): [True: 0, False: 0]
  ------------------
  795|      0|        pj_ansi_snprintf(rec->obj_name, PJ_MAX_OBJ_NAME, thread_name, rec);
  ------------------
  |  |  114|      0|#define pj_ansi_snprintf        snprintf
  ------------------
                      pj_ansi_snprintf(rec->obj_name, PJ_MAX_OBJ_NAME, thread_name, rec);
  ------------------
  |  |  320|      0|#define PJ_MAX_OBJ_NAME 32
  ------------------
  796|      1|    } else {
  797|      1|        pj_ansi_strxcpy(rec->obj_name, thread_name, PJ_MAX_OBJ_NAME);
  ------------------
  |  |  320|      1|#define PJ_MAX_OBJ_NAME 32
  ------------------
  798|      1|    }
  799|       |
  800|       |    /* Set default stack size */
  801|      1|    if (stack_size == 0)
  ------------------
  |  Branch (801:9): [True: 1, False: 0]
  ------------------
  802|      1|        stack_size = PJ_THREAD_DEFAULT_STACK_SIZE;
  ------------------
  |  |  623|      1|#  define PJ_THREAD_DEFAULT_STACK_SIZE    8192
  ------------------
  803|       |
  804|       |#if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0
  805|       |    rec->stk_size = stack_size;
  806|       |    rec->stk_max_usage = 0;
  807|       |#endif
  808|       |
  809|       |    /* Init thread attributes */
  810|      1|    pthread_attr_init(&thread_attr);
  811|       |
  812|       |#if defined(PJ_THREAD_SET_STACK_SIZE) && PJ_THREAD_SET_STACK_SIZE!=0
  813|       |    /* Set thread's stack size */
  814|       |    rc = pthread_attr_setstacksize(&thread_attr, stack_size);
  815|       |    if (rc != 0) {
  816|       |        pthread_attr_destroy(&thread_attr);
  817|       |        return PJ_RETURN_OS_ERROR(rc);
  818|       |    }
  819|       |#endif  /* PJ_THREAD_SET_STACK_SIZE */
  820|       |
  821|       |
  822|       |#if defined(PJ_THREAD_ALLOCATE_STACK) && PJ_THREAD_ALLOCATE_STACK!=0
  823|       |    /* Allocate memory for the stack */
  824|       |    PJ_ASSERT_RETURN(stack_addr, PJ_EINVAL);
  825|       |
  826|       |    rc = pthread_attr_setstackaddr(&thread_attr, stack_addr);
  827|       |    if (rc != 0) {
  828|       |        pthread_attr_destroy(&thread_attr);
  829|       |        return PJ_RETURN_OS_ERROR(rc);
  830|       |    }
  831|       |#endif  /* PJ_THREAD_ALLOCATE_STACK */
  832|       |
  833|       |
  834|       |    /* Create the thread. */
  835|      1|    rec->proc = proc;
  836|      1|    rec->arg = arg;
  837|      1|    rc = pthread_create( &rec->thread, &thread_attr, &thread_main, rec);
  838|      1|    if (rc != 0) {
  ------------------
  |  Branch (838:9): [True: 0, False: 1]
  ------------------
  839|      0|        pthread_attr_destroy(&thread_attr);
  840|      0|        return PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  841|      0|    }
  842|       |
  843|       |    /* Destroy thread attributes */
  844|      1|    pthread_attr_destroy(&thread_attr);
  845|       |
  846|      1|    PJ_LOG(6, (rec->obj_name, "Thread created"));
  ------------------
  |  |  106|      1|#define PJ_LOG(level,arg)       do { \
  |  |  107|      1|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      2|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 1]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      1|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 1]
  |  |  ------------------
  ------------------
  847|      1|    return PJ_SUCCESS;
  848|       |
  849|      1|}
os_core_unix.c:thread_main:
  736|      1|{
  737|      1|    pj_thread_t *rec = (pj_thread_t*)param;
  738|      1|    void *result;
  739|      1|    pj_status_t rc;
  740|       |
  741|       |#if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0
  742|       |    rec->stk_start = (char*)&rec;
  743|       |#endif
  744|       |
  745|       |    /* Store the thread. */
  746|      1|    rec->thread = pthread_self();
  747|       |
  748|       |    /* Set current thread id. */
  749|      1|    rc = pj_thread_local_set(thread_tls_id, rec);
  750|      1|    if (rc != PJ_SUCCESS) {
  ------------------
  |  Branch (750:9): [True: 0, False: 1]
  ------------------
  751|      0|        pj_assert(!"Thread TLS ID is not set (pj_init() error?)");
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (751:9): [Folded, False: 0]
  |  Branch (751:9): [Folded, False: 0]
  ------------------
  752|      0|    }
  753|       |
  754|       |    /* Check if suspension is required. */
  755|      1|    if (rec->suspended_mutex) {
  ------------------
  |  Branch (755:9): [True: 1, False: 0]
  ------------------
  756|      1|        pj_mutex_lock(rec->suspended_mutex);
  757|      1|        pj_mutex_unlock(rec->suspended_mutex);
  758|      1|    }
  759|       |
  760|      1|    PJ_LOG(6,(rec->obj_name, "Thread started"));
  ------------------
  |  |  106|      1|#define PJ_LOG(level,arg)       do { \
  |  |  107|      1|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      2|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 1]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      1|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 1]
  |  |  ------------------
  ------------------
  761|       |
  762|      1|    set_thread_display_name(rec->obj_name);
  763|       |
  764|       |    /* Call user's entry! */
  765|      1|    result = (void*)(long)(*rec->proc)(rec->arg);
  766|       |
  767|       |    /* Done. */
  768|      1|    PJ_LOG(6,(rec->obj_name, "Thread quitting"));
  ------------------
  |  |  106|      1|#define PJ_LOG(level,arg)       do { \
  |  |  107|      1|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      2|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 1]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      1|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 1]
  |  |  ------------------
  ------------------
  769|       |
  770|      1|    return result;
  771|      1|}
os_core_unix.c:set_thread_display_name:
  704|      1|{
  705|      1|#if (defined(PJ_LINUX) && PJ_LINUX != 0) || \
  706|      1|    (defined(PJ_ANDROID) && PJ_ANDROID != 0)
  707|      1|    char xname[16];
  708|       |    // On linux, thread display name length is restricted to 16 (include '\0')
  709|      1|    if (pj_ansi_strlen(name) >= 16) {
  ------------------
  |  |   69|      1|#define pj_ansi_strlen          strlen
  ------------------
  |  Branch (709:9): [True: 0, False: 1]
  ------------------
  710|      0|        pj_memcpy(xname, name, 15);
  711|      0|        xname[15] = '\0';
  712|      0|        name = xname;
  713|      0|    }
  714|      1|#endif
  715|       |
  716|      1|#if defined(PJ_HAS_PTHREAD_SETNAME_NP) && PJ_HAS_PTHREAD_SETNAME_NP != 0
  717|       |#   if defined(PJ_DARWINOS) && PJ_DARWINOS != 0
  718|       |    pthread_setname_np(name);
  719|       |#   else
  720|      1|    pthread_setname_np(pthread_self(), name);
  721|      1|#   endif
  722|       |#elif defined(PJ_HAS_PTHREAD_SET_NAME_NP) && PJ_HAS_PTHREAD_SET_NAME_NP != 0
  723|       |    pthread_set_name_np(pthread_self(), name);
  724|       |#else
  725|       |// #   warning "OS does not support set thread display name"
  726|       |    PJ_UNUSED_ARG(name);
  727|       |#endif
  728|      1|}
os_core_unix.c:init_mutex:
 1473|    163|{
 1474|    163|#if PJ_HAS_THREADS
 1475|    163|    pthread_mutexattr_t attr;
 1476|    163|    int rc;
 1477|       |
 1478|    163|    PJ_CHECK_STACK();
 1479|       |
 1480|    163|    rc = pthread_mutexattr_init(&attr);
 1481|    163|    if (rc != 0)
  ------------------
  |  Branch (1481:9): [True: 0, False: 163]
  ------------------
 1482|      0|        return PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1483|       |
 1484|    163|    if (type == PJ_MUTEX_SIMPLE) {
  ------------------
  |  Branch (1484:9): [True: 4, False: 159]
  ------------------
 1485|      4|#if (defined(PJ_LINUX) && PJ_LINUX!=0) || \
 1486|      4|    defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE)
 1487|      4|        rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
 1488|       |#elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \
 1489|       |       defined(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE)
 1490|       |        /* Nothing to do, default is simple */
 1491|       |#else
 1492|       |        rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
 1493|       |#endif
 1494|    159|    } else {
 1495|    159|#if (defined(PJ_LINUX) && PJ_LINUX!=0) || \
 1496|    159|     defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE)
 1497|    159|        rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
 1498|       |#elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \
 1499|       |       defined(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE)
 1500|       |        // Phil Torre <ptorre@zetron.com>:
 1501|       |        // The RTEMS implementation of POSIX mutexes doesn't include
 1502|       |        // pthread_mutexattr_settype(), so what follows is a hack
 1503|       |        // until I get RTEMS patched to support the set/get functions.
 1504|       |        //
 1505|       |        // More info:
 1506|       |        //   newlib's pthread also lacks pthread_mutexattr_settype(),
 1507|       |        //   but it seems to have mutexattr.recursive.
 1508|       |        PJ_TODO(FIX_RTEMS_RECURSIVE_MUTEX_TYPE)
 1509|       |        attr.recursive = 1;
 1510|       |#else
 1511|       |        rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
 1512|       |#endif
 1513|    159|    }
 1514|       |
 1515|    163|    if (rc != 0) {
  ------------------
  |  Branch (1515:9): [True: 0, False: 163]
  ------------------
 1516|      0|        return PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1517|      0|    }
 1518|       |
 1519|    163|    rc = pthread_mutex_init(&mutex->mutex, &attr);
 1520|    163|    if (rc != 0) {
  ------------------
  |  Branch (1520:9): [True: 0, False: 163]
  ------------------
 1521|      0|        return PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1522|      0|    }
 1523|       |
 1524|    163|    rc = pthread_mutexattr_destroy(&attr);
 1525|    163|    if (rc != 0) {
  ------------------
  |  Branch (1525:9): [True: 0, False: 163]
  ------------------
 1526|      0|        pj_status_t status = PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1527|      0|        pthread_mutex_destroy(&mutex->mutex);
 1528|      0|        return status;
 1529|      0|    }
 1530|       |
 1531|    163|#if PJ_DEBUG
 1532|       |    /* Set owner. */
 1533|    163|    mutex->nesting_level = 0;
 1534|    163|    mutex->owner = NULL;
 1535|    163|    mutex->owner_name[0] = '\0';
 1536|    163|#endif
 1537|       |
 1538|       |    /* Set name. */
 1539|    163|    if (!name) {
  ------------------
  |  Branch (1539:9): [True: 66, False: 97]
  ------------------
 1540|     66|        name = "mtx%p";
 1541|     66|    }
 1542|    163|    if (strchr(name, '%')) {
  ------------------
  |  Branch (1542:9): [True: 71, False: 92]
  ------------------
 1543|     71|        pj_ansi_snprintf(mutex->obj_name, PJ_MAX_OBJ_NAME, name, mutex);
  ------------------
  |  |  114|     71|#define pj_ansi_snprintf        snprintf
  ------------------
                      pj_ansi_snprintf(mutex->obj_name, PJ_MAX_OBJ_NAME, name, mutex);
  ------------------
  |  |  320|     71|#define PJ_MAX_OBJ_NAME 32
  ------------------
 1544|     92|    } else {
 1545|     92|        pj_ansi_strxcpy(mutex->obj_name, name, PJ_MAX_OBJ_NAME);
  ------------------
  |  |  320|     92|#define PJ_MAX_OBJ_NAME 32
  ------------------
 1546|     92|    }
 1547|       |
 1548|    163|    PJ_LOG(6, (mutex->obj_name, "Mutex created"));
  ------------------
  |  |  106|    163|#define PJ_LOG(level,arg)       do { \
  |  |  107|    163|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    326|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 163]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|    163|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 163]
  |  |  ------------------
  ------------------
 1549|    163|    return PJ_SUCCESS;
 1550|       |#else /* PJ_HAS_THREADS */
 1551|       |    return PJ_SUCCESS;
 1552|       |#endif
 1553|    163|}

pj_get_os_error:
   24|    549|{
   25|    549|    return PJ_STATUS_FROM_OS(errno);
  ------------------
  |  |  334|    549|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  ------------------
  |  |  |  |  528|    549|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (334:34): [True: 549, False: 0]
  |  |  ------------------
  ------------------
   26|    549|}
pj_set_os_error:
   29|    550|{
   30|    550|    errno = PJ_STATUS_TO_OS(code);
  ------------------
  |  |  350|    550|#   define PJ_STATUS_TO_OS(e) (e == 0 ? PJ_SUCCESS : e - PJ_ERRNO_START_SYS)
  |  |  ------------------
  |  |  |  |  528|    550|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (350:32): [True: 550, False: 0]
  |  |  ------------------
  ------------------
   31|    550|}

pj_gettimeofday:
   32|    549|{
   33|    549|    struct timeval the_time;
   34|    549|    int rc;
   35|       |
   36|    549|    PJ_CHECK_STACK();
   37|       |
   38|    549|    rc = gettimeofday(&the_time, NULL);
   39|    549|    if (rc != 0)
  ------------------
  |  Branch (39:9): [True: 0, False: 549]
  ------------------
   40|      0|        return PJ_RETURN_OS_ERROR(pj_get_native_os_error());
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   41|       |
   42|    549|    p_tv->sec = the_time.tv_sec;
   43|    549|    p_tv->msec = the_time.tv_usec / 1000;
   44|    549|    return PJ_SUCCESS;
   45|    549|}

pj_get_timestamp:
  228|      1|{
  229|      1|    struct timespec tp;
  230|       |
  231|      1|    if (clock_gettime(CLOCK_MONOTONIC, &tp) != 0) {
  ------------------
  |  Branch (231:9): [True: 0, False: 1]
  ------------------
  232|      0|        return PJ_RETURN_OS_ERROR(pj_get_native_os_error());
  ------------------
  |  |  319|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (319:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  320|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  334|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (334:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  233|      0|    }
  234|       |
  235|      1|    ts->u64 = tp.tv_sec;
  236|      1|    ts->u64 *= NSEC_PER_SEC;
  ------------------
  |  |  225|      1|#define NSEC_PER_SEC    1000000000
  ------------------
  237|      1|    ts->u64 += tp.tv_nsec;
  238|       |
  239|      1|    return PJ_SUCCESS;
  240|      1|}

pj_pool_allocate_find:
   94|  6.33k|{
   95|  6.33k|    pj_pool_block *block = pool->block_list.next;
   96|  6.33k|    void *p;
   97|  6.33k|    pj_size_t block_size;
   98|  6.33k|    unsigned i = 0;
   99|       |
  100|  6.33k|    PJ_CHECK_STACK();
  101|  6.33k|    pj_assert(PJ_IS_POWER_OF_TWO(alignment));
  ------------------
  |  |   65|  6.33k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (101:5): [True: 0, False: 6.33k]
  |  Branch (101:5): [True: 0, False: 0]
  |  Branch (101:5): [True: 6.33k, False: 0]
  |  Branch (101:5): [True: 6.33k, False: 0]
  ------------------
  102|       |
  103|  27.4k|    while (block != &pool->block_list) {
  ------------------
  |  Branch (103:12): [True: 24.9k, False: 2.49k]
  ------------------
  104|  24.9k|        p = pj_pool_alloc_from_block(block, alignment, size);
  105|  24.9k|        if (p != NULL)
  ------------------
  |  Branch (105:13): [True: 1.03k, False: 23.9k]
  ------------------
  106|  1.03k|            return p;
  107|       |
  108|  23.9k|#if PJ_POOL_MAX_SEARCH_BLOCK_COUNT > 0
  109|  23.9k|        if (i >= PJ_POOL_MAX_SEARCH_BLOCK_COUNT) {
  ------------------
  |  |  559|  23.9k|#   define PJ_POOL_MAX_SEARCH_BLOCK_COUNT 5
  ------------------
  |  Branch (109:13): [True: 2.81k, False: 21.1k]
  ------------------
  110|  2.81k|            break;
  111|  2.81k|        }
  112|  21.1k|#endif
  113|       |
  114|  21.1k|        i++;
  115|  21.1k|        block = block->next;
  116|  21.1k|    }
  117|       |    /* No available space in all blocks. */
  118|       |
  119|       |    /* If pool is configured NOT to expand, return error. */
  120|  5.30k|    if (pool->increment_size == 0) {
  ------------------
  |  Branch (120:9): [True: 0, False: 5.30k]
  ------------------
  121|      0|        LOG((pool->obj_name, "Can't expand pool to allocate %lu bytes "
  ------------------
  |  |   33|      0|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [Folded, False: 0]
  |  |  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|      0|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  122|      0|             "(used=%lu, cap=%lu)",
  123|      0|             (unsigned long)size, (unsigned long)pj_pool_get_used_size(pool),
  124|      0|             (unsigned long)pool->capacity));
  125|      0|        (*pool->callback)(pool, size);
  126|      0|        return NULL;
  127|      0|    }
  128|       |
  129|       |    /* If pool is configured to expand, but the increment size
  130|       |     * is less than the required size, expand the pool by multiple
  131|       |     * increment size. Also count the size wasted due to aligning
  132|       |     * the block.
  133|       |     */
  134|  5.30k|    if (pool->increment_size < 
  ------------------
  |  Branch (134:9): [True: 40, False: 5.26k]
  ------------------
  135|  5.30k|            sizeof(pj_pool_block)+ /*block header, itself may be unaligned*/
  136|  5.30k|            alignment-1 + /* gap [0:alignment-1] to align first allocation*/
  137|  5.30k|            size)                  /* allocation size (NOT aligned!)      */
  138|     40|    {
  139|     40|        pj_size_t count;
  140|     40|        count = (pool->increment_size + 
  141|     40|                 sizeof(pj_pool_block) + alignment-1 + size) /
  142|     40|                pool->increment_size;
  143|     40|        block_size = count * pool->increment_size;
  144|  5.26k|    } else {
  145|  5.26k|        block_size = pool->increment_size;
  146|  5.26k|    }
  147|       |
  148|  5.30k|    LOG((pool->obj_name, 
  ------------------
  |  |   33|  5.30k|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|  5.30k|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|  5.30k|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  417|  10.6k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [Folded, False: 5.30k]
  |  |  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|  5.30k|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded, False: 5.30k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  149|  5.30k|         "%lu bytes requested, resizing pool by %lu bytes (used=%lu, cap=%lu)",
  150|  5.30k|         (unsigned long)size, (unsigned long)block_size,
  151|  5.30k|         (unsigned long)pj_pool_get_used_size(pool),
  152|  5.30k|         (unsigned long)pool->capacity));
  153|       |
  154|  5.30k|    block = pj_pool_create_block(pool, block_size);
  155|  5.30k|    if (!block)
  ------------------
  |  Branch (155:9): [True: 0, False: 5.30k]
  ------------------
  156|      0|        return NULL;
  157|       |
  158|  5.30k|    p = pj_pool_alloc_from_block(block, alignment, size);
  159|  5.30k|    pj_assert(p != NULL);
  ------------------
  |  |   65|  5.30k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (159:5): [True: 0, False: 5.30k]
  |  Branch (159:5): [True: 5.30k, False: 0]
  ------------------
  160|  5.30k|#if PJ_DEBUG
  161|  5.30k|    if (p == NULL) {
  ------------------
  |  Branch (161:9): [True: 0, False: 5.30k]
  ------------------
  162|      0|        PJ_UNUSED_ARG(p);
  ------------------
  |  | 1537|      0|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  163|      0|    }
  164|  5.30k|#endif
  165|  5.30k|    return p;
  166|  5.30k|}
pj_pool_init_int:
  176|  8.04k|{
  177|       |
  178|  8.04k|    PJ_CHECK_STACK();
  179|  8.04k|    pj_assert(!alignment || PJ_IS_POWER_OF_TWO(alignment));
  ------------------
  |  |   65|  8.04k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (179:5): [True: 0, False: 0]
  |  Branch (179:5): [True: 0, False: 0]
  |  Branch (179:5): [True: 8.04k, False: 0]
  |  Branch (179:5): [True: 1, False: 0]
  |  Branch (179:5): [True: 1, False: 0]
  |  Branch (179:5): [True: 8.04k, False: 1]
  ------------------
  180|       |
  181|  8.04k|    pool->increment_size = increment_size;
  182|  8.04k|    pool->callback = callback;
  183|  8.04k|    pool->alignment = !alignment ? PJ_POOL_ALIGNMENT : alignment;
  ------------------
  |  |  182|  8.04k|#define PJ_POOL_ALIGNMENT 8
  ------------------
  |  Branch (183:23): [True: 8.04k, False: 1]
  ------------------
  184|       |
  185|  8.04k|    if (name) {
  ------------------
  |  Branch (185:9): [True: 1.94k, False: 6.10k]
  ------------------
  186|  1.94k|        char *p = pj_ansi_strchr(name, '%');
  ------------------
  |  |   92|  1.94k|#define pj_ansi_strchr          strchr
  ------------------
  187|  1.94k|        if (p && *(p+1)=='p' && *(p+2)=='\0') {
  ------------------
  |  Branch (187:13): [True: 1.94k, False: 4]
  |  Branch (187:18): [True: 1.94k, False: 0]
  |  Branch (187:33): [True: 1.94k, False: 0]
  ------------------
  188|       |            /* Special name with "%p" suffix */
  189|  1.94k|            pj_ansi_snprintf(pool->obj_name, sizeof(pool->obj_name), 
  ------------------
  |  |  114|  1.94k|#define pj_ansi_snprintf        snprintf
  ------------------
  190|  1.94k|                             name, pool);
  191|  1.94k|        } else {
  192|      4|            pj_ansi_strxcpy(pool->obj_name, name, PJ_MAX_OBJ_NAME);
  ------------------
  |  |  320|      4|#define PJ_MAX_OBJ_NAME 32
  ------------------
  193|      4|        }
  194|  6.10k|    } else {
  195|  6.10k|        pool->obj_name[0] = '\0';
  196|  6.10k|    }
  197|  8.04k|}
pj_pool_create_int:
  207|    100|{
  208|    100|    pj_pool_t *pool;
  209|    100|    pj_pool_block *block;
  210|    100|    pj_uint8_t *buffer;
  211|       |
  212|    100|    PJ_CHECK_STACK();
  213|       |
  214|       |    /* Size must be at least sizeof(pj_pool)+sizeof(pj_pool_block) */
  215|    100|    PJ_ASSERT_RETURN(initial_size >= sizeof(pj_pool_t)+sizeof(pj_pool_block),
  ------------------
  |  |   97|    100|            do { \
  |  |   98|    100|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 100]
  |  |  ------------------
  |  |   99|    100|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 100]
  |  |  ------------------
  ------------------
  |  Branch (215:5): [True: 0, False: 0]
  |  Branch (215:5): [True: 0, False: 0]
  ------------------
  216|    100|                     NULL);
  217|    100|    PJ_ASSERT_RETURN(!alignment || PJ_IS_POWER_OF_TWO(alignment), NULL);
  ------------------
  |  |   97|    100|            do { \
  |  |   98|    103|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 99, False: 1]
  |  |  ------------------
  |  |   99|    100|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 100]
  |  |  ------------------
  ------------------
  |  Branch (217:5): [True: 0, False: 0]
  |  Branch (217:5): [True: 0, False: 0]
  |  Branch (217:5): [True: 0, False: 0]
  |  Branch (217:5): [True: 0, False: 0]
  |  Branch (217:5): [True: 0, False: 0]
  |  Branch (217:5): [True: 0, False: 0]
  ------------------
  218|       |
  219|       |    /* If callback is NULL, set calback from the policy */
  220|    100|    if (callback == NULL)
  ------------------
  |  Branch (220:9): [True: 0, False: 100]
  ------------------
  221|      0|        callback = f->policy.callback;
  222|       |
  223|       |    /* Allocate initial block */
  224|    100|    buffer = (pj_uint8_t*) (*f->policy.block_alloc)(f, initial_size);
  225|    100|    if (!buffer)
  ------------------
  |  Branch (225:9): [True: 0, False: 100]
  ------------------
  226|      0|        return NULL;
  227|       |
  228|       |    /* Set pool administrative data. */
  229|    100|    pool = (pj_pool_t*)buffer;
  230|    100|    pj_bzero(pool, sizeof(*pool));
  231|       |
  232|    100|    pj_list_init(&pool->block_list);
  233|    100|    pool->factory = f;
  234|       |
  235|       |    /* Create the first block from the memory. */
  236|    100|    block = (pj_pool_block*) (buffer + sizeof(*pool));
  237|    100|    block->buf = ((unsigned char*)block) + sizeof(pj_pool_block);
  238|    100|    block->end = buffer + initial_size;
  239|       |
  240|       |    /* Set the start pointer, unaligned! */
  241|    100|    block->cur = block->buf;
  242|       |
  243|    100|    pj_list_insert_after(&pool->block_list, block);
  244|       |
  245|    100|    pj_pool_init_int(pool, name, increment_size, alignment, callback);
  246|       |
  247|       |    /* Pool initial capacity and used size */
  248|    100|    pool->capacity = initial_size;
  249|       |
  250|    100|    LOG((pool->obj_name, "pool created, size=%lu",
  ------------------
  |  |   33|    100|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|    100|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|    100|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  417|    200|#  define PJ_LOG_MAX_LEVEL   5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [Folded, False: 100]
  |  |  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|    100|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded, False: 100]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  251|    100|                         (unsigned long)pool->capacity));
  252|    100|    return pool;
  253|    100|}
pj_pool_reset:
  295|  7.97k|{
  296|  7.97k|    LOG((pool->obj_name, "reset(): cap=%lu, used=%lu(%lu%%)", 
  ------------------
  |  |   33|  7.97k|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|  7.97k|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|  7.97k|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  417|  15.9k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [Folded, False: 7.97k]
  |  |  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|  7.97k|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded, False: 7.97k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  297|  7.97k|        (unsigned long)pool->capacity,
  298|  7.97k|        (unsigned long)pj_pool_get_used_size(pool), 
  299|  7.97k|        (unsigned long)(pj_pool_get_used_size(pool)*100/pool->capacity)));
  300|       |
  301|  7.97k|    reset_pool(pool);
  302|  7.97k|}
pj_pool_destroy_int:
  308|     63|{
  309|     63|    pj_size_t initial_size;
  310|       |
  311|     63|    LOG((pool->obj_name, "destroy(): cap=%lu, used=%lu(%lu%%), block0=%p-%p", 
  ------------------
  |  |   33|     63|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|     63|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|     63|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  417|    126|#  define PJ_LOG_MAX_LEVEL   5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [Folded, False: 63]
  |  |  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|     63|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded, False: 63]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  312|     63|        (unsigned long)pool->capacity,
  313|     63|        (unsigned long)pj_pool_get_used_size(pool),
  314|     63|        (unsigned long)(pj_pool_get_used_size(pool)*100/pool->capacity),
  315|     63|        ((pj_pool_block*)pool->block_list.next)->buf, 
  316|     63|        ((pj_pool_block*)pool->block_list.next)->end));
  317|       |
  318|     63|    reset_pool(pool);
  319|     63|    initial_size = ((pj_pool_block*)pool->block_list.next)->end - 
  320|     63|                   (unsigned char*)pool;
  321|     63|    if (pool->factory->policy.block_free)
  ------------------
  |  Branch (321:9): [True: 63, False: 0]
  ------------------
  322|     63|        (*pool->factory->policy.block_free)(pool->factory, pool, initial_size);
  323|     63|}
pool.c:pj_pool_create_block:
   48|  5.30k|{
   49|  5.30k|    pj_pool_block *block;
   50|       |
   51|  5.30k|    PJ_CHECK_STACK();
   52|  5.30k|    pj_assert(size >= sizeof(pj_pool_block));
  ------------------
  |  |   65|  5.30k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (52:5): [True: 0, False: 5.30k]
  |  Branch (52:5): [True: 5.30k, False: 0]
  ------------------
   53|       |
   54|  5.30k|    LOG((pool->obj_name, "create_block(sz=%lu), cur.cap=%lu, cur.used=%lu", 
  ------------------
  |  |   33|  5.30k|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|  5.30k|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|  5.30k|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  417|  10.6k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [Folded, False: 5.30k]
  |  |  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|  5.30k|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded, False: 5.30k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   55|  5.30k|         (unsigned long)size, (unsigned long)pool->capacity,
   56|  5.30k|         (unsigned long)pj_pool_get_used_size(pool)));
   57|       |
   58|       |    /* Request memory from allocator. */
   59|  5.30k|    block = (pj_pool_block*) 
   60|  5.30k|        (*pool->factory->policy.block_alloc)(pool->factory, size);
   61|  5.30k|    if (block == NULL) {
  ------------------
  |  Branch (61:9): [True: 0, False: 5.30k]
  ------------------
   62|      0|        (*pool->callback)(pool, size);
   63|      0|        return NULL;
   64|      0|    }
   65|       |
   66|       |    /* Add capacity. */
   67|  5.30k|    pool->capacity += size;
   68|       |
   69|       |    /* Set start and end of buffer. */
   70|  5.30k|    block->buf = ((unsigned char*)block) + sizeof(pj_pool_block);
   71|  5.30k|    block->end = ((unsigned char*)block) + size;
   72|       |
   73|       |    /* Set the start pointer, unaligned! */
   74|  5.30k|    block->cur = block->buf;
   75|       |
   76|       |    /* Insert in the front of the list. */
   77|  5.30k|    pj_list_insert_after(&pool->block_list, block);
   78|       |
   79|  5.30k|    LOG((pool->obj_name," block created, buffer=%p-%p",block->buf, block->end));
  ------------------
  |  |   33|  5.30k|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|  5.30k|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|  5.30k|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  417|  10.6k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [Folded, False: 5.30k]
  |  |  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|  5.30k|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded, False: 5.30k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   80|       |
   81|  5.30k|    return block;
   82|  5.30k|}
pool.c:reset_pool:
  261|  8.03k|{
  262|  8.03k|    pj_pool_block *block;
  263|       |
  264|  8.03k|    PJ_CHECK_STACK();
  265|       |
  266|  8.03k|    block = pool->block_list.prev;
  267|  8.03k|    if (block == &pool->block_list)
  ------------------
  |  Branch (267:9): [True: 0, False: 8.03k]
  ------------------
  268|      0|        return;
  269|       |
  270|       |    /* Skip the first block because it is occupying the same memory
  271|       |       as the pool itself.
  272|       |    */
  273|  8.03k|    block = block->prev;
  274|       |    
  275|  13.3k|    while (block != &pool->block_list) {
  ------------------
  |  Branch (275:12): [True: 5.28k, False: 8.03k]
  ------------------
  276|  5.28k|        pj_pool_block *prev = block->prev;
  277|  5.28k|        pj_list_erase(block);
  278|  5.28k|        (*pool->factory->policy.block_free)(pool->factory, block, 
  279|  5.28k|                                            block->end - (unsigned char*)block);
  280|  5.28k|        block = prev;
  281|  5.28k|    }
  282|       |
  283|  8.03k|    block = pool->block_list.next;
  284|       |
  285|       |    /* Set the start pointer, unaligned! */
  286|  8.03k|    block->cur = block->buf;
  287|       |
  288|  8.03k|    pool->capacity = block->end - (unsigned char*)pool;
  289|  8.03k|}

pj_pool_create_on_buf:
   82|      1|{
   83|      1|#if PJ_HAS_POOL_ALT_API == 0
   84|      1|    struct creation_param param;
   85|      1|    pj_size_t align_diff;
   86|       |
   87|      1|    PJ_ASSERT_RETURN(buf && size, NULL);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      2|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (87:5): [True: 0, False: 0]
  |  Branch (87:5): [True: 0, False: 0]
  |  Branch (87:5): [True: 0, False: 0]
  |  Branch (87:5): [True: 0, False: 0]
  ------------------
   88|       |
   89|      1|    if (!is_initialized) {
  ------------------
  |  Branch (89:9): [True: 1, False: 0]
  ------------------
   90|      1|        if (pool_buf_initialize() != PJ_SUCCESS)
  ------------------
  |  Branch (90:13): [True: 0, False: 1]
  ------------------
   91|      0|            return NULL;
   92|      1|        is_initialized = 1;
   93|      1|    }
   94|       |
   95|       |    /* Check and align buffer */
   96|      1|    align_diff = (pj_size_t)buf;
   97|      1|    if (align_diff & (PJ_POOL_ALIGNMENT-1)) {
  ------------------
  |  |  182|      1|#define PJ_POOL_ALIGNMENT 8
  ------------------
  |  Branch (97:9): [True: 0, False: 1]
  ------------------
   98|      0|        align_diff &= (PJ_POOL_ALIGNMENT-1);
  ------------------
  |  |  182|      0|#define PJ_POOL_ALIGNMENT 8
  ------------------
   99|      0|        buf = (void*) (((char*)buf) + align_diff);
  100|      0|        size -= align_diff;
  101|      0|    }
  102|       |
  103|      1|    param.stack_buf = buf;
  104|      1|    param.size = size;
  105|      1|    pj_thread_local_set(tls, &param);
  106|       |
  107|      1|    return pj_pool_create_int(&stack_based_factory, name, size, 0, 
  108|      1|                              PJ_POOL_ALIGNMENT,
  ------------------
  |  |  182|      1|#define PJ_POOL_ALIGNMENT 8
  ------------------
  109|      1|                              pj_pool_factory_default_policy.callback);
  110|       |#else
  111|       |    PJ_UNUSED_ARG(buf);
  112|       |    PJ_UNUSED_ARG(pool_buf_initialize);
  113|       |    return pj_pool_create(NULL, name, size, size, NULL);
  114|       |#endif
  115|      1|}
pool_buf.c:pool_buf_initialize:
   46|      1|{
   47|      1|    pj_atexit(&pool_buf_cleanup);
   48|       |
   49|      1|    stack_based_factory.policy.block_alloc = &stack_alloc;
   50|      1|    return pj_thread_local_alloc(&tls);
   51|      1|}
pool_buf.c:stack_alloc:
   54|      1|{
   55|      1|    struct creation_param *param;
   56|      1|    void *buf;
   57|       |
   58|      1|    PJ_UNUSED_ARG(factory);
  ------------------
  |  | 1537|      1|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
   59|       |
   60|      1|    param = (struct creation_param*) pj_thread_local_get(tls);
   61|      1|    if (param == NULL) {
  ------------------
  |  Branch (61:9): [True: 0, False: 1]
  ------------------
   62|       |        /* Don't assert(), this is normal no-memory situation */
   63|      0|        return NULL;
   64|      0|    }
   65|       |
   66|      1|    pj_thread_local_set(tls, NULL);
   67|       |
   68|      1|    PJ_ASSERT_RETURN(size <= param->size, NULL);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (68:5): [True: 0, False: 0]
  |  Branch (68:5): [True: 0, False: 0]
  ------------------
   69|       |
   70|      1|    buf = param->stack_buf;
   71|       |
   72|       |    /* Prevent the buffer from being reused */
   73|      1|    param->stack_buf = NULL;
   74|       |
   75|      1|    return buf;
   76|      1|}

pj_caching_pool_init:
   57|      1|{
   58|      1|    int i;
   59|      1|    pj_pool_t *pool;
   60|      1|    pj_status_t status;
   61|       |
   62|      1|    PJ_CHECK_STACK();
   63|       |
   64|      1|    pj_bzero(cp, sizeof(*cp));
   65|       |    
   66|      1|    cp->max_capacity = max_capacity;
   67|      1|    pj_list_init(&cp->used_list);
   68|     17|    for (i=0; i<PJ_CACHING_POOL_ARRAY_SIZE; ++i)
  ------------------
  |  |  889|     17|#define PJ_CACHING_POOL_ARRAY_SIZE      16
  ------------------
  |  Branch (68:15): [True: 16, False: 1]
  ------------------
   69|     16|        pj_list_init(&cp->free_list[i]);
   70|       |
   71|      1|    if (policy == NULL) {
  ------------------
  |  Branch (71:9): [True: 0, False: 1]
  ------------------
   72|      0|        policy = &pj_pool_factory_default_policy;
   73|      0|    }
   74|       |    
   75|      1|    pj_memcpy(&cp->factory.policy, policy, sizeof(pj_pool_factory_policy));
   76|      1|    cp->factory.create_pool = &cpool_create_pool;
   77|      1|    cp->factory.release_pool = &cpool_release_pool;
   78|      1|    cp->factory.dump_status = &cpool_dump_status;
   79|       |
   80|       |    /* Deprecated, these callbacks are only used for updating cp.used_size &
   81|       |     * cp.peak_used_size which are no longer used.
   82|       |     */
   83|       |    //cp->factory.on_block_alloc = &cpool_on_block_alloc;
   84|       |    //cp->factory.on_block_free = &cpool_on_block_free;
   85|      1|    PJ_UNUSED_ARG(cpool_on_block_alloc);
  ------------------
  |  | 1537|      1|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
   86|      1|    PJ_UNUSED_ARG(cpool_on_block_free);
  ------------------
  |  | 1537|      1|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
   87|       |
   88|      1|    pool = pj_pool_create_on_buf("cachingpool", cp->pool_buf, sizeof(cp->pool_buf));
   89|      1|    status = pj_lock_create_simple_mutex(pool, "cachingpool", &cp->lock);
   90|       |    /* This mostly serves to silent coverity warning about unchecked 
   91|       |     * return value. There's not much we can do if it fails. */
   92|      1|    PJ_ASSERT_ON_FAIL(status==PJ_SUCCESS, return);
  ------------------
  |  |  111|      1|            { \
  |  |  112|      1|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   65|      1|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  113|      1|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (113:21): [True: 0, False: 1]
  |  |  ------------------
  |  |  114|      1|            }
  ------------------
  |  Branch (92:5): [True: 0, False: 1]
  |  Branch (92:5): [True: 1, False: 0]
  ------------------
   93|      1|}
pool_caching.c:cpool_create_pool:
  138|  8.04k|{
  139|  8.04k|    pj_caching_pool *cp = (pj_caching_pool*)pf;
  140|  8.04k|    pj_pool_t *pool;
  141|  8.04k|    int idx;
  142|       |
  143|  8.04k|    PJ_CHECK_STACK();
  144|       |
  145|  8.04k|    pj_lock_acquire(cp->lock);
  146|       |
  147|       |    /* Use pool factory's policy when callback is NULL */
  148|  8.04k|    if (callback == NULL) {
  ------------------
  |  Branch (148:9): [True: 88, False: 7.95k]
  ------------------
  149|     88|        callback = pf->policy.callback;
  150|     88|    }
  151|       |
  152|       |    /* Search the suitable size for the pool. 
  153|       |     * We'll just do linear search to the size array, as the array size itself
  154|       |     * is only a few elements. Binary search I suspect will be less efficient
  155|       |     * for this purpose.
  156|       |     */
  157|  8.04k|    if (initial_size <= pool_sizes[START_SIZE]) {
  ------------------
  |  |   51|  8.04k|#define START_SIZE  5
  ------------------
  |  Branch (157:9): [True: 8.04k, False: 1]
  ------------------
  158|  8.04k|        for (idx=START_SIZE-1; 
  ------------------
  |  |   51|  8.04k|#define START_SIZE  5
  ------------------
  159|  12.5k|             idx >= 0 && pool_sizes[idx] >= initial_size;
  ------------------
  |  Branch (159:14): [True: 12.5k, False: 0]
  |  Branch (159:26): [True: 4.53k, False: 8.04k]
  ------------------
  160|  8.04k|             --idx)
  161|  4.53k|            ;
  162|  8.04k|        ++idx;
  163|  8.04k|    } else {
  164|      1|        for (idx=START_SIZE+1; 
  ------------------
  |  |   51|      1|#define START_SIZE  5
  ------------------
  165|      2|             idx < PJ_CACHING_POOL_ARRAY_SIZE && 
  ------------------
  |  |  889|      4|#define PJ_CACHING_POOL_ARRAY_SIZE      16
  ------------------
  |  Branch (165:14): [True: 2, False: 0]
  ------------------
  166|      2|                  pool_sizes[idx] < initial_size;
  ------------------
  |  Branch (166:19): [True: 1, False: 1]
  ------------------
  167|      1|             ++idx)
  168|      1|            ;
  169|      1|    }
  170|       |
  171|       |    /* Check whether there's a pool in the list. */
  172|  8.04k|    if (idx==PJ_CACHING_POOL_ARRAY_SIZE || pj_list_empty(&cp->free_list[idx])) {
  ------------------
  |  |  889|  16.0k|#define PJ_CACHING_POOL_ARRAY_SIZE      16
  ------------------
  |  Branch (172:9): [True: 0, False: 8.04k]
  |  Branch (172:44): [True: 99, False: 7.94k]
  ------------------
  173|       |        /* No pool is available. */
  174|       |        /* Set minimum size. */
  175|     99|        if (idx < PJ_CACHING_POOL_ARRAY_SIZE)
  ------------------
  |  |  889|     99|#define PJ_CACHING_POOL_ARRAY_SIZE      16
  ------------------
  |  Branch (175:13): [True: 99, False: 0]
  ------------------
  176|     99|            initial_size =  pool_sizes[idx];
  177|       |
  178|       |        /* Create new pool */
  179|     99|        pool = pj_pool_create_int(&cp->factory, name, initial_size, 
  180|     99|                                  increment_sz, alignment, callback);
  181|     99|        if (!pool) {
  ------------------
  |  Branch (181:13): [True: 0, False: 99]
  ------------------
  182|      0|            pj_lock_release(cp->lock);
  183|      0|            return NULL;
  184|      0|        }
  185|       |
  186|  7.94k|    } else {
  187|       |        /* Get one pool from the list. */
  188|  7.94k|        pool = (pj_pool_t*) cp->free_list[idx].next;
  189|  7.94k|        pj_list_erase(pool);
  190|       |
  191|       |        /* Initialize the pool. */
  192|  7.94k|        pj_pool_init_int(pool, name, increment_sz, alignment, callback);
  193|       |
  194|       |        /* Update pool manager's free capacity. */
  195|  7.94k|        if (cp->capacity > pj_pool_get_capacity(pool)) {
  ------------------
  |  Branch (195:13): [True: 7.94k, False: 5]
  ------------------
  196|  7.94k|            cp->capacity -= pj_pool_get_capacity(pool);
  197|  7.94k|        } else {
  198|      5|            cp->capacity = 0;
  199|      5|        }
  200|       |
  201|  7.94k|        PJ_LOG(6, (pool->obj_name, "pool reused, size=%lu",
  ------------------
  |  |  106|  7.94k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  7.94k|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|  15.8k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 7.94k]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  7.94k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 7.94k]
  |  |  ------------------
  ------------------
  202|  7.94k|                   (unsigned long)pool->capacity));
  203|  7.94k|    }
  204|       |
  205|       |    /* Put in used list. */
  206|  8.04k|    pj_list_insert_before( &cp->used_list, pool );
  207|       |
  208|       |    /* Mark factory data */
  209|  8.04k|    pool->factory_data = (void*) (pj_ssize_t) idx;
  210|       |
  211|       |    /* Increment used count. */
  212|  8.04k|    ++cp->used_count;
  213|       |
  214|  8.04k|    pj_lock_release(cp->lock);
  215|  8.04k|    return pool;
  216|  8.04k|}
pool_caching.c:cpool_release_pool:
  219|  8.03k|{
  220|  8.03k|    pj_caching_pool *cp = (pj_caching_pool*)pf;
  221|  8.03k|    pj_size_t pool_capacity;
  222|  8.03k|    unsigned i;
  223|       |
  224|  8.03k|    PJ_CHECK_STACK();
  225|       |
  226|  8.03k|    PJ_ASSERT_ON_FAIL(pf && pool, return);
  ------------------
  |  |  111|  8.03k|            { \
  |  |  112|  8.03k|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   65|  8.03k|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  113|  16.0k|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (113:23): [True: 8.03k, False: 0]
  |  |  |  Branch (113:23): [True: 8.03k, False: 0]
  |  |  ------------------
  |  |  114|  8.03k|            }
  ------------------
  |  Branch (226:5): [True: 0, False: 8.03k]
  |  Branch (226:5): [True: 0, False: 0]
  |  Branch (226:5): [True: 8.03k, False: 0]
  |  Branch (226:5): [True: 8.03k, False: 0]
  ------------------
  227|       |
  228|  8.03k|    pj_lock_acquire(cp->lock);
  229|       |
  230|       |#if PJ_SAFE_POOL
  231|       |    /* Make sure pool is still in our used list */
  232|       |    if (pj_list_find_node(&cp->used_list, pool) != pool) {
  233|       |        pj_lock_release(cp->lock);
  234|       |        pj_assert(!"Attempt to destroy pool that has been destroyed before");
  235|       |        return;
  236|       |    }
  237|       |#endif
  238|       |
  239|       |    /* Erase from the used list. */
  240|  8.03k|    pj_list_erase(pool);
  241|       |
  242|       |    /* Decrement used count. */
  243|  8.03k|    --cp->used_count;
  244|       |
  245|  8.03k|    pool_capacity = pj_pool_get_capacity(pool);
  246|       |
  247|       |    /* Destroy the pool if the size is greater than our size or if the total
  248|       |     * capacity in our recycle list (plus the size of the pool) exceeds 
  249|       |     * maximum capacity.
  250|       |   . */
  251|  8.03k|    if (pool_capacity > pool_sizes[PJ_CACHING_POOL_ARRAY_SIZE-1] ||
  ------------------
  |  |  889|  8.03k|#define PJ_CACHING_POOL_ARRAY_SIZE      16
  ------------------
  |  Branch (251:9): [True: 63, False: 7.97k]
  ------------------
  252|  7.97k|        cp->capacity + pool_capacity > cp->max_capacity)
  ------------------
  |  Branch (252:9): [True: 0, False: 7.97k]
  ------------------
  253|     63|    {
  254|     63|        pj_pool_destroy_int(pool);
  255|     63|        pj_lock_release(cp->lock);
  256|     63|        return;
  257|     63|    }
  258|       |
  259|       |    /* Reset pool. */
  260|  7.97k|    PJ_LOG(6, (pool->obj_name, "recycle(): cap=%lu, used=%lu(%lu%%)", 
  ------------------
  |  |  106|  7.97k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  7.97k|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|  15.9k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 7.97k]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  7.97k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 7.97k]
  |  |  ------------------
  ------------------
  261|  7.97k|               (unsigned long)pool_capacity,
  262|  7.97k|               (unsigned long)pj_pool_get_used_size(pool), 
  263|  7.97k|               (unsigned long)(pj_pool_get_used_size(pool)*100/
  264|  7.97k|                               pool_capacity)));
  265|  7.97k|    pj_pool_reset(pool);
  266|       |
  267|  7.97k|    pool_capacity = pj_pool_get_capacity(pool);
  268|       |
  269|       |    /*
  270|       |     * Otherwise put the pool in our recycle list.
  271|       |     */
  272|  7.97k|    i = (unsigned) (unsigned long) (pj_ssize_t) pool->factory_data;
  273|       |
  274|  7.97k|    pj_assert(i<PJ_CACHING_POOL_ARRAY_SIZE);
  ------------------
  |  |   65|  7.97k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (274:5): [True: 0, False: 7.97k]
  |  Branch (274:5): [True: 7.97k, False: 0]
  ------------------
  275|  7.97k|    if (i >= PJ_CACHING_POOL_ARRAY_SIZE ) {
  ------------------
  |  |  889|  7.97k|#define PJ_CACHING_POOL_ARRAY_SIZE      16
  ------------------
  |  Branch (275:9): [True: 0, False: 7.97k]
  ------------------
  276|       |        /* Something has gone wrong with the pool. */
  277|      0|        pj_pool_destroy_int(pool);
  278|      0|        pj_lock_release(cp->lock);
  279|      0|        return;
  280|      0|    }
  281|       |
  282|  7.97k|    pj_list_insert_after(&cp->free_list[i], pool);
  283|  7.97k|    cp->capacity += pool_capacity;
  284|       |
  285|  7.97k|    pj_lock_release(cp->lock);
  286|  7.97k|}

pool_policy_malloc.c:default_block_alloc:
   33|  5.40k|{
   34|  5.40k|    void *p;
   35|       |
   36|  5.40k|    PJ_CHECK_STACK();
   37|       |
   38|  5.40k|    if (factory->on_block_alloc) {
  ------------------
  |  Branch (38:9): [True: 0, False: 5.40k]
  ------------------
   39|      0|        int rc;
   40|      0|        rc = factory->on_block_alloc(factory, size);
   41|      0|        if (!rc)
  ------------------
  |  Branch (41:13): [True: 0, False: 0]
  ------------------
   42|      0|            return NULL;
   43|      0|    }
   44|       |
   45|  5.40k|    p = malloc(size+(SIG_SIZE << 1));
  ------------------
  |  |   64|  5.40k|#   define SIG_SIZE         0
  ------------------
   46|       |
   47|  5.40k|    if (p == NULL) {
  ------------------
  |  Branch (47:9): [True: 0, False: 5.40k]
  ------------------
   48|      0|        if (factory->on_block_free) 
  ------------------
  |  Branch (48:13): [True: 0, False: 0]
  ------------------
   49|      0|            factory->on_block_free(factory, size);
   50|  5.40k|    } else {
   51|       |        /* Apply signature when PJ_SAFE_POOL is set. It will move
   52|       |         * "p" pointer forward.
   53|       |         */
   54|  5.40k|        APPLY_SIG(p, size);
   55|  5.40k|    }
   56|       |
   57|  5.40k|    return p;
   58|  5.40k|}
pool_policy_malloc.c:default_block_free:
   62|  5.35k|{
   63|  5.35k|    PJ_CHECK_STACK();
   64|       |
   65|  5.35k|    if (factory->on_block_free) 
  ------------------
  |  Branch (65:9): [True: 0, False: 5.35k]
  ------------------
   66|      0|        factory->on_block_free(factory, size);
   67|       |
   68|       |    /* Check and remove signature when PJ_SAFE_POOL is set. It will
   69|       |     * move "mem" pointer backward.
   70|       |     */
   71|  5.35k|    REMOVE_SIG(mem, size);
   72|       |
   73|       |    /* Note that when PJ_SAFE_POOL is set, the actual size of the block
   74|       |     * is size + SIG_SIZE*2.
   75|       |     */
   76|       |
   77|  5.35k|    free(mem);
   78|  5.35k|}

pj_rand:
   30|  13.9k|{
   31|  13.9k|    PJ_CHECK_STACK();
   32|  13.9k|    return platform_rand();
  ------------------
  |  |   43|  13.9k|#      define platform_rand rand
  ------------------
   33|  13.9k|}

pj_htons:
  234|  2.98k|{
  235|       |    return htons(hostshort);
  236|  2.98k|}
pj_htonl:
  250|  2.98k|{
  251|       |    return htonl(hostlong);
  252|  2.98k|}

PJ_FD_ZERO:
   43|      3|{
   44|      3|    PJ_CHECK_STACK();
   45|      3|    pj_assert(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set));
  ------------------
  |  |   65|      3|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (45:5): [True: 0, Folded]
  |  Branch (45:5): [True: 3, Folded]
  ------------------
   46|       |
   47|      3|    FD_ZERO(PART_FDSET(fdsetp));
  ------------------
  |  Branch (47:5): [Folded, False: 3]
  ------------------
   48|      3|    PART_COUNT(fdsetp) = 0;
  ------------------
  |  |   40|      3|#define PART_COUNT(ps)          (ps->data[0])
  ------------------
   49|      3|}

pj_strstr:
  147|  13.2k|{
  148|  13.2k|    const char *s, *ends;
  149|  13.2k|    int first;
  150|       |
  151|  13.2k|    PJ_ASSERT_RETURN(str->slen >= 0 && substr->slen >= 0, NULL);
  ------------------
  |  |   97|  13.2k|            do { \
  |  |   98|  26.5k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 13.2k, False: 0]
  |  |  |  Branch (98:23): [True: 13.2k, False: 0]
  |  |  ------------------
  |  |   99|  13.2k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 13.2k]
  |  |  ------------------
  ------------------
  |  Branch (151:5): [True: 0, False: 0]
  |  Branch (151:5): [True: 0, False: 0]
  |  Branch (151:5): [True: 0, False: 0]
  |  Branch (151:5): [True: 0, False: 0]
  ------------------
  152|       |
  153|       |    /* Check if the string is empty */
  154|  13.2k|    if (str->slen <= 0)
  ------------------
  |  Branch (154:9): [True: 18, False: 13.2k]
  ------------------
  155|     18|        return NULL;
  156|       |
  157|       |    /* Special case when substr is empty */
  158|  13.2k|    if (substr->slen <= 0) {
  ------------------
  |  Branch (158:9): [True: 0, False: 13.2k]
  ------------------
  159|      0|        return (char*)str->ptr;
  160|      0|    }
  161|       |
  162|  13.2k|    s = str->ptr;
  163|  13.2k|    ends = str->ptr + str->slen - substr->slen;
  164|  13.2k|    first = substr->ptr[0];
  165|  87.4k|    for (; s<=ends; ++s) {
  ------------------
  |  Branch (165:12): [True: 87.3k, False: 76]
  ------------------
  166|  87.3k|        if (s[0] == first && pj_memcmp(s, substr->ptr, substr->slen) == 0)
  ------------------
  |  Branch (166:13): [True: 14.2k, False: 73.1k]
  |  Branch (166:30): [True: 13.1k, False: 1.08k]
  ------------------
  167|  13.1k|            return (char*)s;
  168|  87.3k|    }
  169|     76|    return NULL;
  170|  13.2k|}
pj_strltrim:
  201|  22.1k|{
  202|  22.1k|    char *end = str->ptr + str->slen;
  203|  22.1k|    register char *p = str->ptr;
  204|       |
  205|  22.1k|    pj_assert(str->slen >= 0);
  ------------------
  |  |   65|  22.1k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (205:5): [True: 0, False: 22.1k]
  |  Branch (205:5): [True: 22.1k, False: 0]
  ------------------
  206|       |
  207|  23.4k|    while (p < end && pj_isspace(*p))
  ------------------
  |  Branch (207:12): [True: 22.6k, False: 775]
  |  Branch (207:23): [True: 1.35k, False: 21.3k]
  ------------------
  208|  1.35k|        ++p;
  209|  22.1k|    str->slen -= (p - str->ptr);
  210|  22.1k|    str->ptr = p;
  211|  22.1k|    return str;
  212|  22.1k|}
pj_strrtrim:
  215|    892|{
  216|    892|    char *end = str->ptr + str->slen;
  217|    892|    register char *p = end - 1;
  218|       |
  219|    892|    pj_assert(str->slen >= 0);
  ------------------
  |  |   65|    892|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (219:5): [True: 0, False: 892]
  |  Branch (219:5): [True: 892, False: 0]
  ------------------
  220|       |
  221|  1.19k|    while (p >= str->ptr && pj_isspace(*p))
  ------------------
  |  Branch (221:12): [True: 831, False: 364]
  |  Branch (221:29): [True: 303, False: 528]
  ------------------
  222|    303|        --p;
  223|    892|    str->slen -= ((end - p) - 1);
  224|    892|    return str;
  225|    892|}
pj_strtol2:
  274|  10.7k|{
  275|  10.7k|    pj_str_t s;
  276|  10.7k|    unsigned long retval = 0;
  277|  10.7k|    pj_bool_t is_negative = PJ_FALSE;
  278|  10.7k|    int rc = 0;
  279|       |
  280|  10.7k|    PJ_CHECK_STACK();
  281|       |
  282|  10.7k|    if (!str || !value) {
  ------------------
  |  Branch (282:9): [True: 0, False: 10.7k]
  |  Branch (282:17): [True: 0, False: 10.7k]
  ------------------
  283|      0|        return PJ_EINVAL;
  ------------------
  |  |  393|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  284|      0|    }
  285|  10.7k|    PJ_ASSERT_RETURN(str->slen >= 0, PJ_EINVAL);
  ------------------
  |  |   97|  10.7k|            do { \
  |  |   98|  10.7k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 10.7k]
  |  |  ------------------
  |  |   99|  10.7k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 10.7k]
  |  |  ------------------
  ------------------
  |  Branch (285:5): [True: 0, False: 0]
  |  Branch (285:5): [True: 0, False: 0]
  ------------------
  286|       |
  287|  10.7k|    s = *str;
  288|  10.7k|    pj_strltrim(&s);
  289|       |
  290|  10.7k|    if (s.slen == 0)
  ------------------
  |  Branch (290:9): [True: 204, False: 10.5k]
  ------------------
  291|    204|        return PJ_EINVAL;
  ------------------
  |  |  393|    204|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|    204|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|    204|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|    204|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  292|       |
  293|  10.5k|    if (s.ptr[0] == '+' || s.ptr[0] == '-') {
  ------------------
  |  Branch (293:9): [True: 207, False: 10.2k]
  |  Branch (293:28): [True: 1.01k, False: 9.28k]
  ------------------
  294|  1.22k|        is_negative = (s.ptr[0] == '-');
  295|  1.22k|        s.ptr += 1;
  296|  1.22k|        s.slen -= 1;
  297|  1.22k|    }
  298|       |
  299|  10.5k|    rc = pj_strtoul3(&s, &retval, 10);
  300|  10.5k|    if (rc == PJ_EINVAL) {
  ------------------
  |  |  393|  10.5k|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|  10.5k|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|  10.5k|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|  10.5k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (300:9): [True: 665, False: 9.84k]
  ------------------
  301|    665|        return rc;
  302|  9.84k|    } else if (rc != PJ_SUCCESS) {
  ------------------
  |  Branch (302:16): [True: 422, False: 9.41k]
  ------------------
  303|    422|        *value = is_negative ? PJ_MINLONG : PJ_MAXLONG;
  ------------------
  |  |   45|    422|#define PJ_MINLONG      LONG_MIN
  ------------------
                      *value = is_negative ? PJ_MINLONG : PJ_MAXLONG;
  ------------------
  |  |   42|    422|#define PJ_MAXLONG      LONG_MAX
  ------------------
  |  Branch (303:18): [True: 7, False: 415]
  ------------------
  304|    422|        return is_negative ? PJ_ETOOSMALL : PJ_ETOOBIG;
  ------------------
  |  |  469|      7|#define PJ_ETOOSMALL        (PJ_ERRNO_START_STATUS + 19)/* 70019 */
  |  |  ------------------
  |  |  |  |  521|      7|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      7|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      7|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      return is_negative ? PJ_ETOOSMALL : PJ_ETOOBIG;
  ------------------
  |  |  458|    415|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  521|    415|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|    415|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|    415|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (304:16): [True: 7, False: 415]
  ------------------
  305|    422|    }
  306|       |
  307|  9.41k|    if (retval > PJ_MAXLONG && !is_negative) {
  ------------------
  |  |   42|  18.8k|#define PJ_MAXLONG      LONG_MAX
  ------------------
  |  Branch (307:9): [True: 663, False: 8.75k]
  |  Branch (307:32): [True: 258, False: 405]
  ------------------
  308|    258|        *value = PJ_MAXLONG;
  ------------------
  |  |   42|    258|#define PJ_MAXLONG      LONG_MAX
  ------------------
  309|    258|        return PJ_ETOOBIG;
  ------------------
  |  |  458|    258|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  521|    258|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|    258|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|    258|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  310|    258|    }
  311|       |
  312|  9.16k|    if (retval > (PJ_MAXLONG + 1UL) && is_negative) {
  ------------------
  |  |   42|  9.16k|#define PJ_MAXLONG      LONG_MAX
  ------------------
  |  Branch (312:9): [True: 194, False: 8.96k]
  |  Branch (312:40): [True: 194, False: 0]
  ------------------
  313|    194|        *value = PJ_MINLONG;
  ------------------
  |  |   45|    194|#define PJ_MINLONG      LONG_MIN
  ------------------
  314|    194|        return PJ_ETOOSMALL;
  ------------------
  |  |  469|    194|#define PJ_ETOOSMALL        (PJ_ERRNO_START_STATUS + 19)/* 70019 */
  |  |  ------------------
  |  |  |  |  521|    194|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|    194|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|    194|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  315|    194|    }
  316|       |
  317|  8.96k|    if (is_negative && retval == PJ_MAXLONG + 1UL) {
  ------------------
  |  |   42|    614|#define PJ_MAXLONG      LONG_MAX
  ------------------
  |  Branch (317:9): [True: 614, False: 8.35k]
  |  Branch (317:24): [True: 211, False: 403]
  ------------------
  318|    211|        *value = PJ_MINLONG;
  ------------------
  |  |   45|    211|#define PJ_MINLONG      LONG_MIN
  ------------------
  319|    211|        return PJ_SUCCESS;
  320|    211|    }
  321|       |
  322|  8.75k|    *value = is_negative ? -(long)retval : retval;
  ------------------
  |  Branch (322:14): [True: 403, False: 8.35k]
  ------------------
  323|       |
  324|  8.75k|    return PJ_SUCCESS;
  325|  8.96k|}
pj_strtoul:
  328|  1.71k|{
  329|  1.71k|    unsigned long value;
  330|  1.71k|    unsigned i;
  331|       |
  332|  1.71k|    PJ_CHECK_STACK();
  333|       |
  334|  1.71k|    pj_assert(str->slen >= 0);
  ------------------
  |  |   65|  1.71k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (334:5): [True: 0, False: 1.71k]
  |  Branch (334:5): [True: 1.71k, False: 0]
  ------------------
  335|       |
  336|  1.71k|    value = 0;
  337|  5.86k|    for (i=0; i<(unsigned)str->slen; ++i) {
  ------------------
  |  Branch (337:15): [True: 4.36k, False: 1.50k]
  ------------------
  338|  4.36k|        if (!pj_isdigit(str->ptr[i]))
  ------------------
  |  Branch (338:13): [True: 207, False: 4.15k]
  ------------------
  339|    207|            break;
  340|  4.15k|        value = value * 10 + (str->ptr[i] - '0');
  341|  4.15k|    }
  342|  1.71k|    return value;
  343|  1.71k|}
pj_strtoul3:
  385|  10.5k|{
  386|  10.5k|    pj_str_t s;
  387|  10.5k|    unsigned i;
  388|       |
  389|  10.5k|    PJ_CHECK_STACK();
  390|       |
  391|  10.5k|    if (!str || !value) {
  ------------------
  |  Branch (391:9): [True: 0, False: 10.5k]
  |  Branch (391:17): [True: 0, False: 10.5k]
  ------------------
  392|      0|        return PJ_EINVAL;
  ------------------
  |  |  393|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  393|      0|    }
  394|  10.5k|    PJ_ASSERT_RETURN(str->slen >= 0, PJ_EINVAL);
  ------------------
  |  |   97|  10.5k|            do { \
  |  |   98|  10.5k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 10.5k]
  |  |  ------------------
  |  |   99|  10.5k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 10.5k]
  |  |  ------------------
  ------------------
  |  Branch (394:5): [True: 0, False: 0]
  |  Branch (394:5): [True: 0, False: 0]
  ------------------
  395|       |    
  396|  10.5k|    s = *str;
  397|  10.5k|    pj_strltrim(&s);
  398|       |
  399|  10.5k|    if (s.slen == 0 || s.ptr[0] < '0' ||
  ------------------
  |  Branch (399:9): [True: 207, False: 10.2k]
  |  Branch (399:24): [True: 248, False: 10.0k]
  ------------------
  400|  10.0k|        (base <= 10 && (unsigned)s.ptr[0] > ('0' - 1) + base) ||
  ------------------
  |  Branch (400:10): [True: 10.0k, False: 0]
  |  Branch (400:24): [True: 210, False: 9.84k]
  ------------------
  401|  9.84k|        (base == 16 && !pj_isxdigit(s.ptr[0])))
  ------------------
  |  Branch (401:10): [True: 0, False: 9.84k]
  |  Branch (401:24): [True: 0, False: 0]
  ------------------
  402|    665|    {
  403|    665|        return PJ_EINVAL;
  ------------------
  |  |  393|    665|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|    665|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|    665|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|    665|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  404|    665|    }
  405|       |
  406|  9.84k|    *value = 0;
  407|  9.84k|    if (base <= 10) {
  ------------------
  |  Branch (407:9): [True: 9.84k, False: 0]
  ------------------
  408|  56.2k|        for (i=0; i<(unsigned)s.slen; ++i) {
  ------------------
  |  Branch (408:19): [True: 47.2k, False: 8.93k]
  ------------------
  409|  47.2k|            unsigned c = s.ptr[i] - '0';
  410|  47.2k|            if (s.ptr[i] < '0' || (unsigned)s.ptr[i] > ('0' - 1) + base) {
  ------------------
  |  Branch (410:17): [True: 244, False: 47.0k]
  |  Branch (410:35): [True: 244, False: 46.7k]
  ------------------
  411|    488|                break;
  412|    488|            }
  413|  46.7k|            if (*value > PJ_MAXULONG / base) {
  ------------------
  |  |   48|  46.7k|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  |  Branch (413:17): [True: 224, False: 46.5k]
  ------------------
  414|    224|                *value = PJ_MAXULONG;
  ------------------
  |  |   48|    224|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  415|    224|                return PJ_ETOOBIG;
  ------------------
  |  |  458|    224|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  521|    224|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|    224|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|    224|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  416|    224|            }
  417|       |
  418|  46.5k|            *value *= base;
  419|  46.5k|            if ((PJ_MAXULONG - *value) < c) {
  ------------------
  |  |   48|  46.5k|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  |  Branch (419:17): [True: 198, False: 46.3k]
  ------------------
  420|    198|                *value = PJ_MAXULONG;
  ------------------
  |  |   48|    198|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  421|    198|                return PJ_ETOOBIG;
  ------------------
  |  |  458|    198|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  521|    198|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|    198|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|    198|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  422|    198|            }
  423|  46.3k|            *value += c;
  424|  46.3k|        }
  425|  9.84k|    } else if (base == 16) {
  ------------------
  |  Branch (425:16): [True: 0, False: 0]
  ------------------
  426|      0|        for (i=0; i<(unsigned)s.slen; ++i) {
  ------------------
  |  Branch (426:19): [True: 0, False: 0]
  ------------------
  427|      0|            unsigned c = pj_hex_digit_to_val(s.ptr[i]);
  428|      0|            if (!pj_isxdigit(s.ptr[i]))
  ------------------
  |  Branch (428:17): [True: 0, False: 0]
  ------------------
  429|      0|                break;
  430|       |
  431|      0|            if (*value > PJ_MAXULONG / base) {
  ------------------
  |  |   48|      0|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  |  Branch (431:17): [True: 0, False: 0]
  ------------------
  432|      0|                *value = PJ_MAXULONG;
  ------------------
  |  |   48|      0|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  433|      0|                return PJ_ETOOBIG;
  ------------------
  |  |  458|      0|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  434|      0|            }
  435|      0|            *value *= base;
  436|      0|            if ((PJ_MAXULONG - *value) < c) {
  ------------------
  |  |   48|      0|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  |  Branch (436:17): [True: 0, False: 0]
  ------------------
  437|      0|                *value = PJ_MAXULONG;
  ------------------
  |  |   48|      0|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  438|      0|                return PJ_ETOOBIG;
  ------------------
  |  |  458|      0|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  439|      0|            }
  440|      0|            *value += c;
  441|      0|        }
  442|      0|    } else {
  443|      0|        pj_assert(!"Unsupported base");
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (443:9): [Folded, False: 0]
  |  Branch (443:9): [Folded, False: 0]
  ------------------
  444|      0|        return PJ_EINVAL;
  ------------------
  |  |  393|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  445|      0|    }
  446|  9.41k|    return PJ_SUCCESS;
  447|  9.84k|}
pj_ansi_strxcpy:
  631|  20.2k|{
  632|  20.2k|    char *odst = dst;
  633|       |
  634|  20.2k|    PJ_ASSERT_RETURN(dst && src, -PJ_EINVAL);
  ------------------
  |  |   97|  20.2k|            do { \
  |  |   98|  40.4k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 20.2k, False: 0]
  |  |  |  Branch (98:23): [True: 20.2k, False: 0]
  |  |  ------------------
  |  |   99|  20.2k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 20.2k]
  |  |  ------------------
  ------------------
  |  Branch (634:5): [True: 0, False: 0]
  |  Branch (634:5): [True: 0, False: 0]
  |  Branch (634:5): [True: 0, False: 0]
  |  Branch (634:5): [True: 0, False: 0]
  ------------------
  635|       |
  636|  20.2k|    if (dst_size==0)
  ------------------
  |  Branch (636:9): [True: 0, False: 20.2k]
  ------------------
  637|      0|        return -PJ_ETOOBIG;
  ------------------
  |  |  458|      0|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  638|       |
  639|   357k|    while (--dst_size && (*dst=*src) != 0) {
  ------------------
  |  Branch (639:12): [True: 357k, False: 0]
  |  Branch (639:26): [True: 336k, False: 20.2k]
  ------------------
  640|   336k|        ++dst;
  641|   336k|        ++src;
  642|   336k|    }
  643|       |
  644|  20.2k|    if (!*dst && !*src) {
  ------------------
  |  Branch (644:9): [True: 20.2k, False: 0]
  |  Branch (644:18): [True: 20.2k, False: 0]
  ------------------
  645|  20.2k|        return (int)(dst-odst);
  646|  20.2k|    } else {
  647|      0|        *dst = '\0';
  648|      0|        return *src? -PJ_ETOOBIG : (int)(dst-odst);
  ------------------
  |  |  458|      0|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (648:16): [True: 0, False: 0]
  ------------------
  649|      0|    }
  650|  20.2k|}

pj_timer_heap_create:
  592|      1|{
  593|      1|    pj_timer_heap_t *ht;
  594|      1|    pj_size_t i;
  595|       |
  596|      1|    PJ_ASSERT_RETURN(pool && p_heap, PJ_EINVAL);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      2|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (596:5): [True: 0, False: 0]
  |  Branch (596:5): [True: 0, False: 0]
  |  Branch (596:5): [True: 0, False: 0]
  |  Branch (596:5): [True: 0, False: 0]
  ------------------
  597|       |
  598|      1|    *p_heap = NULL;
  599|       |
  600|       |    /* Magic? */
  601|      1|    size += 2;
  602|       |
  603|       |    /* Allocate timer heap data structure from the pool */
  604|      1|    ht = PJ_POOL_ZALLOC_T(pool, pj_timer_heap_t);
  ------------------
  |  |  583|      1|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  605|      1|    if (!ht)
  ------------------
  |  Branch (605:9): [True: 0, False: 1]
  ------------------
  606|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  607|       |
  608|       |    /* Initialize timer heap sizes */
  609|      1|    ht->max_size = size;
  610|      1|    ht->cur_size = 0;
  611|      1|    ht->max_entries_per_poll = DEFAULT_MAX_TIMED_OUT_PER_POLL;
  ------------------
  |  |   46|      1|#define DEFAULT_MAX_TIMED_OUT_PER_POLL  (64)
  ------------------
  612|      1|    ht->timer_ids_freelist = 1;
  613|      1|    ht->pool = pool;
  614|       |
  615|       |    /* Lock. */
  616|      1|    ht->lock = NULL;
  617|      1|    ht->auto_delete_lock = 0;
  618|       |
  619|       |    // Create the heap array.
  620|      1|    ht->heap = (pj_timer_entry_dup**)
  621|      1|               pj_pool_calloc(pool, (unsigned)size,
  622|      1|                              sizeof(pj_timer_entry_dup*));
  623|      1|    if (!ht->heap)
  ------------------
  |  Branch (623:9): [True: 0, False: 1]
  ------------------
  624|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  625|       |
  626|      1|#if PJ_TIMER_USE_COPY
  627|       |    // Create the timer entry copies array.
  628|      1|    ht->timer_dups = (pj_timer_entry_dup*)
  629|      1|                     pj_pool_alloc(pool, sizeof(pj_timer_entry_dup) * size);
  630|      1|    if (!ht->timer_dups)
  ------------------
  |  Branch (630:9): [True: 0, False: 1]
  ------------------
  631|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  632|      1|#endif
  633|       |
  634|       |    // Create the parallel
  635|      1|    ht->timer_ids = (pj_timer_id_t *)
  636|      1|                    pj_pool_alloc( pool, sizeof(pj_timer_id_t) * size);
  637|      1|    if (!ht->timer_ids)
  ------------------
  |  Branch (637:9): [True: 0, False: 1]
  ------------------
  638|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  639|       |
  640|       |    // Initialize the "freelist," which uses negative values to
  641|       |    // distinguish freelist elements from "pointers" into the <heap_>
  642|       |    // array.
  643|  3.07k|    for (i=0; i<size; ++i)
  ------------------
  |  Branch (643:15): [True: 3.07k, False: 1]
  ------------------
  644|  3.07k|        ht->timer_ids[i] = -((pj_timer_id_t) (i + 1));
  645|       |
  646|       |#if PJ_TIMER_USE_LINKED_LIST
  647|       |    pj_list_init(&ht->head_list);
  648|       |#endif
  649|       |
  650|      1|    *p_heap = ht;
  651|      1|    return PJ_SUCCESS;
  652|      1|}
pj_timer_heap_set_lock:
  665|      1|{
  666|      1|    if (ht->lock && ht->auto_delete_lock)
  ------------------
  |  Branch (666:9): [True: 0, False: 1]
  |  Branch (666:21): [True: 0, False: 0]
  ------------------
  667|      0|        pj_lock_destroy(ht->lock);
  668|       |
  669|      1|    ht->lock = lock;
  670|      1|    ht->auto_delete_lock = auto_del;
  671|      1|}
pj_timer_heap_set_max_timed_out_per_poll:
  676|      1|{
  677|      1|    unsigned old_count = ht->max_entries_per_poll;
  678|      1|    ht->max_entries_per_poll = count;
  679|      1|    return old_count;
  680|      1|}

sip_msg.c:init_hdr:
  153|  49.7k|{
  154|  49.7k|    pjsip_hdr *hdr = (pjsip_hdr*) hptr;
  155|  49.7k|    hdr->type = htype;
  156|  49.7k|    hdr->name.ptr = pjsip_hdr_names[htype].name;
  157|  49.7k|    hdr->name.slen = pjsip_hdr_names[htype].name_len;
  158|  49.7k|    if (pjsip_hdr_names[htype].sname) {
  ------------------
  |  Branch (158:9): [True: 28.8k, False: 20.8k]
  ------------------
  159|  28.8k|        hdr->sname.ptr = pjsip_hdr_names[htype].sname;
  160|  28.8k|        hdr->sname.slen = 1;
  161|  28.8k|    } else {
  162|  20.8k|        hdr->sname = hdr->name;
  163|  20.8k|    }
  164|  49.7k|    hdr->vptr = (pjsip_hdr_vptr*) vptr;
  165|  49.7k|    pj_list_init(hdr);
  166|  49.7k|}
sip_auth_msg.c:init_hdr:
  153|  7.85k|{
  154|  7.85k|    pjsip_hdr *hdr = (pjsip_hdr*) hptr;
  155|  7.85k|    hdr->type = htype;
  156|  7.85k|    hdr->name.ptr = pjsip_hdr_names[htype].name;
  157|  7.85k|    hdr->name.slen = pjsip_hdr_names[htype].name_len;
  158|  7.85k|    if (pjsip_hdr_names[htype].sname) {
  ------------------
  |  Branch (158:9): [True: 0, False: 7.85k]
  ------------------
  159|      0|        hdr->sname.ptr = pjsip_hdr_names[htype].sname;
  160|      0|        hdr->sname.slen = 1;
  161|  7.85k|    } else {
  162|  7.85k|        hdr->sname = hdr->name;
  163|  7.85k|    }
  164|  7.85k|    hdr->vptr = (pjsip_hdr_vptr*) vptr;
  165|  7.85k|    pj_list_init(hdr);
  166|  7.85k|}

sip_endpoint.c:pjsip_cfg:
  301|      1|{
  302|      1|    return &pjsip_sip_cfg_var;
  303|      1|}
sip_util.c:pjsip_cfg:
  301|    605|{
  302|    605|    return &pjsip_sip_cfg_var;
  303|    605|}
sip_transaction.c:pjsip_cfg:
  301|     10|{
  302|     10|    return &pjsip_sip_cfg_var;
  303|     10|}

sip_util.c:pjsip_msg_add_hdr:
  981|  3.62k|{
  982|  3.62k|    pj_list_insert_before(&msg->hdr, hdr);
  983|  3.62k|}
sip_util.c:pjsip_msg_insert_first_hdr:
  995|    605|{
  996|    605|    pj_list_insert_after(&msg->hdr, hdr);
  997|    605|}
sip_auth_client.c:pjsip_msg_add_hdr:
  981|    510|{
  982|    510|    pj_list_insert_before(&msg->hdr, hdr);
  983|    510|}

fuzz-sip.c:pjsip_uri_cmp:
  287|  1.38k|{
  288|  1.38k|    return (*((const pjsip_uri*)uri1)->vptr->p_compare)(context, uri1, uri2);
  289|  1.38k|}
sip_uri.c:pjsip_uri_get_scheme:
  259|  1.17k|{
  260|  1.17k|    return (*((pjsip_uri*)uri)->vptr->p_get_scheme)(uri);
  261|  1.17k|}
sip_uri.c:pjsip_uri_cmp:
  287|     58|{
  288|     58|    return (*((const pjsip_uri*)uri1)->vptr->p_compare)(context, uri1, uri2);
  289|     58|}
sip_uri.c:pjsip_uri_clone:
  316|  6.71k|{
  317|  6.71k|    return (*((const pjsip_uri*)uri)->vptr->p_clone)(pool, uri);
  318|  6.71k|}
sip_util.c:pjsip_uri_clone:
  316|     87|{
  317|     87|    return (*((const pjsip_uri*)uri)->vptr->p_clone)(pool, uri);
  318|     87|}
sip_util.c:pjsip_uri_get_scheme:
  259|    605|{
  260|    605|    return (*((pjsip_uri*)uri)->vptr->p_get_scheme)(uri);
  261|    605|}
sip_util.c:pjsip_uri_get_uri:
  271|    605|{
  272|    605|    PJ_ASSERT_RETURN(uri, NULL);
  ------------------
  |  |   97|    605|            do { \
  |  |   98|    605|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 605]
  |  |  ------------------
  |  |   99|    605|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 605]
  |  |  ------------------
  ------------------
  |  Branch (272:5): [True: 0, False: 0]
  |  Branch (272:5): [True: 0, False: 0]
  ------------------
  273|    605|    return (*((pjsip_uri*)uri)->vptr->p_get_uri)((void*)uri);
  274|    605|}
sip_auth_client.c:pjsip_uri_print:
  303|  1.17k|{
  304|  1.17k|    return (int)(*((const pjsip_uri*)uri)->vptr->p_print)(context, uri, 
  305|  1.17k|                                                          buf, size);
  306|  1.17k|}
sip_dialog.c:pjsip_uri_get_scheme:
  259|    261|{
  260|    261|    return (*((pjsip_uri*)uri)->vptr->p_get_scheme)(uri);
  261|    261|}
sip_dialog.c:pjsip_uri_get_uri:
  271|    174|{
  272|    174|    PJ_ASSERT_RETURN(uri, NULL);
  ------------------
  |  |   97|    174|            do { \
  |  |   98|    174|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 174]
  |  |  ------------------
  |  |   99|    174|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 174]
  |  |  ------------------
  ------------------
  |  Branch (272:5): [True: 0, False: 0]
  |  Branch (272:5): [True: 0, False: 0]
  ------------------
  273|    174|    return (*((pjsip_uri*)uri)->vptr->p_get_uri)((void*)uri);
  274|    174|}
sip_tel_uri.c:pjsip_param_cfind:
   78|    806|{
   79|    806|    return pjsip_param_find(param_list, name);
   80|    806|}

sip_dialog.c:pjsip_target_set_init:
  122|     87|{
  123|     87|    pj_list_init(&tset->head);
  124|       |    tset->current = NULL;
  125|     87|}

pjsip_auth_create_digest2:
  264|    510|{
  265|    510|    const pjsip_auth_algorithm *algorithm = NULL;
  266|    510|    unsigned digest_len = 0;
  267|    510|    unsigned digest_strlen = 0;
  268|    510|    char ha1[PJSIP_AUTH_MAX_DIGEST_BUFFER_LENGTH * 2];
  269|    510|    char ha2[PJSIP_AUTH_MAX_DIGEST_BUFFER_LENGTH * 2];
  270|    510|    unsigned char digest[PJSIP_AUTH_MAX_DIGEST_BUFFER_LENGTH];
  271|    510|    unsigned dig_len = 0;
  272|    510|    const EVP_MD* md;
  273|    510|    DEFINE_HASH_CONTEXT;
  ------------------
  |  |   69|    510|#define DEFINE_HASH_CONTEXT pj_md5_context pmc; pj_md5_context* mdctx = &pmc
  ------------------
  274|    510|    pj_bool_t use_builtin_md5 = PJ_FALSE;
  275|       |
  276|    510|    PJ_ASSERT_RETURN(result && nonce && uri && realm && cred_info && method, PJ_EINVAL);
  ------------------
  |  |   97|    510|            do { \
  |  |   98|  5.10k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 510, False: 0]
  |  |  |  Branch (98:23): [True: 510, False: 0]
  |  |  |  Branch (98:23): [True: 510, False: 0]
  |  |  |  Branch (98:23): [True: 510, False: 0]
  |  |  |  Branch (98:23): [True: 510, False: 0]
  |  |  |  Branch (98:23): [True: 510, False: 0]
  |  |  ------------------
  |  |   99|    510|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 510]
  |  |  ------------------
  ------------------
  |  Branch (276:5): [True: 0, False: 0]
  |  Branch (276:5): [True: 0, False: 0]
  |  Branch (276:5): [True: 0, False: 0]
  |  Branch (276:5): [True: 0, False: 0]
  |  Branch (276:5): [True: 0, False: 0]
  |  Branch (276:5): [True: 0, False: 0]
  |  Branch (276:5): [True: 0, False: 0]
  |  Branch (276:5): [True: 0, False: 0]
  |  Branch (276:5): [True: 0, False: 0]
  |  Branch (276:5): [True: 0, False: 0]
  |  Branch (276:5): [True: 0, False: 0]
  |  Branch (276:5): [True: 0, False: 0]
  ------------------
  277|    510|    pj_bzero(result->ptr, result->slen);
  278|       |
  279|    510|    algorithm = pjsip_auth_get_algorithm_by_type(algorithm_type);
  280|    510|    if (!algorithm) {
  ------------------
  |  Branch (280:9): [True: 0, False: 510]
  ------------------
  281|      0|        PJ_LOG(4, (THIS_FILE, "The algorithm_type is invalid"));
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  282|      0|        return PJ_ENOTSUP;
  ------------------
  |  |  433|      0|#define PJ_ENOTSUP          (PJ_ERRNO_START_STATUS + 12)/* 70012 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  283|      0|    }
  284|       |
  285|    510|    if (!pjsip_auth_is_algorithm_supported(algorithm->algorithm_type)) {
  ------------------
  |  Branch (285:9): [True: 0, False: 510]
  ------------------
  286|      0|        PJ_LOG(4, (THIS_FILE,
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  287|      0|                "The algorithm (%.*s) referenced by algorithm_type is not supported",
  288|      0|                (int)algorithm->iana_name.slen, algorithm->iana_name.ptr));
  289|      0|        return PJ_ENOTSUP;
  ------------------
  |  |  433|      0|#define PJ_ENOTSUP          (PJ_ERRNO_START_STATUS + 12)/* 70012 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  290|      0|    }
  291|       |
  292|    510|    if (qop && !(nc && cnonce)) {
  ------------------
  |  Branch (292:9): [True: 130, False: 380]
  |  Branch (292:18): [True: 130, False: 0]
  |  Branch (292:24): [True: 130, False: 0]
  ------------------
  293|      0|        PJ_LOG(4, (THIS_FILE, "nc and cnonce are required if qop is specified"));
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  294|      0|        return PJ_EINVAL;
  ------------------
  |  |  393|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  295|      0|    }
  296|       |
  297|    510|    digest_len = algorithm->digest_length;
  298|    510|    digest_strlen = algorithm->digest_str_length;
  299|    510|    dig_len = digest_len;
  300|       |
  301|    510|    if (result->slen < (pj_ssize_t)digest_strlen) {
  ------------------
  |  Branch (301:9): [True: 0, False: 510]
  ------------------
  302|      0|        PJ_LOG(4, (THIS_FILE,
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  303|      0|                "The length of the result buffer must be at least %d bytes "
  304|      0|                "for algorithm %.*s", digest_strlen,
  305|      0|                (int)algorithm->iana_name.slen, algorithm->iana_name.ptr));
  306|      0|        return PJ_EINVAL;
  ------------------
  |  |  393|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  307|      0|    }
  308|    510|    result->slen = 0;
  309|       |
  310|    510|    if (!PJSIP_CRED_DATA_IS_PASSWD(cred_info) && !PJSIP_CRED_DATA_IS_DIGEST(cred_info)) {
  ------------------
  |  |  120|  1.02k|#define PJSIP_CRED_DATA_IS_PASSWD(cred) (((cred)->data_type & PJSIP_CRED_DATA_PASSWD_MASK) == PJSIP_CRED_DATA_PLAIN_PASSWD)
  |  |  ------------------
  |  |  |  |  116|    510|#define PJSIP_CRED_DATA_PASSWD_MASK         0x000F
  |  |  ------------------
  ------------------
                  if (!PJSIP_CRED_DATA_IS_PASSWD(cred_info) && !PJSIP_CRED_DATA_IS_DIGEST(cred_info)) {
  ------------------
  |  |  121|      0|#define PJSIP_CRED_DATA_IS_DIGEST(cred) (((cred)->data_type & PJSIP_CRED_DATA_PASSWD_MASK) == PJSIP_CRED_DATA_DIGEST)
  |  |  ------------------
  |  |  |  |  116|      0|#define PJSIP_CRED_DATA_PASSWD_MASK         0x000F
  |  |  ------------------
  ------------------
  |  Branch (310:9): [True: 0, False: 510]
  |  Branch (310:50): [True: 0, False: 0]
  ------------------
  311|      0|        PJ_LOG(4, (THIS_FILE,
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  312|      0|                "cred_info->data_type must be PJSIP_CRED_DATA_PLAIN_PASSWD "
  313|      0|                "or PJSIP_CRED_DATA_DIGEST"));
  314|      0|        return PJ_EINVAL;
  ------------------
  |  |  393|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  315|      0|    }
  316|       |
  317|    510|    if (PJSIP_CRED_DATA_IS_DIGEST(cred_info)) {
  ------------------
  |  |  121|    510|#define PJSIP_CRED_DATA_IS_DIGEST(cred) (((cred)->data_type & PJSIP_CRED_DATA_PASSWD_MASK) == PJSIP_CRED_DATA_DIGEST)
  |  |  ------------------
  |  |  |  |  116|    510|#define PJSIP_CRED_DATA_PASSWD_MASK         0x000F
  |  |  ------------------
  |  |  |  Branch (121:41): [True: 0, False: 510]
  |  |  ------------------
  ------------------
  318|      0|        pjsip_auth_algorithm_type cred_algorithm_type = cred_info->algorithm_type;
  319|       |
  320|      0|        if (cred_algorithm_type == PJSIP_AUTH_ALGORITHM_NOT_SET) {
  ------------------
  |  Branch (320:13): [True: 0, False: 0]
  ------------------
  321|      0|            cred_algorithm_type = algorithm_type;
  322|      0|        } else if (cred_algorithm_type != algorithm_type) {
  ------------------
  |  Branch (322:20): [True: 0, False: 0]
  ------------------
  323|      0|            PJ_LOG(4,(THIS_FILE,
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  324|      0|                    "The algorithm specified in the cred_info (%.*s) "
  325|      0|                    "doesn't match the algorithm requested for hashing (%.*s)",
  326|      0|                    (int)pjsip_auth_algorithms[cred_algorithm_type].iana_name.slen,
  327|      0|                    pjsip_auth_algorithms[cred_algorithm_type].iana_name.ptr,
  328|      0|                    (int)pjsip_auth_algorithms[algorithm_type].iana_name.slen,
  329|      0|                    pjsip_auth_algorithms[algorithm_type].iana_name.ptr));
  330|      0|            return PJ_EINVAL;
  ------------------
  |  |  393|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  331|      0|        }
  332|      0|        PJ_ASSERT_RETURN(cred_info->data.slen >= (pj_ssize_t)digest_strlen,
  ------------------
  |  |   97|      0|            do { \
  |  |   98|      0|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 0]
  |  |  ------------------
  |  |   99|      0|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (332:9): [True: 0, False: 0]
  |  Branch (332:9): [True: 0, False: 0]
  ------------------
  333|      0|                         PJ_EINVAL);
  334|      0|    }
  335|       |
  336|    510|    md = EVP_get_digestbyname(algorithm->openssl_name);
  ------------------
  |  |   71|    510|#define EVP_get_digestbyname(digest_name) (digest_name)
  ------------------
  337|       |    /* For MD5, if OpenSSL doesn't provide/allow it, we'll fallback. */
  338|       |#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0 && \
  339|       |    PJ_SSL_SOCK_IMP==PJ_SSL_SOCK_IMP_OPENSSL
  340|       |    if (algorithm->algorithm_type == PJSIP_AUTH_ALGORITHM_MD5 && !md5_evp_is_supported()) {
  341|       |        use_builtin_md5 = PJ_TRUE;
  342|       |    }
  343|       |#endif
  344|    510|    if (md == NULL && !use_builtin_md5) {
  ------------------
  |  Branch (344:9): [True: 0, False: 510]
  |  Branch (344:23): [True: 0, False: 0]
  ------------------
  345|       |        /* Shouldn't happen since it was checked above, unless provider disabled; */
  346|      0|        return PJ_ENOTSUP;
  ------------------
  |  |  433|      0|#define PJ_ENOTSUP          (PJ_ERRNO_START_STATUS + 12)/* 70012 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  347|      0|    }
  348|       |
  349|    510|    AUTH_TRACE_((THIS_FILE, "Begin creating %.*s digest",
  350|    510|            (int)algorithm->iana_name.slen, algorithm->iana_name.ptr));
  351|       |
  352|    510|    if (PJSIP_CRED_DATA_IS_PASSWD(cred_info))
  ------------------
  |  |  120|    510|#define PJSIP_CRED_DATA_IS_PASSWD(cred) (((cred)->data_type & PJSIP_CRED_DATA_PASSWD_MASK) == PJSIP_CRED_DATA_PLAIN_PASSWD)
  |  |  ------------------
  |  |  |  |  116|    510|#define PJSIP_CRED_DATA_PASSWD_MASK         0x000F
  |  |  ------------------
  |  |  |  Branch (120:41): [True: 510, False: 0]
  |  |  ------------------
  ------------------
  353|    510|    {
  354|    510|        AUTH_TRACE_((THIS_FILE, " Using plain text password for %.*s digest",
  355|    510|                (int)algorithm->iana_name.slen, algorithm->iana_name.ptr));
  356|       |        /***
  357|       |         *** ha1 = (digest)(username ":" realm ":" password)
  358|       |         ***/
  359|    510|        if (use_builtin_md5) {
  ------------------
  |  Branch (359:13): [True: 0, False: 510]
  ------------------
  360|      0|            pj_md5_context ctx;
  361|      0|            pj_md5_init(&ctx);
  362|      0|            pj_md5_update(&ctx, (const pj_uint8_t*)cred_info->username.ptr, (unsigned)cred_info->username.slen);
  363|      0|            pj_md5_update(&ctx, (const pj_uint8_t*)":", 1);
  364|      0|            pj_md5_update(&ctx, (const pj_uint8_t*)realm->ptr, (unsigned)realm->slen);
  365|      0|            pj_md5_update(&ctx, (const pj_uint8_t*)":", 1);
  366|      0|            pj_md5_update(&ctx, (const pj_uint8_t*)cred_info->data.ptr, (unsigned)cred_info->data.slen);
  367|      0|            pj_md5_final(&ctx, digest);
  368|      0|            dig_len = digest_len;
  369|    510|        } else {
  370|    510|            mdctx = EVP_MD_CTX_new();
  ------------------
  |  |   72|    510|#define EVP_MD_CTX_new() &pmc
  ------------------
  371|    510|            EVP_DigestInit_ex(mdctx, md, NULL);
  ------------------
  |  |   73|    510|#define EVP_DigestInit_ex(mdctx, md, _unused) (void)md; pj_md5_init(mdctx)
  ------------------
  372|    510|            EVP_DigestUpdate(mdctx, cred_info->username.ptr, cred_info->username.slen);
  ------------------
  |  |   74|    510|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    510|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    510|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  373|    510|            EVP_DigestUpdate(mdctx, ":", 1);
  ------------------
  |  |   74|    510|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    510|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    510|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  374|    510|            EVP_DigestUpdate(mdctx, realm->ptr, realm->slen);
  ------------------
  |  |   74|    510|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    510|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    510|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  375|    510|            EVP_DigestUpdate(mdctx, ":", 1);
  ------------------
  |  |   74|    510|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    510|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    510|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  376|    510|            EVP_DigestUpdate(mdctx, cred_info->data.ptr, cred_info->data.slen);
  ------------------
  |  |   74|    510|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    510|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    510|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  377|    510|            EVP_DigestFinal_ex(mdctx, digest, &dig_len);
  ------------------
  |  |   75|    510|#define EVP_DigestFinal_ex(mdctx, digest, _unused) pj_md5_final(mdctx, digest)
  ------------------
  378|    510|            EVP_MD_CTX_free(mdctx);
  379|    510|        }
  380|    510|        digestNtoStr(digest, dig_len, ha1);
  381|       |
  382|    510|    } else {
  383|      0|        AUTH_TRACE_((THIS_FILE, " Using pre computed digest for %.*s digest",
  384|      0|                (int)algorithm->iana_name.slen, algorithm->iana_name.ptr));
  385|      0|        pj_memcpy( ha1, cred_info->data.ptr, cred_info->data.slen );
  386|      0|    }
  387|       |
  388|    510|    AUTH_TRACE_((THIS_FILE, " ha1=%.*s", algorithm->digest_str_length, ha1));
  389|       |
  390|       |    /***
  391|       |     *** ha2 = (digest)(method ":" req_uri)
  392|       |     ***/
  393|    510|    if (use_builtin_md5) {
  ------------------
  |  Branch (393:9): [True: 0, False: 510]
  ------------------
  394|      0|        pj_md5_context ctx;
  395|      0|        pj_md5_init(&ctx);
  396|      0|        pj_md5_update(&ctx, (const pj_uint8_t*)method->ptr, (unsigned)method->slen);
  397|      0|        pj_md5_update(&ctx, (const pj_uint8_t*)":", 1);
  398|      0|        pj_md5_update(&ctx, (const pj_uint8_t*)uri->ptr, (unsigned)uri->slen);
  399|      0|        pj_md5_final(&ctx, digest);
  400|      0|        dig_len = digest_len;
  401|    510|    } else {
  402|    510|        mdctx = EVP_MD_CTX_new();
  ------------------
  |  |   72|    510|#define EVP_MD_CTX_new() &pmc
  ------------------
  403|    510|        EVP_DigestInit_ex(mdctx, md, NULL);
  ------------------
  |  |   73|    510|#define EVP_DigestInit_ex(mdctx, md, _unused) (void)md; pj_md5_init(mdctx)
  ------------------
  404|    510|        EVP_DigestUpdate(mdctx, method->ptr, method->slen);
  ------------------
  |  |   74|    510|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    510|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    510|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  405|    510|        EVP_DigestUpdate(mdctx, ":", 1);
  ------------------
  |  |   74|    510|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    510|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    510|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  406|    510|        EVP_DigestUpdate(mdctx, uri->ptr, uri->slen);
  ------------------
  |  |   74|    510|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    510|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    510|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  407|    510|        EVP_DigestFinal_ex(mdctx, digest, &dig_len);
  ------------------
  |  |   75|    510|#define EVP_DigestFinal_ex(mdctx, digest, _unused) pj_md5_final(mdctx, digest)
  ------------------
  408|    510|        EVP_MD_CTX_free(mdctx);
  409|    510|    }
  410|    510|    digestNtoStr(digest, dig_len, ha2);
  411|       |
  412|    510|    AUTH_TRACE_((THIS_FILE, " ha2=%.*s", algorithm->digest_str_length, ha2));
  413|       |
  414|       |    /***
  415|       |     *** When qop is not used:
  416|       |     ***   response = (digest)(ha1 ":" nonce ":" ha2)
  417|       |     ***
  418|       |     *** When qop=auth is used:
  419|       |     ***   response = (digest)(ha1 ":" nonce ":" nc ":" cnonce ":" qop ":" ha2)
  420|       |     ***/
  421|    510|    if (use_builtin_md5) {
  ------------------
  |  Branch (421:9): [True: 0, False: 510]
  ------------------
  422|      0|        pj_md5_context ctx;
  423|      0|        pj_md5_init(&ctx);
  424|      0|        pj_md5_update(&ctx, (const pj_uint8_t*)ha1, (unsigned)digest_strlen);
  425|      0|        pj_md5_update(&ctx, (const pj_uint8_t*)":", 1);
  426|      0|        pj_md5_update(&ctx, (const pj_uint8_t*)nonce->ptr, (unsigned)nonce->slen);
  427|      0|        if (qop && qop->slen != 0) {
  ------------------
  |  Branch (427:13): [True: 0, False: 0]
  |  Branch (427:20): [True: 0, False: 0]
  ------------------
  428|      0|            pj_md5_update(&ctx, (const pj_uint8_t*)":", 1);
  429|      0|            pj_md5_update(&ctx, (const pj_uint8_t*)nc->ptr, (unsigned)nc->slen);
  430|      0|            pj_md5_update(&ctx, (const pj_uint8_t*)":", 1);
  431|      0|            pj_md5_update(&ctx, (const pj_uint8_t*)cnonce->ptr, (unsigned)cnonce->slen);
  432|      0|            pj_md5_update(&ctx, (const pj_uint8_t*)":", 1);
  433|      0|            pj_md5_update(&ctx, (const pj_uint8_t*)qop->ptr, (unsigned)qop->slen);
  434|      0|        }
  435|      0|        pj_md5_update(&ctx, (const pj_uint8_t*)":", 1);
  436|      0|        pj_md5_update(&ctx, (const pj_uint8_t*)ha2, (unsigned)digest_strlen);
  437|      0|        pj_md5_final(&ctx, digest);
  438|      0|        dig_len = digest_len;
  439|    510|    } else {
  440|    510|        mdctx = EVP_MD_CTX_new();
  ------------------
  |  |   72|    510|#define EVP_MD_CTX_new() &pmc
  ------------------
  441|    510|        EVP_DigestInit_ex(mdctx, md, NULL);
  ------------------
  |  |   73|    510|#define EVP_DigestInit_ex(mdctx, md, _unused) (void)md; pj_md5_init(mdctx)
  ------------------
  442|    510|        EVP_DigestUpdate(mdctx, ha1, digest_strlen);
  ------------------
  |  |   74|    510|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    510|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    510|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  443|    510|        EVP_DigestUpdate(mdctx, ":", 1);
  ------------------
  |  |   74|    510|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    510|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    510|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  444|    510|        EVP_DigestUpdate(mdctx, nonce->ptr, nonce->slen);
  ------------------
  |  |   74|    510|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    510|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    510|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  445|    510|        if (qop && qop->slen != 0) {
  ------------------
  |  Branch (445:13): [True: 130, False: 380]
  |  Branch (445:20): [True: 130, False: 0]
  ------------------
  446|    130|            EVP_DigestUpdate(mdctx, ":", 1);
  ------------------
  |  |   74|    130|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    130|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    130|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  447|    130|            EVP_DigestUpdate(mdctx, nc->ptr, nc->slen);
  ------------------
  |  |   74|    130|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    130|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    130|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  448|    130|            EVP_DigestUpdate(mdctx, ":", 1);
  ------------------
  |  |   74|    130|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    130|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    130|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  449|    130|            EVP_DigestUpdate(mdctx, cnonce->ptr, cnonce->slen);
  ------------------
  |  |   74|    130|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    130|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    130|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  450|    130|            EVP_DigestUpdate(mdctx, ":", 1);
  ------------------
  |  |   74|    130|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    130|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    130|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  451|    130|            EVP_DigestUpdate(mdctx, qop->ptr, qop->slen);
  ------------------
  |  |   74|    130|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    130|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    130|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  452|    130|        }
  453|    510|        EVP_DigestUpdate(mdctx, ":", 1);
  ------------------
  |  |   74|    510|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    510|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    510|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  454|    510|        EVP_DigestUpdate(mdctx, ha2, digest_strlen);
  ------------------
  |  |   74|    510|#define EVP_DigestUpdate(mdctx, data, len) MD5_APPEND(mdctx, data, len)
  |  |  ------------------
  |  |  |  |   65|    510|#define MD5_APPEND(pms,buf,len) pj_md5_update(pms, (const pj_uint8_t*)buf, \
  |  |  |  |   66|    510|                                              (unsigned)len)
  |  |  ------------------
  ------------------
  455|    510|        EVP_DigestFinal_ex(mdctx, digest, &dig_len);
  ------------------
  |  |   75|    510|#define EVP_DigestFinal_ex(mdctx, digest, _unused) pj_md5_final(mdctx, digest)
  ------------------
  456|    510|        EVP_MD_CTX_free(mdctx);
  457|    510|    }
  458|       |
  459|       |    /* Convert digest to string and store in chal->response. */
  460|    510|    result->slen = digest_strlen;
  461|    510|    digestNtoStr(digest, digest_len, result->ptr);
  462|       |
  463|    510|    AUTH_TRACE_((THIS_FILE, "%.*s digest=%.*s",
  464|    510|            (int)algorithm->iana_name.slen, algorithm->iana_name.ptr,
  465|    510|            (int)result->slen, result->ptr));
  466|       |
  467|    510|    return PJ_SUCCESS;
  468|    510|}
pjsip_auth_get_algorithm_by_type:
  517|    510|{
  518|    510|    if (algorithm_type > PJSIP_AUTH_ALGORITHM_NOT_SET
  ------------------
  |  Branch (518:9): [True: 510, False: 0]
  ------------------
  519|    510|        && algorithm_type < PJSIP_AUTH_ALGORITHM_COUNT) {
  ------------------
  |  Branch (519:12): [True: 510, False: 0]
  ------------------
  520|    510|        return &pjsip_auth_algorithms[algorithm_type];
  521|    510|    }
  522|      0|    return NULL;
  523|    510|}
pjsip_auth_get_algorithm_by_iana_name:
  528|  3.50k|{
  529|  3.50k|    int i;
  530|       |
  531|  3.50k|    if (!iana_name) {
  ------------------
  |  Branch (531:9): [True: 0, False: 3.50k]
  ------------------
  532|      0|        return NULL;
  533|      0|    }
  534|       |
  535|  3.50k|    if (iana_name->slen == 0) {
  ------------------
  |  Branch (535:9): [True: 3.34k, False: 157]
  ------------------
  536|  3.34k|        return &pjsip_auth_algorithms[PJSIP_AUTH_ALGORITHM_MD5];
  537|  3.34k|    }
  538|       |
  539|    157|#ifdef HAVE_NO_OPENSSL
  540|    157|    i = PJSIP_AUTH_ALGORITHM_MD5;
  541|    157|    if (pj_stricmp(iana_name, &pjsip_auth_algorithms[i].iana_name) == 0) {
  ------------------
  |  Branch (541:9): [True: 66, False: 91]
  ------------------
  542|     66|        return &pjsip_auth_algorithms[i];
  543|     66|    }
  544|       |#else
  545|       |    for (i = PJSIP_AUTH_ALGORITHM_NOT_SET + 1; i < PJSIP_AUTH_ALGORITHM_COUNT; i++) {
  546|       |        if (pj_stricmp(iana_name, &pjsip_auth_algorithms[i].iana_name) == 0) {
  547|       |            return &pjsip_auth_algorithms[i];
  548|       |        }
  549|       |    }
  550|       |#endif
  551|     91|    return NULL;
  552|    157|}
pjsip_auth_is_algorithm_supported:
  557|    510|{
  558|    510|    const pjsip_auth_algorithm *algorithm = NULL;
  559|       |
  560|    510|    if (algorithm_type <= PJSIP_AUTH_ALGORITHM_NOT_SET
  ------------------
  |  Branch (560:9): [True: 0, False: 510]
  ------------------
  561|    510|        || algorithm_type >= PJSIP_AUTH_ALGORITHM_COUNT) {
  ------------------
  |  Branch (561:12): [True: 0, False: 510]
  ------------------
  562|      0|        return PJ_FALSE;
  563|      0|    }
  564|    510|    algorithm = &pjsip_auth_algorithms[algorithm_type];
  565|       |
  566|       |    /*
  567|       |     * If the openssl_name is empty there's no need to check
  568|       |     * if OpenSSL supports it.
  569|       |     */
  570|    510|    if (algorithm->openssl_name[0] == '\0') {
  ------------------
  |  Branch (570:9): [True: 0, False: 510]
  ------------------
  571|      0|        return PJ_TRUE;
  572|      0|    }
  573|       |
  574|    510|#ifdef HAVE_NO_OPENSSL
  575|    510|    return (algorithm_type == PJSIP_AUTH_ALGORITHM_MD5);
  576|       |#else
  577|       |    /* For MD5, allow support even if OpenSSL disables it; we'll fallback. */
  578|       |    if (algorithm_type == PJSIP_AUTH_ALGORITHM_MD5) {
  579|       |        return PJ_TRUE;
  580|       |    } else {
  581|       |        const EVP_MD* md;
  582|       |        md = EVP_get_digestbyname(algorithm->openssl_name);
  583|       |        if (md == NULL) {
  584|       |            return PJ_FALSE;
  585|       |        }
  586|       |        return PJ_TRUE;
  587|       |    }
  588|       |#endif
  589|    510|}
pjsip_auth_clt_init:
  916|    726|{
  917|    726|    PJ_ASSERT_RETURN(sess && endpt && pool && (options==0), PJ_EINVAL);
  ------------------
  |  |   97|    726|            do { \
  |  |   98|  4.35k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 726, False: 0]
  |  |  |  Branch (98:23): [True: 726, False: 0]
  |  |  |  Branch (98:23): [True: 726, False: 0]
  |  |  |  Branch (98:23): [True: 726, False: 0]
  |  |  ------------------
  |  |   99|    726|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 726]
  |  |  ------------------
  ------------------
  |  Branch (917:5): [True: 0, False: 0]
  |  Branch (917:5): [True: 0, False: 0]
  |  Branch (917:5): [True: 0, False: 0]
  |  Branch (917:5): [True: 0, False: 0]
  |  Branch (917:5): [True: 0, False: 0]
  |  Branch (917:5): [True: 0, False: 0]
  |  Branch (917:5): [True: 0, False: 0]
  |  Branch (917:5): [True: 0, False: 0]
  ------------------
  918|       |
  919|    726|    sess->pool = pool;
  920|    726|    sess->endpt = endpt;
  921|    726|    sess->cred_cnt = 0;
  922|    726|    sess->cred_info = NULL;
  923|    726|    pj_list_init(&sess->cached_auth);
  924|    726|    pj_bzero(&sess->pref, sizeof(sess->pref));
  925|       |
  926|    726|    sess->parent = NULL;
  927|    726|    sess->lock = NULL;
  928|       |    sess->async_opt = NULL;
  929|    726|    return PJ_SUCCESS;
  930|    726|}
pjsip_auth_clt_deinit:
  951|    726|{
  952|    726|    pjsip_cached_auth *auth;
  953|       |    
  954|    726|    PJ_ASSERT_RETURN(sess && sess->endpt, PJ_EINVAL);
  ------------------
  |  |   97|    726|            do { \
  |  |   98|  1.45k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 726, False: 0]
  |  |  |  Branch (98:23): [True: 726, False: 0]
  |  |  ------------------
  |  |   99|    726|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 726]
  |  |  ------------------
  ------------------
  |  Branch (954:5): [True: 0, False: 0]
  |  Branch (954:5): [True: 0, False: 0]
  |  Branch (954:5): [True: 0, False: 0]
  |  Branch (954:5): [True: 0, False: 0]
  ------------------
  955|       |    
  956|    726|    auth = sess->cached_auth.next;
  957|  1.83k|    while (auth != &sess->cached_auth) {
  ------------------
  |  Branch (957:12): [True: 1.10k, False: 726]
  ------------------
  958|  1.10k|        pjsip_endpt_release_pool(sess->endpt, auth->pool);
  959|  1.10k|        auth = auth->next;
  960|  1.10k|    }
  961|       |
  962|    726|    sess->parent = NULL;
  963|    726|    if (sess->lock) {
  ------------------
  |  Branch (963:9): [True: 0, False: 726]
  ------------------
  964|      0|        return pj_lock_destroy(sess->lock);
  965|    726|    } else {
  966|    726|        return PJ_SUCCESS;
  967|    726|    }
  968|    726|}
pjsip_auth_clt_set_credentials:
 1045|    639|{
 1046|    639|    PJ_ASSERT_RETURN(sess && c, PJ_EINVAL);
  ------------------
  |  |   97|    639|            do { \
  |  |   98|  1.27k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 639, False: 0]
  |  |  |  Branch (98:23): [True: 639, False: 0]
  |  |  ------------------
  |  |   99|    639|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 639]
  |  |  ------------------
  ------------------
  |  Branch (1046:5): [True: 0, False: 0]
  |  Branch (1046:5): [True: 0, False: 0]
  |  Branch (1046:5): [True: 0, False: 0]
  |  Branch (1046:5): [True: 0, False: 0]
  ------------------
 1047|    639|    DO_ON_PARENT_LOCKED(sess, pjsip_auth_clt_set_credentials(sess->parent, cred_cnt, c));
  ------------------
  |  |  137|    639|    do { \
  |  |  138|    639|        pj_status_t on_parent = PJ_SUCCESS; \
  |  |  139|    639|        pj_bool_t with_parent = PJ_FALSE; \
  |  |  140|    639|        if (sess->parent) { \
  |  |  ------------------
  |  |  |  Branch (140:13): [True: 0, False: 639]
  |  |  ------------------
  |  |  141|      0|            pj_lock_acquire(sess->parent->lock); \
  |  |  142|      0|            with_parent = PJ_TRUE; \
  |  |  143|      0|            on_parent = call; \
  |  |  144|      0|            pj_lock_release(sess->parent->lock); \
  |  |  145|      0|        } \
  |  |  146|    639|        if (with_parent) { \
  |  |  ------------------
  |  |  |  Branch (146:13): [True: 0, False: 639]
  |  |  ------------------
  |  |  147|      0|            return on_parent; \
  |  |  148|      0|        } \
  |  |  149|    639|    } while(0)
  |  |  ------------------
  |  |  |  Branch (149:13): [Folded, False: 639]
  |  |  ------------------
  ------------------
 1048|       |
 1049|    639|    if (cred_cnt == 0) {
  ------------------
  |  Branch (1049:9): [True: 0, False: 639]
  ------------------
 1050|      0|        sess->cred_cnt = 0;
 1051|    639|    } else {
 1052|    639|        int i;
 1053|    639|        sess->cred_info = (pjsip_cred_info*)
 1054|    639|                          pj_pool_alloc(sess->pool, cred_cnt * sizeof(*c));
 1055|  1.27k|        for (i=0; i<cred_cnt; ++i) {
  ------------------
  |  Branch (1055:19): [True: 639, False: 639]
  ------------------
 1056|    639|            sess->cred_info[i].data_type = c[i].data_type;
 1057|       |
 1058|       |            /* When data_type is PJSIP_CRED_DATA_EXT_AKA,
 1059|       |             * callback must be specified.
 1060|       |             */
 1061|    639|            if (PJSIP_CRED_DATA_IS_AKA(&c[i])) {
  ------------------
  |  |  119|    639|#define PJSIP_CRED_DATA_IS_AKA(cred) (((cred)->data_type & PJSIP_CRED_DATA_EXT_MASK) == PJSIP_CRED_DATA_EXT_AKA)
  |  |  ------------------
  |  |  |  |  117|    639|#define PJSIP_CRED_DATA_EXT_MASK            0x00F0
  |  |  ------------------
  |  |  |  Branch (119:38): [True: 0, False: 639]
  |  |  ------------------
  ------------------
 1062|       |
 1063|      0|#if !PJSIP_HAS_DIGEST_AKA_AUTH
 1064|      0|                if (!PJSIP_HAS_DIGEST_AKA_AUTH) {
  ------------------
  |  | 1262|      0|#   define PJSIP_HAS_DIGEST_AKA_AUTH        0
  ------------------
  |  Branch (1064:21): [True: 0, Folded]
  ------------------
 1065|      0|                    pj_assert(!"PJSIP_HAS_DIGEST_AKA_AUTH is not enabled");
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (1065:21): [Folded, False: 0]
  |  Branch (1065:21): [Folded, False: 0]
  ------------------
 1066|      0|                    return PJSIP_EAUTHINAKACRED;
  ------------------
  |  |  398|      0|#define PJSIP_EAUTHINAKACRED    (PJSIP_ERRNO_START_PJSIP + 113) /* 171113 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1067|      0|                }
 1068|      0|#endif
 1069|       |
 1070|       |                /* Callback must be specified */
 1071|      0|                PJ_ASSERT_RETURN(c[i].ext.aka.cb != NULL, PJ_EINVAL);
  ------------------
  |  |   97|      0|            do { \
  |  |   98|      0|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 0]
  |  |  ------------------
  |  |   99|      0|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1071:17): [True: 0, False: 0]
  |  Branch (1071:17): [True: 0, False: 0]
  ------------------
 1072|       |
 1073|       |                /* Verify K len */
 1074|      0|                PJ_ASSERT_RETURN(c[i].ext.aka.k.slen <= PJSIP_AKA_KLEN,
  ------------------
  |  |   97|      0|            do { \
  |  |   98|      0|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 0]
  |  |  ------------------
  |  |   99|      0|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1074:17): [True: 0, False: 0]
  |  Branch (1074:17): [True: 0, False: 0]
  ------------------
 1075|      0|                                 PJSIP_EAUTHINAKACRED);
 1076|       |
 1077|       |                /* Verify OP len */
 1078|      0|                PJ_ASSERT_RETURN(c[i].ext.aka.op.slen <= PJSIP_AKA_OPLEN,
  ------------------
  |  |   97|      0|            do { \
  |  |   98|      0|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 0]
  |  |  ------------------
  |  |   99|      0|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1078:17): [True: 0, False: 0]
  |  Branch (1078:17): [True: 0, False: 0]
  ------------------
 1079|      0|                                 PJSIP_EAUTHINAKACRED);
 1080|       |
 1081|       |                /* Verify AMF len */
 1082|      0|                PJ_ASSERT_RETURN(c[i].ext.aka.amf.slen <= PJSIP_AKA_AMFLEN,
  ------------------
  |  |   97|      0|            do { \
  |  |   98|      0|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 0]
  |  |  ------------------
  |  |   99|      0|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1082:17): [True: 0, False: 0]
  |  Branch (1082:17): [True: 0, False: 0]
  ------------------
 1083|      0|                                 PJSIP_EAUTHINAKACRED);
 1084|       |
 1085|      0|                sess->cred_info[i].ext.aka.cb = c[i].ext.aka.cb;
 1086|      0|                pj_strdup(sess->pool, &sess->cred_info[i].ext.aka.k,
 1087|      0|                          &c[i].ext.aka.k);
 1088|      0|                pj_strdup(sess->pool, &sess->cred_info[i].ext.aka.op,
 1089|      0|                          &c[i].ext.aka.op);
 1090|      0|                pj_strdup(sess->pool, &sess->cred_info[i].ext.aka.amf,
 1091|      0|                          &c[i].ext.aka.amf);
 1092|      0|            }
 1093|       |
 1094|    639|            pj_strdup(sess->pool, &sess->cred_info[i].scheme, &c[i].scheme);
 1095|    639|            pj_strdup(sess->pool, &sess->cred_info[i].realm, &c[i].realm);
 1096|    639|            pj_strdup(sess->pool, &sess->cred_info[i].username, &c[i].username);
 1097|    639|            pj_strdup(sess->pool, &sess->cred_info[i].data, &c[i].data);
 1098|       |            /*
 1099|       |             * If the data type is DIGEST and an auth algorithm isn't set,
 1100|       |             * default it to MD5.
 1101|       |             */
 1102|    639|            if (PJSIP_CRED_DATA_IS_DIGEST(&c[i]) &&
  ------------------
  |  |  121|  1.27k|#define PJSIP_CRED_DATA_IS_DIGEST(cred) (((cred)->data_type & PJSIP_CRED_DATA_PASSWD_MASK) == PJSIP_CRED_DATA_DIGEST)
  |  |  ------------------
  |  |  |  |  116|    639|#define PJSIP_CRED_DATA_PASSWD_MASK         0x000F
  |  |  ------------------
  |  |  |  Branch (121:41): [True: 0, False: 639]
  |  |  ------------------
  ------------------
 1103|      0|                c[i].algorithm_type == PJSIP_AUTH_ALGORITHM_NOT_SET) {
  ------------------
  |  Branch (1103:17): [True: 0, False: 0]
  ------------------
 1104|      0|                sess->cred_info[i].algorithm_type = PJSIP_AUTH_ALGORITHM_MD5;
 1105|    639|            } else {
 1106|    639|                sess->cred_info[i].algorithm_type = c[i].algorithm_type;
 1107|    639|            }
 1108|    639|        }
 1109|    639|        sess->cred_cnt = cred_cnt;
 1110|    639|    }
 1111|       |
 1112|    639|    return PJ_SUCCESS;
 1113|    639|}
pjsip_auth_clt_init_req:
 1368|    604|{
 1369|    604|    const pjsip_method *method;
 1370|    604|    pjsip_cached_auth *auth;
 1371|    604|    pjsip_hdr added;
 1372|       |
 1373|    604|    PJ_ASSERT_RETURN(sess && tdata, PJ_EINVAL);
  ------------------
  |  |   97|    604|            do { \
  |  |   98|  1.20k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 604, False: 0]
  |  |  |  Branch (98:23): [True: 604, False: 0]
  |  |  ------------------
  |  |   99|    604|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 604]
  |  |  ------------------
  ------------------
  |  Branch (1373:5): [True: 0, False: 0]
  |  Branch (1373:5): [True: 0, False: 0]
  |  Branch (1373:5): [True: 0, False: 0]
  |  Branch (1373:5): [True: 0, False: 0]
  ------------------
 1374|    604|    PJ_ASSERT_RETURN(sess->pool, PJSIP_ENOTINITIALIZED);
  ------------------
  |  |   97|    604|            do { \
  |  |   98|    604|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 604]
  |  |  ------------------
  |  |   99|    604|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 604]
  |  |  ------------------
  ------------------
  |  Branch (1374:5): [True: 0, False: 0]
  |  Branch (1374:5): [True: 0, False: 0]
  ------------------
 1375|    604|    PJ_ASSERT_RETURN(tdata->msg->type==PJSIP_REQUEST_MSG,
  ------------------
  |  |   97|    604|            do { \
  |  |   98|    604|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 604]
  |  |  ------------------
  |  |   99|    604|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 604]
  |  |  ------------------
  ------------------
  |  Branch (1375:5): [True: 0, False: 0]
  |  Branch (1375:5): [True: 0, False: 0]
  ------------------
 1376|    604|                     PJSIP_ENOTREQUESTMSG);
 1377|       |
 1378|       |
 1379|    604|    DO_ON_PARENT_LOCKED(sess, pjsip_auth_clt_init_req(sess->parent, tdata));
  ------------------
  |  |  137|    604|    do { \
  |  |  138|    604|        pj_status_t on_parent = PJ_SUCCESS; \
  |  |  139|    604|        pj_bool_t with_parent = PJ_FALSE; \
  |  |  140|    604|        if (sess->parent) { \
  |  |  ------------------
  |  |  |  Branch (140:13): [True: 0, False: 604]
  |  |  ------------------
  |  |  141|      0|            pj_lock_acquire(sess->parent->lock); \
  |  |  142|      0|            with_parent = PJ_TRUE; \
  |  |  143|      0|            on_parent = call; \
  |  |  144|      0|            pj_lock_release(sess->parent->lock); \
  |  |  145|      0|        } \
  |  |  146|    604|        if (with_parent) { \
  |  |  ------------------
  |  |  |  Branch (146:13): [True: 0, False: 604]
  |  |  ------------------
  |  |  147|      0|            return on_parent; \
  |  |  148|      0|        } \
  |  |  149|    604|    } while(0)
  |  |  ------------------
  |  |  |  Branch (149:13): [Folded, False: 604]
  |  |  ------------------
  ------------------
 1380|       |    /* Init list */
 1381|    604|    pj_list_init(&added);
 1382|       |
 1383|       |    /* Get the method. */
 1384|    604|    method = &tdata->msg->line.req.method;
 1385|    604|    PJ_UNUSED_ARG(method); /* Warning about unused var caused by #if below */
  ------------------
  |  | 1537|    604|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1386|       |
 1387|    604|    auth = sess->cached_auth.next;
 1388|    604|    while (auth != &sess->cached_auth) {
  ------------------
  |  Branch (1388:12): [True: 0, False: 604]
  ------------------
 1389|       |        /* Reset stale counter */
 1390|      0|        auth->stale_cnt = 0;
 1391|       |
 1392|      0|        if (auth->qop_value == PJSIP_AUTH_QOP_NONE) {
  ------------------
  |  Branch (1392:13): [True: 0, False: 0]
  ------------------
 1393|       |#           if defined(PJSIP_AUTH_HEADER_CACHING) && \
 1394|       |               PJSIP_AUTH_HEADER_CACHING!=0
 1395|       |            {
 1396|       |                pjsip_cached_auth_hdr *entry = auth->cached_hdr.next;
 1397|       |                while (entry != &auth->cached_hdr) {
 1398|       |                    if (pjsip_method_cmp(&entry->method, method)==0) {
 1399|       |                        pjsip_authorization_hdr *hauth;
 1400|       |                        hauth = pjsip_hdr_shallow_clone(tdata->pool, entry->hdr);
 1401|       |                        //pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)hauth);
 1402|       |                        pj_list_push_back(&added, hauth);
 1403|       |                        break;
 1404|       |                    }
 1405|       |                    entry = entry->next;
 1406|       |                }
 1407|       |
 1408|       |#               if defined(PJSIP_AUTH_AUTO_SEND_NEXT) && \
 1409|       |                           PJSIP_AUTH_AUTO_SEND_NEXT!=0
 1410|       |                {
 1411|       |                    if (entry == &auth->cached_hdr)
 1412|       |                        new_auth_for_req( tdata, sess, auth, NULL);
 1413|       |                }
 1414|       |#               endif
 1415|       |
 1416|       |            }
 1417|       |#           elif defined(PJSIP_AUTH_AUTO_SEND_NEXT) && \
 1418|       |                 PJSIP_AUTH_AUTO_SEND_NEXT!=0
 1419|       |            {
 1420|       |                new_auth_for_req( tdata, sess, auth, NULL);
 1421|       |            }
 1422|       |#           endif
 1423|       |
 1424|      0|        }
 1425|       |#       if defined(PJSIP_AUTH_QOP_SUPPORT) && \
 1426|       |           defined(PJSIP_AUTH_AUTO_SEND_NEXT) && \
 1427|       |           (PJSIP_AUTH_QOP_SUPPORT && PJSIP_AUTH_AUTO_SEND_NEXT)
 1428|       |        else if (auth->qop_value == PJSIP_AUTH_QOP_AUTH) {
 1429|       |            /* For qop="auth", we have to re-create the authorization header.
 1430|       |             */
 1431|       |            const pjsip_cred_info *cred;
 1432|       |            pjsip_authorization_hdr *hauth;
 1433|       |            pj_status_t status;
 1434|       |
 1435|       |            cred = auth_find_cred(sess, &auth->realm,
 1436|       |                                  &auth->last_chal->scheme,
 1437|       |                                  auth->challenge_algorithm_type);
 1438|       |            if (!cred) {
 1439|       |                auth = auth->next;
 1440|       |                continue;
 1441|       |            }
 1442|       |
 1443|       |            status = auth_respond( tdata->pool, auth->last_chal,
 1444|       |                                   tdata->msg->line.req.uri,
 1445|       |                                   cred,
 1446|       |                                   &tdata->msg->line.req.method,
 1447|       |                                   sess->pool, auth, &hauth,
 1448|       |                                   auth->challenge_algorithm_type);
 1449|       |            if (status != PJ_SUCCESS)
 1450|       |                return status;
 1451|       |
 1452|       |            //pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)hauth);
 1453|       |            pj_list_push_back(&added, hauth);
 1454|       |        }
 1455|       |#       endif   /* PJSIP_AUTH_QOP_SUPPORT && PJSIP_AUTH_AUTO_SEND_NEXT */
 1456|       |
 1457|      0|        auth = auth->next;
 1458|      0|    }
 1459|       |
 1460|    604|    if (sess->pref.initial_auth == PJ_FALSE) {
  ------------------
  |  Branch (1460:9): [True: 604, False: 0]
  ------------------
 1461|    604|        pjsip_hdr *h;
 1462|       |
 1463|       |        /* Don't want to send initial empty Authorization header, so
 1464|       |         * just send whatever available in the list (maybe empty).
 1465|       |         */
 1466|       |
 1467|    604|        h = added.next;
 1468|    604|        while (h != &added) {
  ------------------
  |  Branch (1468:16): [True: 0, False: 604]
  ------------------
 1469|      0|            pjsip_hdr *next = h->next;
 1470|      0|            pjsip_msg_add_hdr(tdata->msg, h);
 1471|      0|            h = next;
 1472|      0|        }
 1473|    604|    } else {
 1474|       |        /* For each realm, add either the cached authorization header
 1475|       |         * or add an empty authorization header.
 1476|       |         */
 1477|      0|        unsigned i;
 1478|      0|        pj_str_t uri;
 1479|       |
 1480|      0|        uri.ptr = (char*)pj_pool_alloc(tdata->pool, PJSIP_MAX_URL_SIZE);
  ------------------
  |  |  354|      0|#   define PJSIP_MAX_URL_SIZE           256
  ------------------
 1481|      0|        uri.slen = pjsip_uri_print(PJSIP_URI_IN_REQ_URI,
 1482|      0|                                   tdata->msg->line.req.uri,
 1483|      0|                                   uri.ptr, PJSIP_MAX_URL_SIZE);
  ------------------
  |  |  354|      0|#   define PJSIP_MAX_URL_SIZE           256
  ------------------
 1484|      0|        if (uri.slen < 1 || uri.slen >= PJSIP_MAX_URL_SIZE)
  ------------------
  |  |  354|      0|#   define PJSIP_MAX_URL_SIZE           256
  ------------------
  |  Branch (1484:13): [True: 0, False: 0]
  |  Branch (1484:29): [True: 0, False: 0]
  ------------------
 1485|      0|            return PJSIP_EURITOOLONG;
  ------------------
  |  |  164|      0|#define PJSIP_EURITOOLONG       (PJSIP_ERRNO_START_PJSIP + 43)  /* 171043 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1486|       |
 1487|      0|        for (i=0; i<sess->cred_cnt; ++i) {
  ------------------
  |  Branch (1487:19): [True: 0, False: 0]
  ------------------
 1488|      0|            pjsip_cred_info *c = &sess->cred_info[i];
 1489|      0|            pjsip_authorization_hdr *h;
 1490|       |
 1491|      0|            h = get_header_for_cred_info(&added, c);
 1492|      0|            if (h) {
  ------------------
  |  Branch (1492:17): [True: 0, False: 0]
  ------------------
 1493|      0|                pj_list_erase(h);
 1494|      0|                pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)h);
 1495|      0|            } else {
 1496|      0|                pjsip_authorization_hdr *hs;
 1497|       |
 1498|      0|                hs = pjsip_authorization_hdr_create(tdata->pool);
 1499|      0|                pj_strdup(tdata->pool, &hs->scheme, &c->scheme);
 1500|      0|                if (pj_stricmp(&c->scheme, &pjsip_BEARER_STR)==0) {
  ------------------
  |  Branch (1500:21): [True: 0, False: 0]
  ------------------
 1501|      0|                        pj_strdup(tdata->pool, &hs->credential.oauth.username,
 1502|      0|                                  &c->username);
 1503|      0|                        pj_strdup(tdata->pool, &hs->credential.oauth.realm,
 1504|      0|                                  &c->realm);
 1505|      0|                        pj_strdup(tdata->pool, &hs->credential.oauth.token,
 1506|      0|                                  &c->data);
 1507|      0|                } else { //if (pj_stricmp(&c->scheme, &pjsip_DIGEST_STR)==0)
 1508|      0|                        pj_strdup(tdata->pool, &hs->credential.digest.username,
 1509|      0|                                  &c->username);
 1510|      0|                        pj_strdup(tdata->pool, &hs->credential.digest.realm,
 1511|      0|                                  &c->realm);
 1512|      0|                        pj_strdup(tdata->pool,&hs->credential.digest.uri, &uri);
 1513|       |
 1514|      0|                        if (c->algorithm_type == PJSIP_AUTH_ALGORITHM_NOT_SET) {
  ------------------
  |  Branch (1514:29): [True: 0, False: 0]
  ------------------
 1515|      0|                            pj_strdup(tdata->pool, &hs->credential.digest.algorithm,
 1516|      0|                                &sess->pref.algorithm);
 1517|      0|                        } else {
 1518|      0|                            pj_strdup(tdata->pool, &hs->credential.digest.algorithm,
 1519|      0|                                &pjsip_auth_algorithms[c->algorithm_type].iana_name);
 1520|      0|                        }
 1521|      0|                }
 1522|       |
 1523|      0|                pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)hs);
 1524|      0|            }
 1525|      0|        }
 1526|      0|    }
 1527|       |
 1528|    604|    return PJ_SUCCESS;
 1529|    604|}
pjsip_auth_clt_reinit_req:
 1712|    604|{
 1713|    604|    pjsip_tx_data *tdata;
 1714|    604|    const pjsip_hdr *hdr;
 1715|    604|    unsigned chal_cnt, auth_cnt;
 1716|    604|    pjsip_via_hdr *via;
 1717|    604|    pj_status_t status;
 1718|    604|    pj_status_t last_auth_err;
 1719|       |
 1720|    604|    PJ_ASSERT_RETURN(sess && rdata && old_request && new_request,
  ------------------
  |  |   97|    604|            do { \
  |  |   98|  3.62k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 604, False: 0]
  |  |  |  Branch (98:23): [True: 604, False: 0]
  |  |  |  Branch (98:23): [True: 604, False: 0]
  |  |  |  Branch (98:23): [True: 604, False: 0]
  |  |  ------------------
  |  |   99|    604|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 604]
  |  |  ------------------
  ------------------
  |  Branch (1720:5): [True: 0, False: 0]
  |  Branch (1720:5): [True: 0, False: 0]
  |  Branch (1720:5): [True: 0, False: 0]
  |  Branch (1720:5): [True: 0, False: 0]
  |  Branch (1720:5): [True: 0, False: 0]
  |  Branch (1720:5): [True: 0, False: 0]
  |  Branch (1720:5): [True: 0, False: 0]
  |  Branch (1720:5): [True: 0, False: 0]
  ------------------
 1721|    604|                     PJ_EINVAL);
 1722|    604|    PJ_ASSERT_RETURN(sess->pool, PJSIP_ENOTINITIALIZED);
  ------------------
  |  |   97|    604|            do { \
  |  |   98|    604|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 604]
  |  |  ------------------
  |  |   99|    604|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 604]
  |  |  ------------------
  ------------------
  |  Branch (1722:5): [True: 0, False: 0]
  |  Branch (1722:5): [True: 0, False: 0]
  ------------------
 1723|    604|    PJ_ASSERT_RETURN(rdata->msg_info.msg->type == PJSIP_RESPONSE_MSG,
  ------------------
  |  |   97|    604|            do { \
  |  |   98|    604|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 604]
  |  |  ------------------
  |  |   99|    604|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 604]
  |  |  ------------------
  ------------------
  |  Branch (1723:5): [True: 0, False: 0]
  |  Branch (1723:5): [True: 0, False: 0]
  ------------------
 1724|    604|                     PJSIP_ENOTRESPONSEMSG);
 1725|    604|    PJ_ASSERT_RETURN(old_request->msg->type == PJSIP_REQUEST_MSG,
  ------------------
  |  |   97|    604|            do { \
  |  |   98|    604|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 604]
  |  |  ------------------
  |  |   99|    604|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 604]
  |  |  ------------------
  ------------------
  |  Branch (1725:5): [True: 0, False: 0]
  |  Branch (1725:5): [True: 0, False: 0]
  ------------------
 1726|    604|                     PJSIP_ENOTREQUESTMSG);
 1727|    604|    PJ_ASSERT_RETURN(rdata->msg_info.msg->line.status.code == 401 ||
  ------------------
  |  |   97|    604|            do { \
  |  |   98|    621|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 587, False: 17]
  |  |  |  Branch (98:23): [True: 17, False: 0]
  |  |  ------------------
  |  |   99|    604|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 604]
  |  |  ------------------
  ------------------
  |  Branch (1727:5): [True: 0, False: 0]
  |  Branch (1727:5): [True: 0, False: 0]
  |  Branch (1727:5): [True: 0, False: 0]
  |  Branch (1727:5): [True: 0, False: 0]
  ------------------
 1728|    604|                     rdata->msg_info.msg->line.status.code == 407,
 1729|    604|                     PJSIP_EINVALIDSTATUS);
 1730|       |
 1731|    604|    DO_ON_PARENT_LOCKED(sess, pjsip_auth_clt_reinit_req(sess->parent, rdata, old_request, new_request));
  ------------------
  |  |  137|    604|    do { \
  |  |  138|    604|        pj_status_t on_parent = PJ_SUCCESS; \
  |  |  139|    604|        pj_bool_t with_parent = PJ_FALSE; \
  |  |  140|    604|        if (sess->parent) { \
  |  |  ------------------
  |  |  |  Branch (140:13): [True: 0, False: 604]
  |  |  ------------------
  |  |  141|      0|            pj_lock_acquire(sess->parent->lock); \
  |  |  142|      0|            with_parent = PJ_TRUE; \
  |  |  143|      0|            on_parent = call; \
  |  |  144|      0|            pj_lock_release(sess->parent->lock); \
  |  |  145|      0|        } \
  |  |  146|    604|        if (with_parent) { \
  |  |  ------------------
  |  |  |  Branch (146:13): [True: 0, False: 604]
  |  |  ------------------
  |  |  147|      0|            return on_parent; \
  |  |  148|      0|        } \
  |  |  149|    604|    } while(0)
  |  |  ------------------
  |  |  |  Branch (149:13): [Folded, False: 604]
  |  |  ------------------
  ------------------
 1732|       |
 1733|    604|    tdata = old_request;
 1734|    604|    tdata->auth_retry = PJ_FALSE;
 1735|       |
 1736|       |    /*
 1737|       |     * Respond to each authentication challenge.
 1738|       |     */
 1739|    604|    hdr = rdata->msg_info.msg->hdr.next;
 1740|    604|    chal_cnt = 0;
 1741|    604|    auth_cnt = 0;
 1742|    604|    last_auth_err = PJSIP_EAUTHNOAUTH;
  ------------------
  |  |  362|    604|#define PJSIP_EAUTHNOAUTH       (PJSIP_ERRNO_START_PJSIP + 106) /* 171106 */
  |  |  ------------------
  |  |  |  |   73|    604|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    604|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|    604|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|    604|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|    604|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|    604|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|    604|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|    604|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|    604|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1743|  4.10k|    while (hdr != &rdata->msg_info.msg->hdr) {
  ------------------
  |  Branch (1743:12): [True: 3.73k, False: 369]
  ------------------
 1744|  3.73k|        pjsip_cached_auth *cached_auth;
 1745|  3.73k|        const pjsip_www_authenticate_hdr *hchal;
 1746|  3.73k|        pjsip_authorization_hdr *hauth;
 1747|  3.73k|        const pjsip_auth_algorithm *algorithm;
 1748|       |
 1749|       |        /* Find WWW-Authenticate or Proxy-Authenticate header. */
 1750|  4.40k|        while (hdr != &rdata->msg_info.msg->hdr &&
  ------------------
  |  Branch (1750:16): [True: 4.16k, False: 235]
  ------------------
 1751|  4.16k|               hdr->type != PJSIP_H_WWW_AUTHENTICATE &&
  ------------------
  |  Branch (1751:16): [True: 2.36k, False: 1.79k]
  ------------------
 1752|  2.36k|               hdr->type != PJSIP_H_PROXY_AUTHENTICATE)
  ------------------
  |  Branch (1752:16): [True: 665, False: 1.70k]
  ------------------
 1753|    665|        {
 1754|    665|            hdr = hdr->next;
 1755|    665|        }
 1756|  3.73k|        if (hdr == &rdata->msg_info.msg->hdr)
  ------------------
  |  Branch (1756:13): [True: 235, False: 3.50k]
  ------------------
 1757|    235|            break;
 1758|       |
 1759|  3.50k|        hchal = (const pjsip_www_authenticate_hdr*)hdr;
 1760|  3.50k|        ++chal_cnt;
 1761|       |
 1762|       |        /* At the current time, "digest" scheme is the only one supported. */
 1763|  3.50k|        if (pj_stricmp(&hchal->scheme, &pjsip_DIGEST_STR) != 0) {
  ------------------
  |  Branch (1763:13): [True: 0, False: 3.50k]
  ------------------
 1764|      0|            AUTH_TRACE_((THIS_FILE, "Skipped header for scheme %.*s",
 1765|      0|                (int)hchal->scheme.slen, hchal->scheme.ptr));
 1766|      0|            last_auth_err = PJSIP_EINVALIDAUTHSCHEME;
  ------------------
  |  |  352|      0|#define PJSIP_EINVALIDAUTHSCHEME (PJSIP_ERRNO_START_PJSIP + 104)/* 171104 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1767|      0|            hdr = hdr->next;
 1768|      0|            continue;
 1769|      0|        }
 1770|       |
 1771|  3.50k|        algorithm = pjsip_auth_get_algorithm_by_iana_name(&hchal->challenge.digest.algorithm);
 1772|  3.50k|        if (!algorithm) {
  ------------------
  |  Branch (1772:13): [True: 91, False: 3.41k]
  ------------------
 1773|     91|            AUTH_TRACE_((THIS_FILE, "Skipped header for algorithm %.*s",
 1774|     91|                (int)algorithm->iana_name.slen, algorithm->iana_name.ptr));
 1775|     91|            last_auth_err = PJSIP_EINVALIDALGORITHM;
  ------------------
  |  |  342|     91|#define PJSIP_EINVALIDALGORITHM (PJSIP_ERRNO_START_PJSIP + 102) /* 171102 */
  |  |  ------------------
  |  |  |  |   73|     91|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     91|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|     91|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|     91|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|     91|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|     91|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|     91|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|     91|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|     91|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1776|     91|            hdr = hdr->next;
 1777|     91|            continue;
 1778|     91|        }
 1779|       |
 1780|       |        /* Find authentication session for this realm, create a new one
 1781|       |         * if not present.
 1782|       |         */
 1783|  3.41k|        cached_auth = find_cached_auth(sess, &hchal->challenge.common.realm,
 1784|  3.41k|            algorithm->algorithm_type);
 1785|  3.41k|        if (!cached_auth) {
  ------------------
  |  Branch (1785:13): [True: 1.10k, False: 2.30k]
  ------------------
 1786|  1.10k|            cached_auth = PJ_POOL_ZALLOC_T(sess->pool, pjsip_cached_auth);
  ------------------
  |  |  583|  1.10k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
 1787|  1.10k|            cached_auth->pool = pjsip_endpt_create_pool(sess->endpt,
 1788|  1.10k|                                                        "auth_cli%p",
 1789|  1.10k|                                                        1024,
 1790|  1.10k|                                                        1024);
 1791|  1.10k|            pj_strdup(cached_auth->pool, &cached_auth->realm,
 1792|  1.10k|                      &hchal->challenge.common.realm);
 1793|  1.10k|            cached_auth->is_proxy = (hchal->type == PJSIP_H_PROXY_AUTHENTICATE);
 1794|  1.10k|            cached_auth->challenge_algorithm_type = algorithm->algorithm_type;
 1795|       |#           if (PJSIP_AUTH_HEADER_CACHING)
 1796|       |            {
 1797|       |                pj_list_init(&cached_auth->cached_hdr);
 1798|       |            }
 1799|       |#           endif
 1800|  1.10k|            pj_list_insert_before(&sess->cached_auth, cached_auth);
 1801|  1.10k|        }
 1802|       |
 1803|       |        /* Create authorization header for this challenge, and update
 1804|       |         * authorization session.
 1805|       |         */
 1806|  3.41k|        status = process_auth(tdata->pool, hchal, tdata->msg->line.req.uri,
 1807|  3.41k|                              tdata, sess, cached_auth, &hauth, algorithm->algorithm_type);
 1808|  3.41k|        if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (1808:13): [True: 2.90k, False: 510]
  ------------------
 1809|  2.90k|            last_auth_err = status;
 1810|  2.90k|            AUTH_TRACE_((THIS_FILE, "Skipped header for realm %.*s algorithm %.*s",
 1811|  2.90k|                (int)hchal->challenge.common.realm.slen, hchal->challenge.common.realm.ptr,
 1812|  2.90k|                (int)algorithm->iana_name.slen, algorithm->iana_name.ptr));
 1813|       |
 1814|       |            /* Process next header. */
 1815|  2.90k|            hdr = hdr->next;
 1816|  2.90k|            continue;
 1817|  2.90k|        }
 1818|       |
 1819|    510|        if (pj_pool_get_used_size(cached_auth->pool) >
  ------------------
  |  Branch (1819:13): [True: 52, False: 458]
  ------------------
 1820|    510|            PJSIP_AUTH_CACHED_POOL_MAX_SIZE) 
  ------------------
  |  | 1330|    510|#   define PJSIP_AUTH_CACHED_POOL_MAX_SIZE      (20 * 1024)
  ------------------
 1821|     52|        {
 1822|     52|            recreate_cached_auth_pool(sess->endpt, cached_auth);
 1823|     52|        }       
 1824|       |
 1825|       |        /* Add to the message. */
 1826|    510|        pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)hauth);
 1827|       |
 1828|       |        /* Process next header. */
 1829|    510|        hdr = hdr->next;
 1830|    510|        auth_cnt++;
 1831|    510|    }
 1832|       |
 1833|       |    /* Check if challenge is present */
 1834|    604|    if (chal_cnt == 0)
  ------------------
  |  Branch (1834:9): [True: 0, False: 604]
  ------------------
 1835|      0|        return PJSIP_EAUTHNOCHAL;
  ------------------
  |  |  402|      0|#define PJSIP_EAUTHNOCHAL       (PJSIP_ERRNO_START_PJSIP + 114) /* 171114 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1836|       |
 1837|       |    /* Check if any authorization header has been created */
 1838|    604|    if (auth_cnt == 0)
  ------------------
  |  Branch (1838:9): [True: 322, False: 282]
  ------------------
 1839|    322|        return last_auth_err;
 1840|       |
 1841|       |    /* Remove branch param in Via header. */
 1842|    282|    via = (pjsip_via_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
 1843|    282|    via->branch_param.slen = 0;
 1844|       |
 1845|       |    /* Restore strict route set.
 1846|       |     * See https://github.com/pjsip/pjproject/issues/492
 1847|       |     */
 1848|    282|    pjsip_restore_strict_route_set(tdata);
 1849|       |
 1850|       |    /* Must invalidate the message! */
 1851|    282|    pjsip_tx_data_invalidate_msg(tdata);
 1852|       |
 1853|       |    /* Retrying.. */
 1854|    282|    tdata->auth_retry = PJ_TRUE;
 1855|       |
 1856|       |    /* Increment reference counter. */
 1857|    282|    pjsip_tx_data_add_ref(tdata);
 1858|       |
 1859|       |    /* Done. */
 1860|    282|    *new_request = tdata;
 1861|    282|    return PJ_SUCCESS;
 1862|       |
 1863|    604|}
sip_auth_client.c:digestNtoStr:
  241|  1.53k|{
  242|  1.53k|    int i;
  243|  26.0k|    for (i = 0; i<n; ++i) {
  ------------------
  |  Branch (243:17): [True: 24.4k, False: 1.53k]
  ------------------
  244|  24.4k|        pj_val_to_hex_digit(digest[i], output);
  245|  24.4k|        output += 2;
  246|  24.4k|    }
  247|  1.53k|}
sip_auth_client.c:find_cached_auth:
  818|  3.41k|{
  819|  3.41k|    pjsip_cached_auth *auth, *pauth = NULL;
  820|       |
  821|  3.41k|    if (sess->parent) {
  ------------------
  |  Branch (821:9): [True: 0, False: 3.41k]
  ------------------
  822|      0|        pj_lock_acquire(sess->parent->lock);
  823|      0|        pauth = find_cached_auth(sess->parent, realm, algorithm_type);
  824|      0|        pj_lock_release(sess->parent->lock);
  825|      0|    }
  826|  3.41k|    if (pauth != NULL) {
  ------------------
  |  Branch (826:9): [True: 0, False: 3.41k]
  ------------------
  827|      0|        return pauth;
  828|      0|    }
  829|       |
  830|  3.41k|    auth = sess->cached_auth.next;
  831|  8.33k|    while (auth != &sess->cached_auth) {
  ------------------
  |  Branch (831:12): [True: 7.23k, False: 1.10k]
  ------------------
  832|  7.23k|        if (pj_stricmp(&auth->realm, realm) == 0
  ------------------
  |  Branch (832:13): [True: 2.30k, False: 4.92k]
  ------------------
  833|  2.30k|            && auth->challenge_algorithm_type == algorithm_type)
  ------------------
  |  Branch (833:16): [True: 2.30k, False: 0]
  ------------------
  834|  2.30k|        {
  835|  2.30k|            return auth;
  836|  2.30k|        }
  837|  4.92k|        auth = auth->next;
  838|  4.92k|    }
  839|       |
  840|  1.10k|    return NULL;
  841|  3.41k|}
sip_auth_client.c:process_auth:
 1568|  3.41k|{
 1569|  3.41k|    const pjsip_cred_info *cred;
 1570|  3.41k|    pjsip_authorization_hdr *sent_auth = NULL;
 1571|  3.41k|    pjsip_hdr *hdr;
 1572|  3.41k|    pj_status_t status;
 1573|       |
 1574|       |    /* See if we have sent authorization header for this realm (and scheme) */
 1575|  3.41k|    hdr = tdata->msg->hdr.next;
 1576|  27.8k|    while (hdr != &tdata->msg->hdr) {
  ------------------
  |  Branch (1576:12): [True: 25.0k, False: 2.80k]
  ------------------
 1577|  25.0k|        if ((hchal->type == PJSIP_H_WWW_AUTHENTICATE &&
  ------------------
  |  Branch (1577:14): [True: 13.2k, False: 11.7k]
  ------------------
 1578|  13.2k|             hdr->type == PJSIP_H_AUTHORIZATION) ||
  ------------------
  |  Branch (1578:14): [True: 589, False: 12.6k]
  ------------------
 1579|  24.4k|            (hchal->type == PJSIP_H_PROXY_AUTHENTICATE &&
  ------------------
  |  Branch (1579:14): [True: 11.7k, False: 12.6k]
  ------------------
 1580|  11.7k|             hdr->type == PJSIP_H_PROXY_AUTHORIZATION))
  ------------------
  |  Branch (1580:14): [True: 376, False: 11.3k]
  ------------------
 1581|    965|        {
 1582|    965|            sent_auth = (pjsip_authorization_hdr*) hdr;
 1583|    965|            if (pj_stricmp(&hchal->challenge.common.realm,
  ------------------
  |  Branch (1583:17): [True: 608, False: 357]
  ------------------
 1584|    965|                           &sent_auth->credential.common.realm)==0 &&
 1585|    608|                pj_stricmp(&hchal->scheme, &sent_auth->scheme)==0)
  ------------------
  |  Branch (1585:17): [True: 608, False: 0]
  ------------------
 1586|    608|            {
 1587|       |                /* If this authorization has empty response, remove it. */
 1588|    608|                if (pj_stricmp(&sent_auth->scheme, &pjsip_DIGEST_STR)==0 &&
  ------------------
  |  Branch (1588:21): [True: 608, False: 0]
  ------------------
 1589|    608|                    sent_auth->credential.digest.response.slen == 0)
  ------------------
  |  Branch (1589:21): [True: 0, False: 608]
  ------------------
 1590|      0|                {
 1591|       |                    /* This is empty authorization, remove it. */
 1592|      0|                    hdr = hdr->next;
 1593|      0|                    pj_list_erase(sent_auth);
 1594|      0|                    continue;
 1595|    608|                } else {
 1596|       |#if defined(PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER) && \
 1597|       |            PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER!=0
 1598|       |                    /*
 1599|       |                     * Keep sending additional headers if the the algorithm
 1600|       |                     * is different.
 1601|       |                     * WARNING:  See the comment in sip_config.h regarding
 1602|       |                     * how using this option could be a security risk if
 1603|       |                     * a header with a more secure digest algorithm has already
 1604|       |                     * been sent.
 1605|       |                     */
 1606|       |                    if (pj_stricmp(&sent_auth->scheme, &pjsip_DIGEST_STR)==0 &&
 1607|       |                        pj_stricmp(&sent_auth->credential.digest.algorithm,
 1608|       |                                   &hchal->challenge.digest.algorithm)!=0)
 1609|       |                    {
 1610|       |                        /* Same 'digest' scheme but different algo */
 1611|       |                        hdr = hdr->next;
 1612|       |                        continue;
 1613|       |                    } else
 1614|       |#endif
 1615|       |                    /* Found previous authorization attempt */
 1616|    608|                    break;
 1617|    608|                }
 1618|    608|            }
 1619|    965|        }
 1620|  24.4k|        hdr = hdr->next;
 1621|  24.4k|    }
 1622|       |
 1623|       |    /* If we have sent, see if server rejected because of stale nonce or
 1624|       |     * other causes.
 1625|       |     */
 1626|  3.41k|    if (hdr != &tdata->msg->hdr) {
  ------------------
  |  Branch (1626:9): [True: 608, False: 2.80k]
  ------------------
 1627|    608|        pj_bool_t stale;
 1628|       |
 1629|       |        /* Check sent_auth != NULL */
 1630|    608|        PJ_ASSERT_RETURN(sent_auth, PJ_EBUG);
  ------------------
  |  |   97|    608|            do { \
  |  |   98|    608|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 608]
  |  |  ------------------
  |  |   99|    608|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 608]
  |  |  ------------------
  ------------------
  |  Branch (1630:9): [True: 0, False: 0]
  |  Branch (1630:9): [True: 0, False: 0]
  ------------------
 1631|       |
 1632|       |        /* Detect "stale" state */
 1633|    608|        stale = hchal->challenge.digest.stale;
 1634|    608|        if (!stale) {
  ------------------
  |  Branch (1634:13): [True: 488, False: 120]
  ------------------
 1635|       |            /* If stale is false, check is nonce has changed. Some servers
 1636|       |             * (broken ones!) want to change nonce but they fail to set
 1637|       |             * stale to true.
 1638|       |             */
 1639|    488|            stale = pj_strcmp(&hchal->challenge.digest.nonce,
 1640|    488|                              &sent_auth->credential.digest.nonce);
 1641|    488|        }
 1642|       |
 1643|    608|        if (stale == PJ_FALSE) {
  ------------------
  |  Branch (1643:13): [True: 119, False: 489]
  ------------------
 1644|       |            /* Our credential is rejected. No point in trying to re-supply
 1645|       |             * the same credential.
 1646|       |             */
 1647|    119|            PJ_LOG(4, (THIS_FILE, "Authorization failed for %.*s@%.*s: "
  ------------------
  |  |  106|    119|#define PJ_LOG(level,arg)       do { \
  |  |  107|    119|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    238|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 119, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 119]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|    119|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 119]
  |  |  ------------------
  ------------------
 1648|    119|                       "server rejected with stale=false",
 1649|    119|                       (int)sent_auth->credential.digest.username.slen,
 1650|    119|                       sent_auth->credential.digest.username.ptr,
 1651|    119|                       (int)sent_auth->credential.digest.realm.slen,
 1652|    119|                       sent_auth->credential.digest.realm.ptr));
 1653|    119|            return PJSIP_EFAILEDCREDENTIAL;
  ------------------
  |  |  329|    119|#define PJSIP_EFAILEDCREDENTIAL (PJSIP_ERRNO_START_PJSIP + 100) /* 171100 */
  |  |  ------------------
  |  |  |  |   73|    119|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    119|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|    119|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|    119|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|    119|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|    119|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|    119|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|    119|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|    119|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1654|    119|        }
 1655|       |
 1656|    489|        cached_auth->stale_cnt++;
 1657|    489|        if (cached_auth->stale_cnt >= PJSIP_MAX_STALE_COUNT) {
  ------------------
  |  | 1248|    489|#   define PJSIP_MAX_STALE_COUNT            3
  ------------------
  |  Branch (1657:13): [True: 287, False: 202]
  ------------------
 1658|       |            /* Our credential is rejected. No point in trying to re-supply
 1659|       |             * the same credential.
 1660|       |             */
 1661|    287|            PJ_LOG(4, (THIS_FILE, "Authorization failed for %.*s@%.*s: "
  ------------------
  |  |  106|    287|#define PJ_LOG(level,arg)       do { \
  |  |  107|    287|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    574|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 287, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 287]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|    287|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 287]
  |  |  ------------------
  ------------------
 1662|    287|                       "maximum number of stale retries exceeded",
 1663|    287|                       (int)sent_auth->credential.digest.username.slen,
 1664|    287|                       sent_auth->credential.digest.username.ptr,
 1665|    287|                       (int)sent_auth->credential.digest.realm.slen,
 1666|    287|                       sent_auth->credential.digest.realm.ptr));
 1667|    287|            return PJSIP_EAUTHSTALECOUNT;
  ------------------
  |  |  388|    287|#define PJSIP_EAUTHSTALECOUNT   (PJSIP_ERRNO_START_PJSIP + 111) /* 171111 */
  |  |  ------------------
  |  |  |  |   73|    287|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    287|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|    287|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|    287|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|    287|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|    287|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|    287|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|    287|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|    287|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1668|    287|        }
 1669|       |
 1670|       |        /* Otherwise remove old, stale authorization header from the mesasge.
 1671|       |         * We will supply a new one.
 1672|       |         */
 1673|    202|        pj_list_erase(sent_auth);
 1674|    202|    }
 1675|       |
 1676|       |    /* Find credential to be used for the challenge. */
 1677|  3.00k|    cred = auth_find_cred( sess, &hchal->challenge.common.realm,
 1678|  3.00k|                           &hchal->scheme, challenge_algorithm_type);
 1679|  3.00k|    if (!cred) {
  ------------------
  |  Branch (1679:9): [True: 1.82k, False: 1.17k]
  ------------------
 1680|  1.82k|        const pj_str_t *realm = &hchal->challenge.common.realm;
 1681|  1.82k|        AUTH_TRACE_((THIS_FILE, "No cred for for %.*s",
 1682|  1.82k|            (int)hchal->challenge.digest.algorithm.slen, hchal->challenge.digest.algorithm.ptr));
 1683|       |
 1684|  1.82k|        PJ_LOG(4,(THIS_FILE,
  ------------------
  |  |  106|  1.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  1.82k|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|  3.65k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 1.82k, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 1.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|  1.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 1.82k]
  |  |  ------------------
  ------------------
 1685|  1.82k|                  "Unable to set auth for %s: can not find credential for "
 1686|  1.82k|                  "%.*s/%.*s %.*s",
 1687|  1.82k|                  tdata->obj_name,
 1688|  1.82k|                  (int)realm->slen, realm->ptr,
 1689|  1.82k|                  (int)hchal->scheme.slen, hchal->scheme.ptr,
 1690|  1.82k|                  (int)hchal->challenge.digest.algorithm.slen, hchal->challenge.digest.algorithm.ptr));
 1691|  1.82k|        return PJSIP_ENOCREDENTIAL;
  ------------------
  |  |  337|  1.82k|#define PJSIP_ENOCREDENTIAL     (PJSIP_ERRNO_START_PJSIP + 101) /* 171101 */
  |  |  ------------------
  |  |  |  |   73|  1.82k|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.82k|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  1.82k|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|  1.82k|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|  1.82k|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|  1.82k|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|  1.82k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|  1.82k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|  1.82k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1692|  1.82k|    }
 1693|       |
 1694|       |    /* Respond to authorization challenge. */
 1695|  1.17k|    status = auth_respond( req_pool, hchal, uri, cred,
 1696|  1.17k|                           &tdata->msg->line.req.method,
 1697|  1.17k|                           sess->pool, cached_auth, h_auth, challenge_algorithm_type);
 1698|  1.17k|    return status;
 1699|  3.00k|}
sip_auth_client.c:auth_find_cred:
  848|  3.00k|{
  849|  3.00k|    unsigned i;
  850|  3.00k|    int wildcard = -1;
  851|  3.00k|    const pjsip_cred_info * ptr = NULL;
  852|       |
  853|  3.00k|    PJ_UNUSED_ARG(auth_scheme);
  ------------------
  |  | 1537|  3.00k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  854|       |
  855|  3.00k|    if (sess->parent) {
  ------------------
  |  Branch (855:9): [True: 0, False: 3.00k]
  ------------------
  856|      0|        pj_lock_acquire(sess->parent->lock);
  857|      0|        ptr = auth_find_cred(sess->parent, realm, auth_scheme, algorithm_type);
  858|      0|        pj_lock_release(sess->parent->lock);
  859|      0|    }
  860|  3.00k|    if (ptr != NULL) {
  ------------------
  |  Branch (860:9): [True: 0, False: 3.00k]
  ------------------
  861|      0|        return ptr;
  862|      0|    }
  863|       |
  864|  4.83k|    for (i=0; i<sess->cred_cnt; ++i) {
  ------------------
  |  Branch (864:15): [True: 3.00k, False: 1.82k]
  ------------------
  865|  3.00k|        switch(sess->cred_info[i].data_type) {
  ------------------
  |  Branch (865:16): [True: 3.00k, False: 0]
  ------------------
  866|  3.00k|        case PJSIP_CRED_DATA_PLAIN_PASSWD:
  ------------------
  |  Branch (866:9): [True: 3.00k, False: 0]
  ------------------
  867|       |            /* PLAIN_PASSWD creds can be used for any algorithm other than AKA */
  868|  3.00k|            if (algorithm_type != PJSIP_AUTH_ALGORITHM_AKAV1_MD5
  ------------------
  |  Branch (868:17): [True: 3.00k, False: 0]
  ------------------
  869|  3.00k|                    && algorithm_type != PJSIP_AUTH_ALGORITHM_AKAV2_MD5) {
  ------------------
  |  Branch (869:24): [True: 3.00k, False: 0]
  ------------------
  870|  3.00k|                break;
  871|  3.00k|            }
  872|      0|            continue;
  873|      0|        case PJSIP_CRED_DATA_DIGEST:
  ------------------
  |  Branch (873:9): [True: 0, False: 3.00k]
  ------------------
  874|       |            /* Digest creds can only be used if the algorithms match */
  875|      0|            if (sess->cred_info[i].algorithm_type == algorithm_type) {
  ------------------
  |  Branch (875:17): [True: 0, False: 0]
  ------------------
  876|      0|                break;
  877|      0|            }
  878|      0|            continue;
  879|      0|        case PJSIP_CRED_DATA_EXT_AKA:
  ------------------
  |  Branch (879:9): [True: 0, False: 3.00k]
  ------------------
  880|       |            /* AKA creds can only be used for AKA algorithm */
  881|      0|            if (algorithm_type == PJSIP_AUTH_ALGORITHM_AKAV1_MD5
  ------------------
  |  Branch (881:17): [True: 0, False: 0]
  ------------------
  882|      0|                    || algorithm_type == PJSIP_AUTH_ALGORITHM_AKAV2_MD5) {
  ------------------
  |  Branch (882:24): [True: 0, False: 0]
  ------------------
  883|      0|                break;
  884|      0|            }
  885|      0|            continue;
  886|  3.00k|        }
  887|       |        /*
  888|       |         * We've determined that the credential can be used for the
  889|       |         * specified algorithm, now check the realm.
  890|       |         */
  891|  3.00k|        if (pj_stricmp(&sess->cred_info[i].realm, realm) == 0)
  ------------------
  |  Branch (891:13): [True: 1.17k, False: 1.82k]
  ------------------
  892|  1.17k|            return &sess->cred_info[i];
  893|  1.82k|        else if (sess->cred_info[i].realm.slen == 1 &&
  ------------------
  |  Branch (893:18): [True: 0, False: 1.82k]
  ------------------
  894|      0|                 sess->cred_info[i].realm.ptr[0] == '*')
  ------------------
  |  Branch (894:18): [True: 0, False: 0]
  ------------------
  895|      0|        {
  896|      0|            wildcard = i;
  897|      0|        }
  898|  3.00k|    }
  899|       |
  900|       |    /* No matching realm. See if we have credential with wildcard ('*')
  901|       |     * as the realm.
  902|       |     */
  903|  1.82k|    if (wildcard != -1)
  ------------------
  |  Branch (903:9): [True: 0, False: 1.82k]
  ------------------
  904|      0|        return &sess->cred_info[wildcard];
  905|       |
  906|       |    /* Nothing is suitable */
  907|  1.82k|    return NULL;
  908|  1.82k|}
sip_auth_client.c:auth_respond:
 1160|  1.17k|{
 1161|  1.17k|    pjsip_authorization_hdr *hauth;
 1162|  1.17k|    char tmp[PJSIP_MAX_URL_SIZE];
 1163|  1.17k|    pj_str_t uri_str;
 1164|  1.17k|    pj_pool_t *pool;
 1165|  1.17k|    pj_status_t status;
 1166|       |
 1167|       |    /* Verify arguments. */
 1168|  1.17k|    PJ_ASSERT_RETURN(req_pool && hdr && uri && cred_info && method &&
  ------------------
  |  |   97|  1.17k|            do { \
  |  |   98|  16.4k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 1.17k, False: 0]
  |  |  |  Branch (98:23): [True: 1.17k, False: 0]
  |  |  |  Branch (98:23): [True: 1.17k, False: 0]
  |  |  |  Branch (98:23): [True: 1.17k, False: 0]
  |  |  |  Branch (98:23): [True: 1.17k, False: 0]
  |  |  |  Branch (98:23): [True: 1.17k, False: 0]
  |  |  |  Branch (98:23): [True: 1.17k, False: 0]
  |  |  |  Branch (98:23): [True: 1.17k, False: 0]
  |  |  ------------------
  |  |   99|  1.17k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1.17k]
  |  |  ------------------
  ------------------
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  |  Branch (1168:5): [True: 0, False: 0]
  ------------------
 1169|  1.17k|                     sess_pool && cached_auth && p_h_auth, PJ_EINVAL);
 1170|       |
 1171|       |    /* Print URL in the original request. */
 1172|  1.17k|    uri_str.ptr = tmp;
 1173|  1.17k|    uri_str.slen = pjsip_uri_print(PJSIP_URI_IN_REQ_URI, uri, tmp,sizeof(tmp));
 1174|  1.17k|    if (uri_str.slen < 1) {
  ------------------
  |  Branch (1174:9): [True: 0, False: 1.17k]
  ------------------
 1175|      0|        return PJSIP_EURITOOLONG;
  ------------------
  |  |  164|      0|#define PJSIP_EURITOOLONG       (PJSIP_ERRNO_START_PJSIP + 43)  /* 171043 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1176|      0|    }
 1177|       |
 1178|       |#   if (PJSIP_AUTH_HEADER_CACHING)
 1179|       |    {
 1180|       |        pool = sess_pool;
 1181|       |        PJ_UNUSED_ARG(req_pool);
 1182|       |    }
 1183|       |#   else
 1184|  1.17k|    {
 1185|  1.17k|        pool = req_pool;
 1186|  1.17k|        PJ_UNUSED_ARG(sess_pool);
  ------------------
  |  | 1537|  1.17k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1187|  1.17k|    }
 1188|  1.17k|#   endif
 1189|       |
 1190|  1.17k|    if (hdr->type == PJSIP_H_WWW_AUTHENTICATE)
  ------------------
  |  Branch (1190:9): [True: 848, False: 329]
  ------------------
 1191|    848|        hauth = pjsip_authorization_hdr_create(pool);
 1192|    329|    else if (hdr->type == PJSIP_H_PROXY_AUTHENTICATE)
  ------------------
  |  Branch (1192:14): [True: 329, False: 0]
  ------------------
 1193|    329|        hauth = pjsip_proxy_authorization_hdr_create(pool);
 1194|      0|    else {
 1195|      0|        return PJSIP_EINVALIDHDR;
  ------------------
  |  |  175|      0|#define PJSIP_EINVALIDHDR       (PJSIP_ERRNO_START_PJSIP + 51)  /* 171051 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1196|      0|    }
 1197|       |
 1198|       |    /* Only support digest scheme at the moment. */
 1199|  1.17k|    if (!pj_stricmp(&hdr->scheme, &pjsip_DIGEST_STR)) {
  ------------------
  |  Branch (1199:9): [True: 1.17k, False: 0]
  ------------------
 1200|  1.17k|        pj_str_t *cnonce = NULL;
 1201|  1.17k|        pj_uint32_t nc = 1;
 1202|       |
 1203|       |        /* Update the session (nonce-count etc) if required. */
 1204|  1.17k|#       if PJSIP_AUTH_QOP_SUPPORT
 1205|  1.17k|        {
 1206|  1.17k|            if (cached_auth) {
  ------------------
  |  Branch (1206:17): [True: 1.17k, False: 0]
  ------------------
 1207|  1.17k|                update_digest_session( cached_auth, hdr );
 1208|       |
 1209|  1.17k|                cnonce = &cached_auth->cnonce;
 1210|  1.17k|                nc = cached_auth->nc;
 1211|  1.17k|            }
 1212|  1.17k|        }
 1213|  1.17k|#       endif   /* PJSIP_AUTH_QOP_SUPPORT */
 1214|       |
 1215|  1.17k|        hauth->scheme = pjsip_DIGEST_STR;
 1216|  1.17k|        status = respond_digest( pool, &hauth->credential.digest,
 1217|  1.17k|                                 &hdr->challenge.digest, &uri_str, cred_info,
 1218|  1.17k|                                 cnonce, nc, &method->name, challenge_algorithm_type);
 1219|  1.17k|        if (status != PJ_SUCCESS)
  ------------------
  |  Branch (1219:13): [True: 667, False: 510]
  ------------------
 1220|    667|            return status;
 1221|       |
 1222|       |        /* Set qop type in auth session the first time only. */
 1223|    510|        if (hdr->challenge.digest.qop.slen != 0 && cached_auth) {
  ------------------
  |  Branch (1223:13): [True: 130, False: 380]
  |  Branch (1223:52): [True: 130, False: 0]
  ------------------
 1224|    130|            if (cached_auth->qop_value == PJSIP_AUTH_QOP_NONE) {
  ------------------
  |  Branch (1224:17): [True: 94, False: 36]
  ------------------
 1225|     94|                pj_str_t *qop_val = &hauth->credential.digest.qop;
 1226|     94|                if (!pj_strcmp(qop_val, &pjsip_AUTH_STR)) {
  ------------------
  |  Branch (1226:21): [True: 94, False: 0]
  ------------------
 1227|     94|                    cached_auth->qop_value = PJSIP_AUTH_QOP_AUTH;
 1228|     94|                } else {
 1229|      0|                    cached_auth->qop_value = PJSIP_AUTH_QOP_UNKNOWN;
 1230|      0|                }
 1231|     94|            }
 1232|    130|        }
 1233|    510|    } else {
 1234|      0|        return PJSIP_EINVALIDAUTHSCHEME;
  ------------------
  |  |  352|      0|#define PJSIP_EINVALIDAUTHSCHEME (PJSIP_ERRNO_START_PJSIP + 104)/* 171104 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1235|      0|    }
 1236|       |
 1237|       |    /* Keep the new authorization header in the cache, only
 1238|       |     * if no qop is not present.
 1239|       |     */
 1240|       |#   if PJSIP_AUTH_HEADER_CACHING
 1241|       |    {
 1242|       |        if (hauth && cached_auth && cached_auth->qop_value == PJSIP_AUTH_QOP_NONE) {
 1243|       |            pjsip_cached_auth_hdr *cached_hdr;
 1244|       |
 1245|       |            /* Delete old header with the same method. */
 1246|       |            cached_hdr = cached_auth->cached_hdr.next;
 1247|       |            while (cached_hdr != &cached_auth->cached_hdr) {
 1248|       |                if (pjsip_method_cmp(method, &cached_hdr->method)==0)
 1249|       |                    break;
 1250|       |                cached_hdr = cached_hdr->next;
 1251|       |            }
 1252|       |
 1253|       |            /* Save the header to the list. */
 1254|       |            if (cached_hdr != &cached_auth->cached_hdr) {
 1255|       |                cached_hdr->hdr = hauth;
 1256|       |            } else {
 1257|       |                cached_hdr = pj_pool_alloc(pool, sizeof(*cached_hdr));
 1258|       |                pjsip_method_copy( pool, &cached_hdr->method, method);
 1259|       |                cached_hdr->hdr = hauth;
 1260|       |                pj_list_insert_before( &cached_auth->cached_hdr, cached_hdr );
 1261|       |            }
 1262|       |        }
 1263|       |
 1264|       |#       if defined(PJSIP_AUTH_AUTO_SEND_NEXT) && PJSIP_AUTH_AUTO_SEND_NEXT!=0
 1265|       |            if (hdr != cached_auth->last_chal) {
 1266|       |                cached_auth->last_chal = pjsip_hdr_clone(sess_pool, hdr);
 1267|       |            }
 1268|       |#       endif
 1269|       |    }
 1270|       |#   endif
 1271|       |
 1272|    510|    *p_h_auth = hauth;
 1273|    510|    return PJ_SUCCESS;
 1274|       |
 1275|  1.17k|}
sip_auth_client.c:update_digest_session:
  721|  1.17k|{
  722|  1.17k|    if (hdr->challenge.digest.qop.slen == 0) {
  ------------------
  |  Branch (722:9): [True: 380, False: 797]
  ------------------
  723|       |#if PJSIP_AUTH_AUTO_SEND_NEXT!=0
  724|       |        if (!cached_auth->last_chal || pj_stricmp2(&hdr->scheme, "digest")) {
  725|       |            cached_auth->last_chal = (pjsip_www_authenticate_hdr*)
  726|       |                                     pjsip_hdr_clone(cached_auth->pool, hdr);
  727|       |        } else {
  728|       |            /* Only update if the new challenge is "significantly different"
  729|       |             * than the one in the cache, to reduce memory usage.
  730|       |             */
  731|       |            const pjsip_digest_challenge *d1 =
  732|       |                        &cached_auth->last_chal->challenge.digest;
  733|       |            const pjsip_digest_challenge *d2 = &hdr->challenge.digest;
  734|       |
  735|       |            if (pj_strcmp(&d1->domain, &d2->domain) ||
  736|       |                pj_strcmp(&d1->realm, &d2->realm) ||
  737|       |                pj_strcmp(&d1->nonce, &d2->nonce) ||
  738|       |                pj_strcmp(&d1->opaque, &d2->opaque) ||
  739|       |                pj_strcmp(&d1->algorithm, &d2->algorithm) ||
  740|       |                pj_strcmp(&d1->qop, &d2->qop))
  741|       |            {
  742|       |                cached_auth->last_chal = (pjsip_www_authenticate_hdr*)
  743|       |                                       pjsip_hdr_clone(cached_auth->pool, hdr);
  744|       |            }
  745|       |        }
  746|       |#endif
  747|    380|        return;
  748|    380|    }
  749|       |
  750|       |    /* Initialize cnonce and qop if not present. */
  751|    797|    if (cached_auth->cnonce.slen == 0) {
  ------------------
  |  Branch (751:9): [True: 272, False: 525]
  ------------------
  752|       |        /* Save the whole challenge */
  753|    272|        cached_auth->last_chal = (pjsip_www_authenticate_hdr*)
  754|    272|                                 pjsip_hdr_clone(cached_auth->pool, hdr);
  755|       |
  756|       |        /* Create cnonce */
  757|    272|        pj_create_unique_string( cached_auth->pool, &cached_auth->cnonce );
  758|    272|#if defined(PJSIP_AUTH_CNONCE_USE_DIGITS_ONLY) && \
  759|    272|    PJSIP_AUTH_CNONCE_USE_DIGITS_ONLY!=0
  760|    272|        if (pj_strchr(&cached_auth->cnonce, '-')) {
  ------------------
  |  Branch (760:13): [True: 115, False: 157]
  ------------------
  761|       |            /* remove hyphen character. */
  762|    115|            pj_size_t w, r, len = pj_strlen(&cached_auth->cnonce);
  763|    115|            char *s = cached_auth->cnonce.ptr;
  764|       |
  765|    115|            w = r = 0;
  766|  3.79k|            for (; r < len; r++) {
  ------------------
  |  Branch (766:20): [True: 3.68k, False: 115]
  ------------------
  767|  3.68k|                if (s[r] != '-')
  ------------------
  |  Branch (767:21): [True: 3.53k, False: 149]
  ------------------
  768|  3.53k|                    s[w++] = s[r];
  769|  3.68k|            }
  770|    115|            s[w] = '\0';
  771|    115|            cached_auth->cnonce.slen = w;
  772|    115|        }
  773|    272|#endif
  774|       |
  775|       |        /* Initialize nonce-count */
  776|    272|        cached_auth->nc = 1;
  777|       |
  778|       |        /* Save realm. */
  779|       |        /* Note: allow empty realm (https://github.com/pjsip/pjproject/issues/1061)
  780|       |        pj_assert(cached_auth->realm.slen != 0);
  781|       |        */
  782|    272|        if (cached_auth->realm.slen == 0) {
  ------------------
  |  Branch (782:13): [True: 0, False: 272]
  ------------------
  783|      0|            pj_strdup(cached_auth->pool, &cached_auth->realm,
  784|      0|                      &hdr->challenge.digest.realm);
  785|      0|        }
  786|       |
  787|    525|    } else {
  788|       |        /* Update last_nonce and nonce-count */
  789|    525|        if (!pj_strcmp(&hdr->challenge.digest.nonce,
  ------------------
  |  Branch (789:13): [True: 249, False: 276]
  ------------------
  790|    525|                       &cached_auth->last_chal->challenge.digest.nonce))
  791|    249|        {
  792|       |            /* Same nonce, increment nonce-count */
  793|    249|            ++cached_auth->nc;
  794|    276|        } else {
  795|       |            /* Server gives new nonce. */
  796|    276|            pj_strdup(cached_auth->pool, 
  797|    276|                      &cached_auth->last_chal->challenge.digest.nonce,
  798|    276|                      &hdr->challenge.digest.nonce);
  799|       |            /* Has the opaque changed? */
  800|    276|            if (pj_strcmp(&cached_auth->last_chal->challenge.digest.opaque,
  ------------------
  |  Branch (800:17): [True: 150, False: 126]
  ------------------
  801|    276|                          &hdr->challenge.digest.opaque))
  802|    150|            {
  803|    150|                pj_strdup(cached_auth->pool,
  804|    150|                          &cached_auth->last_chal->challenge.digest.opaque,
  805|    150|                          &hdr->challenge.digest.opaque);
  806|    150|            }
  807|    276|            cached_auth->nc = 1;
  808|    276|        }
  809|    525|    }
  810|    797|}
sip_auth_client.c:respond_digest:
  641|  1.17k|{
  642|  1.17k|    pj_status_t status = PJ_SUCCESS;
  643|       |
  644|  1.17k|    AUTH_TRACE_((THIS_FILE, "Begin responding to %.*s challenge",
  645|  1.17k|        (int)chal->algorithm.slen, chal->algorithm.ptr));
  646|       |
  647|       |    /* Build digest credential from arguments. */
  648|  1.17k|    pj_strdup(pool, &cred->username, &cred_info->username);
  649|  1.17k|    pj_strdup(pool, &cred->realm, &chal->realm);
  650|  1.17k|    pj_strdup(pool, &cred->nonce, &chal->nonce);
  651|  1.17k|    pj_strdup(pool, &cred->uri, uri);
  652|  1.17k|    pj_strdup(pool, &cred->algorithm, &chal->algorithm);
  653|  1.17k|    pj_strdup(pool, &cred->opaque, &chal->opaque);
  654|       |
  655|       |    /* Allocate memory. */
  656|  1.17k|    cred->response.slen = pjsip_auth_algorithms[challenge_algorithm_type].digest_str_length;
  657|  1.17k|    cred->response.ptr = (char*) pj_pool_alloc(pool, cred->response.slen);
  658|       |
  659|  1.17k|    if (chal->qop.slen == 0) {
  ------------------
  |  Branch (659:9): [True: 380, False: 797]
  ------------------
  660|       |        /* Server doesn't require quality of protection. */
  661|       |
  662|    380|        if (PJSIP_CRED_DATA_IS_AKA(cred_info)) {
  ------------------
  |  |  119|    380|#define PJSIP_CRED_DATA_IS_AKA(cred) (((cred)->data_type & PJSIP_CRED_DATA_EXT_MASK) == PJSIP_CRED_DATA_EXT_AKA)
  |  |  ------------------
  |  |  |  |  117|    380|#define PJSIP_CRED_DATA_EXT_MASK            0x00F0
  |  |  ------------------
  |  |  |  Branch (119:38): [True: 0, False: 380]
  |  |  ------------------
  ------------------
  663|       |            /* Call application callback to create the response digest */
  664|      0|            return (*cred_info->ext.aka.cb)(pool, chal, cred_info,
  665|      0|                                            method, cred);
  666|      0|        }
  667|    380|        else {
  668|       |            /* Convert digest to string and store in chal->response. */
  669|    380|            status = pjsip_auth_create_digest2(
  670|    380|                                      &cred->response, &cred->nonce, NULL,
  671|    380|                                      NULL,  NULL, uri, &chal->realm,
  672|    380|                                      cred_info, method, challenge_algorithm_type);
  673|    380|        }
  674|       |
  675|    797|    } else if (has_auth_qop(pool, &chal->qop)) {
  ------------------
  |  Branch (675:16): [True: 130, False: 667]
  ------------------
  676|       |        /* Server requires quality of protection.
  677|       |         * We respond with selecting "qop=auth" protection.
  678|       |         */
  679|    130|        cred->qop = pjsip_AUTH_STR;
  680|    130|        cred->nc.ptr = (char*) pj_pool_alloc(pool, 16);
  681|    130|        cred->nc.slen = pj_ansi_snprintf(cred->nc.ptr, 16, "%08u", nc);
  ------------------
  |  |  114|    130|#define pj_ansi_snprintf        snprintf
  ------------------
  682|       |
  683|    130|        if (cnonce && cnonce->slen) {
  ------------------
  |  Branch (683:13): [True: 130, False: 0]
  |  Branch (683:23): [True: 130, False: 0]
  ------------------
  684|    130|            pj_strdup(pool, &cred->cnonce, cnonce);
  685|    130|        } else {
  686|      0|            pj_str_t dummy_cnonce = { "b39971", 6};
  687|      0|            pj_strdup(pool, &cred->cnonce, &dummy_cnonce);
  688|      0|        }
  689|       |
  690|    130|        if (PJSIP_CRED_DATA_IS_AKA(cred_info)) {
  ------------------
  |  |  119|    130|#define PJSIP_CRED_DATA_IS_AKA(cred) (((cred)->data_type & PJSIP_CRED_DATA_EXT_MASK) == PJSIP_CRED_DATA_EXT_AKA)
  |  |  ------------------
  |  |  |  |  117|    130|#define PJSIP_CRED_DATA_EXT_MASK            0x00F0
  |  |  ------------------
  |  |  |  Branch (119:38): [True: 0, False: 130]
  |  |  ------------------
  ------------------
  691|       |            /* Call application callback to create the response digest */
  692|      0|            return (*cred_info->ext.aka.cb)(pool, chal, cred_info,
  693|      0|                                            method, cred);
  694|      0|        }
  695|    130|        else {
  696|       |            /* Convert digest to string and store in chal->response. */
  697|    130|            status = pjsip_auth_create_digest2(
  698|    130|                                      &cred->response, &cred->nonce,
  699|    130|                                      &cred->nc, &cred->cnonce,
  700|    130|                                      &pjsip_AUTH_STR, uri,
  701|    130|                                      &chal->realm, cred_info,
  702|    130|                                      method, challenge_algorithm_type);
  703|    130|        }
  704|       |
  705|    667|    } else {
  706|       |        /* Server requires quality protection that we don't support. */
  707|    667|        PJ_LOG(4,(THIS_FILE, "Unsupported qop offer %.*s",
  ------------------
  |  |  106|    667|#define PJ_LOG(level,arg)       do { \
  |  |  107|    667|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|  1.33k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 667, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 667]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|    667|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 667]
  |  |  ------------------
  ------------------
  708|    667|                  (int)chal->qop.slen, chal->qop.ptr));
  709|    667|        return PJSIP_EINVALIDQOP;
  ------------------
  |  |  347|    667|#define PJSIP_EINVALIDQOP       (PJSIP_ERRNO_START_PJSIP + 103) /* 171103 */
  |  |  ------------------
  |  |  |  |   73|    667|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    667|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|    667|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|    667|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|    667|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|    667|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|    667|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|    667|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|    667|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  710|    667|    }
  711|       |
  712|    510|    return status;
  713|  1.17k|}
sip_auth_client.c:has_auth_qop:
  596|    797|{
  597|    797|    pj_str_t qop;
  598|    797|    char *p;
  599|       |
  600|    797|    pj_strdup_with_null( pool, &qop, qop_offer);
  601|    797|    p = qop.ptr;
  602|  16.4k|    while (*p) {
  ------------------
  |  Branch (602:12): [True: 15.6k, False: 797]
  ------------------
  603|  15.6k|        *p = (char)pj_tolower(*p);
  604|  15.6k|        ++p;
  605|  15.6k|    }
  606|       |
  607|    797|    p = qop.ptr;
  608|  14.5k|    while (*p) {
  ------------------
  |  Branch (608:12): [True: 13.9k, False: 667]
  ------------------
  609|  13.9k|        if (*p=='a' && *(p+1)=='u' && *(p+2)=='t' && *(p+3)=='h') {
  ------------------
  |  Branch (609:13): [True: 2.58k, False: 11.3k]
  |  Branch (609:24): [True: 1.64k, False: 949]
  |  Branch (609:39): [True: 1.47k, False: 169]
  |  Branch (609:54): [True: 562, False: 909]
  ------------------
  610|    562|            int e = *(p+4);
  611|    562|            if (e=='"' || e==',' || e==0)
  ------------------
  |  Branch (611:17): [True: 0, False: 562]
  |  Branch (611:27): [True: 10, False: 552]
  |  Branch (611:37): [True: 120, False: 432]
  ------------------
  612|    130|                return PJ_TRUE;
  613|    432|            else
  614|    432|                p += 4;
  615|  13.3k|        } else {
  616|  13.3k|            ++p;
  617|  13.3k|        }
  618|  13.9k|    }
  619|       |
  620|    667|    return PJ_FALSE;
  621|    797|}
sip_auth_client.c:recreate_cached_auth_pool:
 1534|     52|{
 1535|     52|    pj_pool_t *auth_pool = pjsip_endpt_create_pool(endpt, "auth_cli%p", 1024, 
 1536|     52|                                                   1024);
 1537|       |
 1538|     52|    if (auth->realm.slen) {
  ------------------
  |  Branch (1538:9): [True: 52, False: 0]
  ------------------
 1539|     52|        pj_str_t realm;
 1540|     52|        pj_strdup(auth_pool, &realm, &auth->realm);
 1541|     52|        pj_strassign(&auth->realm, &realm);
 1542|     52|    }
 1543|       |
 1544|     52|    if (auth->cnonce.slen) {
  ------------------
  |  Branch (1544:9): [True: 52, False: 0]
  ------------------
 1545|     52|        pj_str_t cnonce;
 1546|     52|        pj_strdup(auth_pool, &cnonce, &auth->cnonce);
 1547|     52|        pj_strassign(&auth->cnonce, &cnonce);
 1548|     52|    }
 1549|       |
 1550|     52|    if (auth->last_chal) {
  ------------------
  |  Branch (1550:9): [True: 52, False: 0]
  ------------------
 1551|     52|        auth->last_chal = (pjsip_www_authenticate_hdr*)
 1552|     52|                          pjsip_hdr_clone(auth_pool, auth->last_chal);
 1553|     52|    }
 1554|       |
 1555|     52|    pjsip_endpt_release_pool(endpt, auth->pool);
 1556|     52|    auth->pool = auth_pool;
 1557|     52|}

pjsip_authorization_hdr_create:
   48|  2.09k|{
   49|  2.09k|    pjsip_authorization_hdr *hdr;
   50|  2.09k|    hdr = PJ_POOL_ZALLOC_T(pool, pjsip_authorization_hdr);
  ------------------
  |  |  583|  2.09k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
   51|  2.09k|    init_hdr(hdr, PJSIP_H_AUTHORIZATION, &authorization_hdr_vptr);
   52|  2.09k|    pj_list_init(&hdr->credential.common.other_param);
   53|  2.09k|    return hdr;
   54|  2.09k|}
pjsip_proxy_authorization_hdr_create:
   57|    529|{
   58|    529|    pjsip_proxy_authorization_hdr *hdr;
   59|    529|    hdr = PJ_POOL_ZALLOC_T(pool, pjsip_proxy_authorization_hdr);
  ------------------
  |  |  583|    529|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
   60|    529|    init_hdr(hdr, PJSIP_H_PROXY_AUTHORIZATION, &authorization_hdr_vptr);
   61|    529|    pj_list_init(&hdr->credential.common.other_param);
   62|    529|    return hdr;
   63|    529|}
pjsip_www_authenticate_hdr_create:
  231|  2.62k|{
  232|  2.62k|    pjsip_www_authenticate_hdr *hdr;
  233|  2.62k|    hdr = PJ_POOL_ZALLOC_T(pool, pjsip_www_authenticate_hdr);
  ------------------
  |  |  583|  2.62k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  234|  2.62k|    init_hdr(hdr, PJSIP_H_WWW_AUTHENTICATE, &www_authenticate_hdr_vptr);
  235|  2.62k|    pj_list_init(&hdr->challenge.common.other_param);
  236|  2.62k|    return hdr;
  237|  2.62k|}
pjsip_proxy_authenticate_hdr_create:
  241|  2.61k|{
  242|  2.61k|    pjsip_proxy_authenticate_hdr *hdr;
  243|  2.61k|    hdr = PJ_POOL_ZALLOC_T(pool, pjsip_proxy_authenticate_hdr);
  ------------------
  |  |  583|  2.61k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  244|  2.61k|    init_hdr(hdr, PJSIP_H_PROXY_AUTHENTICATE, &www_authenticate_hdr_vptr);
  245|  2.61k|    pj_list_init(&hdr->challenge.common.other_param);
  246|  2.61k|    return hdr;
  247|  2.61k|}
sip_auth_msg.c:pjsip_www_authenticate_hdr_clone:
  321|    324|{
  322|       |    /* This function also serves Proxy-Authenticate header. */
  323|    324|    pjsip_www_authenticate_hdr *hdr;
  324|    324|    if (rhs->type == PJSIP_H_WWW_AUTHENTICATE)
  ------------------
  |  Branch (324:9): [True: 285, False: 39]
  ------------------
  325|    285|        hdr = pjsip_www_authenticate_hdr_create(pool);
  326|     39|    else
  327|     39|        hdr = pjsip_proxy_authenticate_hdr_create(pool);
  328|       |
  329|    324|    pj_strdup(pool, &hdr->scheme, &rhs->scheme);
  330|       |
  331|    324|    if (pj_stricmp2(&hdr->scheme, "digest") == 0) {
  ------------------
  |  Branch (331:9): [True: 324, False: 0]
  ------------------
  332|    324|        pj_strdup(pool, &hdr->challenge.digest.realm, &rhs->challenge.digest.realm);
  333|    324|        pj_strdup(pool, &hdr->challenge.digest.domain, &rhs->challenge.digest.domain);
  334|    324|        pj_strdup(pool, &hdr->challenge.digest.nonce, &rhs->challenge.digest.nonce);
  335|    324|        pj_strdup(pool, &hdr->challenge.digest.opaque, &rhs->challenge.digest.opaque);
  336|    324|        hdr->challenge.digest.stale = rhs->challenge.digest.stale;
  337|    324|        pj_strdup(pool, &hdr->challenge.digest.algorithm, &rhs->challenge.digest.algorithm);
  338|    324|        pj_strdup(pool, &hdr->challenge.digest.qop, &rhs->challenge.digest.qop);
  339|    324|        pjsip_param_clone(pool, &hdr->challenge.digest.other_param, 
  340|    324|                          &rhs->challenge.digest.other_param);
  341|    324|    } else if (pj_stricmp2(&hdr->scheme, "pgp") == 0) {
  ------------------
  |  Branch (341:16): [True: 0, False: 0]
  ------------------
  342|      0|        pj_assert(0);
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (342:9): [Folded, False: 0]
  |  Branch (342:9): [Folded, False: 0]
  ------------------
  343|      0|        return NULL;
  344|      0|    } else {
  345|      0|        pj_assert(0);
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (345:9): [Folded, False: 0]
  |  Branch (345:9): [Folded, False: 0]
  ------------------
  346|      0|        return NULL;
  347|      0|    }
  348|       |
  349|    324|    return hdr;
  350|       |
  351|    324|}

pjsip_auth_init_parser:
  295|      1|{
  296|      1|    pj_status_t status;
  297|       |
  298|      1|    status = pjsip_register_hdr_parser( "Authorization", NULL, 
  299|      1|                                        &parse_hdr_authorization);
  300|      1|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (300:5): [True: 0, False: 0]
  |  Branch (300:5): [True: 0, False: 0]
  ------------------
  301|      1|    status = pjsip_register_hdr_parser( "Proxy-Authorization", NULL, 
  302|      1|                                        &parse_hdr_proxy_authorization);
  303|      1|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (303:5): [True: 0, False: 0]
  |  Branch (303:5): [True: 0, False: 0]
  ------------------
  304|      1|    status = pjsip_register_hdr_parser( "WWW-Authenticate", NULL, 
  305|      1|                                        &parse_hdr_www_authenticate);
  306|      1|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (306:5): [True: 0, False: 0]
  |  Branch (306:5): [True: 0, False: 0]
  ------------------
  307|      1|    status = pjsip_register_hdr_parser( "Proxy-Authenticate", NULL, 
  308|      1|                                        &parse_hdr_proxy_authenticate);
  309|      1|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (309:5): [True: 0, False: 0]
  |  Branch (309:5): [True: 0, False: 0]
  ------------------
  310|       |
  311|      1|    return PJ_SUCCESS;
  312|      1|}
sip_auth_parser.c:parse_hdr_authorization:
  263|  1.24k|{
  264|  1.24k|    pjsip_authorization_hdr *hdr = pjsip_authorization_hdr_create(ctx->pool);
  265|  1.24k|    int_parse_hdr_authorization(ctx->scanner, ctx->pool, hdr);
  266|  1.24k|    return (pjsip_hdr*)hdr;
  267|  1.24k|}
sip_auth_parser.c:int_parse_hdr_authorization:
  207|  1.44k|{
  208|  1.44k|    const pjsip_parser_const_t *pc = pjsip_parser_const();
  209|       |    
  210|  1.44k|    if (*scanner->curptr == '"') {
  ------------------
  |  Branch (210:9): [True: 206, False: 1.23k]
  ------------------
  211|    206|        pj_scan_get_quote(scanner, '"', '"', &hdr->scheme);
  212|    206|        hdr->scheme.ptr++;
  213|    206|        hdr->scheme.slen -= 2;
  214|  1.23k|    } else {
  215|  1.23k|        pj_scan_get(scanner, &pc->pjsip_TOKEN_SPEC, &hdr->scheme);
  216|  1.23k|    }
  217|       |
  218|  1.44k|    if (!pj_stricmp(&hdr->scheme, &pjsip_DIGEST_STR)) {
  ------------------
  |  Branch (218:9): [True: 620, False: 825]
  ------------------
  219|       |
  220|    620|        parse_digest_credential(scanner, pool, &hdr->credential.digest);
  221|       |
  222|    825|    } else if (!pj_stricmp(&hdr->scheme, &pjsip_PGP_STR)) {
  ------------------
  |  Branch (222:16): [True: 194, False: 631]
  ------------------
  223|       |
  224|    194|        parse_pgp_credential( scanner, pool, &hdr->credential.pgp);
  225|       |
  226|    631|    } else {
  227|    631|        PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|    631|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
  228|    631|    }
  229|       |
  230|    814|    pjsip_parse_end_hdr_imp( scanner );
  231|    814|}
sip_auth_parser.c:parse_digest_credential:
   72|    620|{
   73|    620|    pj_list_init(&cred->other_param);
   74|       |
   75|  3.17k|    for (;;) {
   76|  3.17k|        pj_str_t name, value;
   77|       |
   78|  3.17k|        pjsip_parse_param_imp(scanner, pool, &name, &value,
   79|  3.17k|                              PJSIP_PARSE_REMOVE_QUOTE);
   80|       |
   81|  3.17k|        if (!pj_stricmp(&name, &pjsip_USERNAME_STR)) {
  ------------------
  |  Branch (81:13): [True: 194, False: 2.97k]
  ------------------
   82|    194|            cred->username = value;
   83|       |
   84|  2.97k|        } else if (!pj_stricmp(&name, &pjsip_REALM_STR)) {
  ------------------
  |  Branch (84:20): [True: 194, False: 2.78k]
  ------------------
   85|    194|            cred->realm = value;
   86|       |
   87|  2.78k|        } else if (!pj_stricmp(&name, &pjsip_NONCE_STR)) {
  ------------------
  |  Branch (87:20): [True: 194, False: 2.59k]
  ------------------
   88|    194|            cred->nonce = value;
   89|       |
   90|  2.59k|        } else if (!pj_stricmp(&name, &pjsip_URI_STR)) {
  ------------------
  |  Branch (90:20): [True: 194, False: 2.39k]
  ------------------
   91|    194|            cred->uri = value;
   92|       |
   93|  2.39k|        } else if (!pj_stricmp(&name, &pjsip_RESPONSE_STR)) {
  ------------------
  |  Branch (93:20): [True: 194, False: 2.20k]
  ------------------
   94|    194|            cred->response = value;
   95|       |
   96|  2.20k|        } else if (!pj_stricmp(&name, &pjsip_ALGORITHM_STR)) {
  ------------------
  |  Branch (96:20): [True: 194, False: 2.00k]
  ------------------
   97|    194|            cred->algorithm = value;
   98|       |
   99|  2.00k|        } else if (!pj_stricmp(&name, &pjsip_CNONCE_STR)) {
  ------------------
  |  Branch (99:20): [True: 194, False: 1.81k]
  ------------------
  100|    194|            cred->cnonce = value;
  101|       |
  102|  1.81k|        } else if (!pj_stricmp(&name, &pjsip_OPAQUE_STR)) {
  ------------------
  |  Branch (102:20): [True: 194, False: 1.62k]
  ------------------
  103|    194|            cred->opaque = value;
  104|       |
  105|  1.62k|        } else if (!pj_stricmp(&name, &pjsip_QOP_STR)) {
  ------------------
  |  Branch (105:20): [True: 194, False: 1.42k]
  ------------------
  106|    194|            cred->qop = value;
  107|       |
  108|  1.42k|        } else if (!pj_stricmp(&name, &pjsip_NC_STR)) {
  ------------------
  |  Branch (108:20): [True: 194, False: 1.23k]
  ------------------
  109|    194|            cred->nc = value;
  110|       |
  111|  1.23k|        } else {
  112|  1.23k|            pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  569|  1.23k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  113|  1.23k|            p->name = name;
  114|  1.23k|            p->value = value;
  115|  1.23k|            pj_list_insert_before(&cred->other_param, p);
  116|  1.23k|        }
  117|       |
  118|       |        /* Eat comma */
  119|  3.17k|        if (!pj_scan_is_eof(scanner) && *scanner->curptr == ',')
  ------------------
  |  Branch (119:13): [True: 3.02k, False: 144]
  |  Branch (119:41): [True: 2.55k, False: 476]
  ------------------
  120|  2.55k|            pj_scan_get_char(scanner);
  121|    620|        else
  122|    620|            break;
  123|  3.17k|    }
  124|    620|}
sip_auth_parser.c:parse_pgp_credential:
  128|    194|{
  129|    194|    PJ_UNUSED_ARG(scanner);
  ------------------
  |  | 1537|    194|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  130|    194|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|    194|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  131|    194|    PJ_UNUSED_ARG(cred);
  ------------------
  |  | 1537|    194|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  132|       |
  133|    194|    PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|    194|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
  134|    194|}
sip_auth_parser.c:parse_hdr_proxy_authorization:
  270|    200|{
  271|    200|    pjsip_proxy_authorization_hdr *hdr = 
  272|    200|        pjsip_proxy_authorization_hdr_create(ctx->pool);
  273|    200|    int_parse_hdr_authorization(ctx->scanner, ctx->pool, hdr);
  274|    200|    return (pjsip_hdr*)hdr;
  275|    200|}
sip_auth_parser.c:parse_hdr_www_authenticate:
  278|  2.34k|{
  279|  2.34k|    pjsip_www_authenticate_hdr *hdr = 
  280|  2.34k|        pjsip_www_authenticate_hdr_create(ctx->pool);
  281|  2.34k|    int_parse_hdr_authenticate(ctx->scanner, ctx->pool, hdr);
  282|  2.34k|    return (pjsip_hdr*)hdr;
  283|  2.34k|}
sip_auth_parser.c:int_parse_hdr_authenticate:
  235|  4.91k|{
  236|  4.91k|    const pjsip_parser_const_t *pc = pjsip_parser_const();
  237|       |
  238|  4.91k|    if (*scanner->curptr == '"') {
  ------------------
  |  Branch (238:9): [True: 203, False: 4.70k]
  ------------------
  239|    203|        pj_scan_get_quote(scanner, '"', '"', &hdr->scheme);
  240|    203|        hdr->scheme.ptr++;
  241|    203|        hdr->scheme.slen -= 2;
  242|  4.70k|    } else {
  243|  4.70k|        pj_scan_get(scanner, &pc->pjsip_TOKEN_SPEC, &hdr->scheme);
  244|  4.70k|    }
  245|       |
  246|  4.91k|    if (!pj_stricmp(&hdr->scheme, &pjsip_DIGEST_STR)) {
  ------------------
  |  Branch (246:9): [True: 4.17k, False: 735]
  ------------------
  247|       |
  248|  4.17k|        parse_digest_challenge(scanner, pool, &hdr->challenge.digest);
  249|       |
  250|  4.17k|    } else if (!pj_stricmp(&hdr->scheme, &pjsip_PGP_STR)) {
  ------------------
  |  Branch (250:16): [True: 203, False: 532]
  ------------------
  251|       |
  252|    203|        parse_pgp_challenge(scanner, pool, &hdr->challenge.pgp);
  253|       |
  254|    532|    } else {
  255|    532|        PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|    532|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
  256|    532|    }
  257|       |
  258|  4.37k|    pjsip_parse_end_hdr_imp( scanner );
  259|  4.37k|}
sip_auth_parser.c:parse_digest_challenge:
  138|  4.17k|{
  139|  4.17k|    pj_list_init(&chal->other_param);
  140|       |
  141|  23.0k|    for (;;) {
  142|  23.0k|        pj_str_t name, value, unquoted_value;
  143|       |
  144|  23.0k|        pjsip_parse_param_imp(scanner, pool, &name, &value, 0);
  145|       |
  146|  23.0k|        if (value.ptr && (value.ptr[0] == '"')) {
  ------------------
  |  Branch (146:13): [True: 18.1k, False: 4.88k]
  |  Branch (146:26): [True: 5.46k, False: 12.7k]
  ------------------
  147|  5.46k|            unquoted_value.ptr = value.ptr + 1;
  148|  5.46k|            unquoted_value.slen = value.slen - 2;
  149|  17.5k|        } else {
  150|  17.5k|            unquoted_value.ptr = value.ptr;
  151|  17.5k|            unquoted_value.slen = value.slen;
  152|  17.5k|        }
  153|       |
  154|  23.0k|        if (!pj_stricmp(&name, &pjsip_REALM_STR)) {
  ------------------
  |  Branch (154:13): [True: 2.31k, False: 20.7k]
  ------------------
  155|  2.31k|            chal->realm = unquoted_value;
  156|       |
  157|  20.7k|        } else if (!pj_stricmp(&name, &pjsip_DOMAIN_STR)) {
  ------------------
  |  Branch (157:20): [True: 202, False: 20.5k]
  ------------------
  158|    202|            chal->domain = unquoted_value;
  159|       |
  160|  20.5k|        } else if (!pj_stricmp(&name, &pjsip_NONCE_STR)) {
  ------------------
  |  Branch (160:20): [True: 920, False: 19.6k]
  ------------------
  161|    920|            chal->nonce = unquoted_value;
  162|       |
  163|  19.6k|        } else if (!pj_stricmp(&name, &pjsip_OPAQUE_STR)) {
  ------------------
  |  Branch (163:20): [True: 361, False: 19.2k]
  ------------------
  164|    361|            chal->opaque = unquoted_value;
  165|       |
  166|  19.2k|        } else if (!pj_stricmp(&name, &pjsip_STALE_STR)) {
  ------------------
  |  Branch (166:20): [True: 606, False: 18.6k]
  ------------------
  167|    606|            if (!pj_stricmp(&value, &pjsip_TRUE_STR) || 
  ------------------
  |  Branch (167:17): [True: 73, False: 533]
  ------------------
  168|    533|                !pj_stricmp(&value, &pjsip_QUOTED_TRUE_STR))
  ------------------
  |  Branch (168:17): [True: 403, False: 130]
  ------------------
  169|    476|            {
  170|    476|                chal->stale = 1;
  171|    476|            }
  172|       |
  173|  18.6k|        } else if (!pj_stricmp(&name, &pjsip_ALGORITHM_STR)) {
  ------------------
  |  Branch (173:20): [True: 354, False: 18.3k]
  ------------------
  174|    354|            chal->algorithm = unquoted_value;
  175|       |
  176|       |
  177|  18.3k|        } else if (!pj_stricmp(&name, &pjsip_QOP_STR)) {
  ------------------
  |  Branch (177:20): [True: 1.03k, False: 17.2k]
  ------------------
  178|  1.03k|            chal->qop = unquoted_value;
  179|       |
  180|  17.2k|        } else {
  181|  17.2k|            pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  569|  17.2k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  182|  17.2k|            p->name = name;
  183|  17.2k|            p->value = value;
  184|  17.2k|            pj_list_insert_before(&chal->other_param, p);
  185|  17.2k|        }
  186|       |
  187|       |        /* Eat comma */
  188|  23.0k|        if (!pj_scan_is_eof(scanner) && *scanner->curptr == ',')
  ------------------
  |  Branch (188:13): [True: 22.6k, False: 383]
  |  Branch (188:41): [True: 18.8k, False: 3.79k]
  ------------------
  189|  18.8k|            pj_scan_get_char(scanner);
  190|  4.17k|        else
  191|  4.17k|            break;
  192|  23.0k|    }
  193|  4.17k|}
sip_auth_parser.c:parse_pgp_challenge:
  197|    203|{
  198|    203|    PJ_UNUSED_ARG(scanner);
  ------------------
  |  | 1537|    203|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  199|    203|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|    203|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  200|    203|    PJ_UNUSED_ARG(chal);
  ------------------
  |  | 1537|    203|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  201|       |
  202|    203|    PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|    203|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
  203|    203|}
sip_auth_parser.c:parse_hdr_proxy_authenticate:
  286|  2.57k|{
  287|  2.57k|    pjsip_proxy_authenticate_hdr *hdr = 
  288|  2.57k|        pjsip_proxy_authenticate_hdr_create(ctx->pool);
  289|  2.57k|    int_parse_hdr_authenticate(ctx->scanner, ctx->pool, hdr);
  290|  2.57k|    return (pjsip_hdr*)hdr;
  291|  2.57k|}

pjsip_dlg_create_uac:
  173|     87|{
  174|     87|    pjsip_dlg_create_uac_param create_param;
  175|       |
  176|     87|    PJ_ASSERT_RETURN(ua && local_uri && remote_uri && p_dlg, PJ_EINVAL);
  ------------------
  |  |   97|     87|            do { \
  |  |   98|    522|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  ------------------
  |  |   99|     87|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 87]
  |  |  ------------------
  ------------------
  |  Branch (176:5): [True: 0, False: 0]
  |  Branch (176:5): [True: 0, False: 0]
  |  Branch (176:5): [True: 0, False: 0]
  |  Branch (176:5): [True: 0, False: 0]
  |  Branch (176:5): [True: 0, False: 0]
  |  Branch (176:5): [True: 0, False: 0]
  |  Branch (176:5): [True: 0, False: 0]
  |  Branch (176:5): [True: 0, False: 0]
  ------------------
  177|       |
  178|     87|    pj_bzero(&create_param, sizeof(create_param));
  179|     87|    create_param.ua = ua;
  180|     87|    create_param.local_uri = *local_uri;
  181|     87|    create_param.remote_uri = *remote_uri;
  182|     87|    if (local_contact)
  ------------------
  |  Branch (182:9): [True: 0, False: 87]
  ------------------
  183|      0|        create_param.local_contact = *local_contact;
  184|       |
  185|     87|    if (target)
  ------------------
  |  Branch (185:9): [True: 87, False: 0]
  ------------------
  186|     87|        create_param.target = *target;
  187|       |
  188|     87|    return pjsip_dlg_create_uac2(&create_param, p_dlg);
  189|     87|}
pjsip_dlg_create_uac2:
  194|     87|{
  195|     87|    pj_status_t status;
  196|     87|    pj_str_t tmp;
  197|     87|    pjsip_dialog *dlg;
  198|       |
  199|       |    /* Check arguments. */
  200|     87|    PJ_ASSERT_RETURN(create_param->ua && create_param->local_uri.slen &&
  ------------------
  |  |   97|     87|            do { \
  |  |   98|    522|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  ------------------
  |  |   99|     87|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 87]
  |  |  ------------------
  ------------------
  |  Branch (200:5): [True: 0, False: 0]
  |  Branch (200:5): [True: 0, False: 0]
  |  Branch (200:5): [True: 0, False: 0]
  |  Branch (200:5): [True: 0, False: 0]
  |  Branch (200:5): [True: 0, False: 0]
  |  Branch (200:5): [True: 0, False: 0]
  |  Branch (200:5): [True: 0, False: 0]
  |  Branch (200:5): [True: 0, False: 0]
  ------------------
  201|     87|                     create_param->remote_uri.slen && p_dlg, PJ_EINVAL);
  202|       |
  203|       |    /* Create dialog instance. */
  204|     87|    status = create_dialog(create_param->ua, create_param->grp_lock, &dlg);
  205|     87|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (205:9): [True: 0, False: 87]
  ------------------
  206|      0|        return status;
  207|       |
  208|       |    /* Parse target. */
  209|     87|    pj_strdup_with_null(dlg->pool, &tmp, create_param->target.slen ?
  ------------------
  |  Branch (209:42): [True: 87, False: 0]
  ------------------
  210|     87|                        &create_param->target : &create_param->remote_uri);
  211|     87|    dlg->target = pjsip_parse_uri(dlg->pool, tmp.ptr, tmp.slen, 0);
  212|     87|    if (!dlg->target) {
  ------------------
  |  Branch (212:9): [True: 0, False: 87]
  ------------------
  213|      0|        status = PJSIP_EINVALIDURI;
  ------------------
  |  |  144|      0|#define PJSIP_EINVALIDURI       (PJSIP_ERRNO_START_PJSIP + 39)  /* 171039 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  214|      0|        goto on_error;
  215|      0|    }
  216|       |
  217|       |    /* Put any header param in the target URI into INVITE header list. */
  218|     87|    if (PJSIP_URI_SCHEME_IS_SIP(dlg->target) ||
  ------------------
  |  |  234|    174|    (pj_stricmp2(pjsip_uri_get_scheme(url), "sip")==0)
  |  |  ------------------
  |  |  |  Branch (234:5): [True: 87, False: 0]
  |  |  ------------------
  ------------------
  219|      0|        PJSIP_URI_SCHEME_IS_SIPS(dlg->target))
  ------------------
  |  |  242|      0|    (pj_stricmp2(pjsip_uri_get_scheme(url), "sips")==0)
  |  |  ------------------
  |  |  |  Branch (242:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  220|     87|    {
  221|     87|        pjsip_param *param;
  222|     87|        pjsip_sip_uri *uri = (pjsip_sip_uri*)pjsip_uri_get_uri(dlg->target);
  223|       |
  224|     87|        param = uri->header_param.next;
  225|     87|        while (param != &uri->header_param) {
  ------------------
  |  Branch (225:16): [True: 0, False: 87]
  ------------------
  226|      0|            if (param->value.ptr) {
  ------------------
  |  Branch (226:17): [True: 0, False: 0]
  ------------------
  227|      0|                pjsip_hdr *hdr;
  228|      0|                int c;
  229|       |
  230|      0|                c = param->value.ptr[param->value.slen];
  231|      0|                param->value.ptr[param->value.slen] = '\0';
  232|       |
  233|      0|                hdr = (pjsip_hdr*)
  234|      0|                    pjsip_parse_hdr(dlg->pool, &param->name, param->value.ptr,
  235|      0|                                    param->value.slen, NULL);
  236|       |
  237|      0|                param->value.ptr[param->value.slen] = (char)c;
  238|       |
  239|      0|                if (hdr == NULL) {
  ------------------
  |  Branch (239:21): [True: 0, False: 0]
  ------------------
  240|      0|                    status = PJSIP_EINVALIDURI;
  ------------------
  |  |  144|      0|#define PJSIP_EINVALIDURI       (PJSIP_ERRNO_START_PJSIP + 39)  /* 171039 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  241|      0|                    goto on_error;
  242|      0|                }
  243|      0|                pj_list_push_back(&dlg->inv_hdr, hdr);
  244|      0|            }
  245|       |
  246|      0|            param = param->next;
  247|      0|        }
  248|       |
  249|       |        /* Now must remove any header params from URL, since that would
  250|       |         * create another header in pjsip_endpt_create_request().
  251|       |         */
  252|     87|        pj_list_init(&uri->header_param);
  253|     87|    }
  254|       |
  255|       |    /* Add target to the target set */
  256|     87|    pjsip_target_set_add_uri(&dlg->target_set, dlg->pool, dlg->target, 0);
  257|       |
  258|       |    /* Init local info. */
  259|     87|    dlg->local.info = pjsip_from_hdr_create(dlg->pool);
  260|     87|    pj_strdup_with_null(dlg->pool, &dlg->local.info_str,
  261|     87|                        &create_param->local_uri);
  262|     87|    dlg->local.info->uri = pjsip_parse_uri(dlg->pool,
  263|     87|                                           dlg->local.info_str.ptr,
  264|     87|                                           dlg->local.info_str.slen, 0);
  265|     87|    if (!dlg->local.info->uri) {
  ------------------
  |  Branch (265:9): [True: 0, False: 87]
  ------------------
  266|      0|        status = PJSIP_EINVALIDURI;
  ------------------
  |  |  144|      0|#define PJSIP_EINVALIDURI       (PJSIP_ERRNO_START_PJSIP + 39)  /* 171039 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  267|      0|        goto on_error;
  268|      0|    }
  269|       |
  270|       |    /* Generate local tag. */
  271|     87|    pj_create_unique_string(dlg->pool, &dlg->local.info->tag);
  272|       |
  273|       |    /* Calculate hash value of local tag. */
  274|     87|    dlg->local.tag_hval = pj_hash_calc_tolower(0, NULL,
  275|     87|                                               &dlg->local.info->tag);
  276|       |
  277|       |    /* Randomize local CSeq. */
  278|     87|    dlg->local.first_cseq = pj_rand() & 0x7FFF;
  279|     87|    dlg->local.cseq = dlg->local.first_cseq;
  280|       |
  281|       |    /* Init local contact. */
  282|     87|    pj_strdup_with_null(dlg->pool, &tmp,
  283|     87|                    create_param->local_contact.slen ?
  ------------------
  |  Branch (283:21): [True: 0, False: 87]
  ------------------
  284|     87|                    &create_param->local_contact : &create_param->local_uri);
  285|     87|    dlg->local.contact = (pjsip_contact_hdr*)
  286|     87|                         pjsip_parse_hdr(dlg->pool, &HCONTACT, tmp.ptr,
  287|     87|                                         tmp.slen, NULL);
  288|     87|    if (!dlg->local.contact) {
  ------------------
  |  Branch (288:9): [True: 0, False: 87]
  ------------------
  289|      0|        status = PJSIP_EINVALIDURI;
  ------------------
  |  |  144|      0|#define PJSIP_EINVALIDURI       (PJSIP_ERRNO_START_PJSIP + 39)  /* 171039 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  290|      0|        goto on_error;
  291|      0|    }
  292|       |
  293|       |    /* Init remote info. */
  294|     87|    dlg->remote.info = pjsip_to_hdr_create(dlg->pool);
  295|     87|    pj_strdup_with_null(dlg->pool, &dlg->remote.info_str,
  296|     87|                        &create_param->remote_uri);
  297|     87|    dlg->remote.info->uri = pjsip_parse_uri(dlg->pool,
  298|     87|                                            dlg->remote.info_str.ptr,
  299|     87|                                            dlg->remote.info_str.slen, 0);
  300|     87|    if (!dlg->remote.info->uri) {
  ------------------
  |  Branch (300:9): [True: 0, False: 87]
  ------------------
  301|      0|        status = PJSIP_EINVALIDURI;
  ------------------
  |  |  144|      0|#define PJSIP_EINVALIDURI       (PJSIP_ERRNO_START_PJSIP + 39)  /* 171039 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  302|      0|        goto on_error;
  303|      0|    }
  304|       |
  305|       |    /* Remove header param from remote.info_str, if any */
  306|     87|    if (PJSIP_URI_SCHEME_IS_SIP(dlg->remote.info->uri) ||
  ------------------
  |  |  234|    174|    (pj_stricmp2(pjsip_uri_get_scheme(url), "sip")==0)
  |  |  ------------------
  |  |  |  Branch (234:5): [True: 87, False: 0]
  |  |  ------------------
  ------------------
  307|      0|        PJSIP_URI_SCHEME_IS_SIPS(dlg->remote.info->uri))
  ------------------
  |  |  242|      0|    (pj_stricmp2(pjsip_uri_get_scheme(url), "sips")==0)
  |  |  ------------------
  |  |  |  Branch (242:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  308|     87|    {
  309|     87|        pjsip_sip_uri *sip_uri = (pjsip_sip_uri *)
  310|     87|                                 pjsip_uri_get_uri(dlg->remote.info->uri);
  311|     87|        if (!pj_list_empty(&sip_uri->header_param)) {
  ------------------
  |  Branch (311:13): [True: 0, False: 87]
  ------------------
  312|      0|            pj_str_t tmp2;
  313|       |
  314|       |            /* Remove all header param */
  315|      0|            pj_list_init(&sip_uri->header_param);
  316|       |
  317|       |            /* Print URI */
  318|      0|            tmp2.ptr = (char*) pj_pool_alloc(dlg->pool,
  319|      0|                                            dlg->remote.info_str.slen);
  320|      0|            tmp2.slen = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR,
  321|      0|                                       sip_uri, tmp2.ptr,
  322|      0|                                       dlg->remote.info_str.slen);
  323|       |
  324|      0|            if (tmp2.slen < 1) {
  ------------------
  |  Branch (324:17): [True: 0, False: 0]
  ------------------
  325|      0|                status = PJSIP_EURITOOLONG;
  ------------------
  |  |  164|      0|#define PJSIP_EURITOOLONG       (PJSIP_ERRNO_START_PJSIP + 43)  /* 171043 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  326|      0|                goto on_error;
  327|      0|            }
  328|       |
  329|       |            /* Assign remote.info_str */
  330|      0|            dlg->remote.info_str = tmp2;
  331|      0|        }
  332|     87|    }
  333|       |
  334|       |
  335|       |    /* Initialize remote's CSeq to -1. */
  336|     87|    dlg->remote.cseq = dlg->remote.first_cseq = -1;
  337|       |
  338|       |    /* Initial role is UAC. */
  339|     87|    dlg->role = PJSIP_ROLE_UAC;
  340|       |
  341|       |    /* Secure? */
  342|     87|    dlg->secure = PJSIP_URI_SCHEME_IS_SIPS(dlg->target);
  ------------------
  |  |  242|     87|    (pj_stricmp2(pjsip_uri_get_scheme(url), "sips")==0)
  ------------------
  343|       |
  344|       |    /* Generate Call-ID header. */
  345|     87|    dlg->call_id = pjsip_cid_hdr_create(dlg->pool);
  346|     87|    pj_create_unique_string(dlg->pool, &dlg->call_id->id);
  347|       |
  348|       |    /* Initial route set is empty. */
  349|     87|    pj_list_init(&dlg->route_set);
  350|       |
  351|       |    /* Register this dialog to user agent. */
  352|     87|    status = pjsip_ua_register_dlg( create_param->ua, dlg );
  353|     87|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (353:9): [True: 0, False: 87]
  ------------------
  354|      0|        goto on_error;
  355|       |
  356|       |    /* Done! */
  357|     87|    *p_dlg = dlg;
  358|       |
  359|     87|    PJ_LOG(5,(dlg->obj_name, "UAC dialog created"));
  ------------------
  |  |  106|     87|#define PJ_LOG(level,arg)       do { \
  |  |  107|     87|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    174|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 87, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 87]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  496|      0|    #define pj_log_wrapper_5(arg)       pj_log_5 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|     87|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 87]
  |  |  ------------------
  ------------------
  360|       |
  361|     87|    return PJ_SUCCESS;
  362|       |
  363|      0|on_error:
  364|      0|    destroy_dialog(dlg, PJ_FALSE);
  365|      0|    return status;
  366|     87|}
pjsip_dlg_set_route_set:
  936|     79|{
  937|     79|    pjsip_route_hdr *r;
  938|       |
  939|     79|    PJ_ASSERT_RETURN(dlg, PJ_EINVAL);
  ------------------
  |  |   97|     79|            do { \
  |  |   98|     79|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 79]
  |  |  ------------------
  |  |   99|     79|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 79]
  |  |  ------------------
  ------------------
  |  Branch (939:5): [True: 0, False: 0]
  |  Branch (939:5): [True: 0, False: 0]
  ------------------
  940|       |
  941|     79|    pjsip_dlg_inc_lock(dlg);
  942|       |
  943|       |    /* Clear route set. */
  944|     79|    pj_list_init(&dlg->route_set);
  945|       |
  946|     79|    if (!route_set) {
  ------------------
  |  Branch (946:9): [True: 0, False: 79]
  ------------------
  947|      0|        pjsip_dlg_dec_lock(dlg);
  948|      0|        return PJ_SUCCESS;
  949|      0|    }
  950|       |
  951|     79|    r = route_set->next;
  952|  3.43k|    while (r != route_set) {
  ------------------
  |  Branch (952:12): [True: 3.35k, False: 79]
  ------------------
  953|  3.35k|        pjsip_route_hdr *new_r;
  954|       |
  955|  3.35k|        new_r = (pjsip_route_hdr*) pjsip_hdr_clone(dlg->pool, r);
  956|  3.35k|        pj_list_push_back(&dlg->route_set, new_r);
  957|       |
  958|  3.35k|        r = r->next;
  959|  3.35k|    }
  960|       |
  961|     79|    pjsip_dlg_dec_lock(dlg);
  962|     79|    return PJ_SUCCESS;
  963|     79|}
pjsip_dlg_inc_lock:
  993|    166|{
  994|       |    /* Add ref temporarily to avoid possible dialog destroy while waiting
  995|       |     * the lock.
  996|       |     */
  997|    166|    pj_grp_lock_add_ref(dlg->grp_lock_);
  998|       |
  999|    166|    PJ_LOG(6,(dlg->obj_name, "Entering pjsip_dlg_inc_lock(), sess_count=%d",
  ------------------
  |  |  106|    166|#define PJ_LOG(level,arg)       do { \
  |  |  107|    166|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    332|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 166]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|    166|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 166]
  |  |  ------------------
  ------------------
 1000|    166|              dlg->sess_count));
 1001|       |
 1002|    166|    pj_grp_lock_acquire(dlg->grp_lock_);
 1003|    166|    dlg->sess_count++;
 1004|       |
 1005|    166|    PJ_LOG(6,(dlg->obj_name, "Leaving pjsip_dlg_inc_lock(), sess_count=%d",
  ------------------
  |  |  106|    166|#define PJ_LOG(level,arg)       do { \
  |  |  107|    166|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    332|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 166]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|    166|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 166]
  |  |  ------------------
  ------------------
 1006|    166|              dlg->sess_count));
 1007|       |
 1008|       |    /* Lock has been acquired, dec ref */
 1009|    166|    pj_grp_lock_dec_ref(dlg->grp_lock_);
 1010|    166|}
pjsip_dlg_dec_lock:
 1042|    166|{
 1043|    166|    PJ_ASSERT_ON_FAIL(dlg!=NULL, return);
  ------------------
  |  |  111|    166|            { \
  |  |  112|    166|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   65|    166|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  113|    166|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (113:21): [True: 0, False: 166]
  |  |  ------------------
  |  |  114|    166|            }
  ------------------
  |  Branch (1043:5): [True: 0, False: 166]
  |  Branch (1043:5): [True: 166, False: 0]
  ------------------
 1044|       |
 1045|    166|    PJ_LOG(6,(dlg->obj_name, "Entering pjsip_dlg_dec_lock(), sess_count=%d, "
  ------------------
  |  |  106|    166|#define PJ_LOG(level,arg)       do { \
  |  |  107|    166|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    332|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 166]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|    166|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 166]
  |  |  ------------------
  ------------------
 1046|    166|                             "tsx_count=%d", dlg->sess_count, dlg->tsx_count));
 1047|       |
 1048|    166|    pj_assert(dlg->sess_count > 0);
  ------------------
  |  |   65|    166|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (1048:5): [True: 0, False: 166]
  |  Branch (1048:5): [True: 166, False: 0]
  ------------------
 1049|    166|    --dlg->sess_count;
 1050|       |
 1051|    166|    if (dlg->sess_count==0 && dlg->tsx_count==0) {
  ------------------
  |  Branch (1051:9): [True: 87, False: 79]
  |  Branch (1051:31): [True: 87, False: 0]
  ------------------
 1052|     87|        pj_grp_lock_release(dlg->grp_lock_);
 1053|     87|        pj_grp_lock_acquire(dlg->grp_lock_);
 1054|       |        /* We are holding the dialog group lock here, so before we destroy
 1055|       |         * the dialog, make sure that we unlock it first to avoid
 1056|       |         * undefined behaviour on some platforms. See ticket #1886.
 1057|       |         */
 1058|     87|        unregister_and_destroy_dialog(dlg, PJ_TRUE);
 1059|     87|    } else {
 1060|     79|        pj_grp_lock_release(dlg->grp_lock_);
 1061|     79|    }
 1062|       |
 1063|    166|    PJ_LOG(6,(THIS_FILE, "Leaving pjsip_dlg_dec_lock() (dlg=%p)", dlg));
  ------------------
  |  |  106|    166|#define PJ_LOG(level,arg)       do { \
  |  |  107|    166|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    332|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 166]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|    166|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 166]
  |  |  ------------------
  ------------------
 1064|    166|}
sip_dialog.c:create_dialog:
   81|     87|{
   82|     87|    pjsip_endpoint *endpt;
   83|     87|    pj_pool_t *pool;
   84|     87|    pjsip_dialog *dlg;
   85|     87|    pj_status_t status;
   86|       |
   87|     87|    endpt = pjsip_ua_get_endpt(ua);
   88|     87|    if (!endpt)
  ------------------
  |  Branch (88:9): [True: 0, False: 87]
  ------------------
   89|      0|        return PJ_EINVALIDOP;
  ------------------
  |  |  438|      0|#define PJ_EINVALIDOP       (PJ_ERRNO_START_STATUS + 13)/* 70013 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   90|       |
   91|     87|    pool = pjsip_endpt_create_pool(endpt, "dlg%p",
   92|     87|                                   PJSIP_POOL_LEN_DIALOG,
  ------------------
  |  | 1148|     87|#define PJSIP_POOL_LEN_DIALOG           4000
  ------------------
   93|     87|                                   PJSIP_POOL_INC_DIALOG);
  ------------------
  |  | 1150|     87|#define PJSIP_POOL_INC_DIALOG           4000
  ------------------
   94|     87|    if (!pool)
  ------------------
  |  Branch (94:9): [True: 0, False: 87]
  ------------------
   95|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   96|       |
   97|     87|    dlg = PJ_POOL_ZALLOC_T(pool, pjsip_dialog);
  ------------------
  |  |  583|     87|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
   98|     87|    PJ_ASSERT_RETURN(dlg != NULL, PJ_ENOMEM);
  ------------------
  |  |   97|     87|            do { \
  |  |   98|     87|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 87]
  |  |  ------------------
  |  |   99|     87|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 87]
  |  |  ------------------
  ------------------
  |  Branch (98:5): [True: 0, False: 0]
  |  Branch (98:5): [True: 0, False: 0]
  ------------------
   99|       |
  100|     87|    dlg->pool = pool;
  101|     87|    pj_ansi_snprintf(dlg->obj_name, sizeof(dlg->obj_name), "dlg%p", dlg);
  ------------------
  |  |  114|     87|#define pj_ansi_snprintf        snprintf
  ------------------
  102|     87|    dlg->ua = ua;
  103|     87|    dlg->endpt = endpt;
  104|     87|    dlg->state = PJSIP_DIALOG_STATE_NULL;
  105|     87|    dlg->add_allow = pjsip_include_allow_hdr_in_dlg;
  106|       |
  107|     87|    pj_list_init(&dlg->inv_hdr);
  108|     87|    pj_list_init(&dlg->rem_cap_hdr);
  109|       |
  110|       |    /* Init client authentication session. */
  111|     87|    status = pjsip_auth_clt_init(&dlg->auth_sess, dlg->endpt,
  112|     87|                                 dlg->pool, 0);
  113|     87|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (113:9): [True: 0, False: 87]
  ------------------
  114|      0|        goto on_error;
  115|       |
  116|     87|    if (grp_lock) {
  ------------------
  |  Branch (116:9): [True: 0, False: 87]
  ------------------
  117|      0|        dlg->grp_lock_ = grp_lock;
  118|     87|    } else {
  119|     87|        status = pj_grp_lock_create(pool, NULL, &dlg->grp_lock_);
  120|     87|        if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (120:13): [True: 0, False: 87]
  ------------------
  121|      0|            goto on_error;
  122|      0|        }
  123|     87|    }
  124|       |
  125|     87|    pj_grp_lock_add_ref(dlg->grp_lock_);
  126|     87|    pj_grp_lock_add_handler(dlg->grp_lock_, pool, dlg, &dlg_on_destroy);
  127|       |
  128|     87|    pjsip_target_set_init(&dlg->target_set);
  129|       |
  130|     87|    *p_dlg = dlg;
  131|     87|    return PJ_SUCCESS;
  132|       |
  133|      0|on_error:
  134|      0|    pjsip_endpt_release_pool(endpt, pool);
  135|      0|    return status;
  136|     87|}
sip_dialog.c:dlg_on_destroy:
   64|     87|{
   65|     87|    pjsip_dialog *dlg = (pjsip_dialog *)arg;
   66|       |
   67|     87|    PJ_LOG(5,(dlg->obj_name, "Dialog destroyed!"));
  ------------------
  |  |  106|     87|#define PJ_LOG(level,arg)       do { \
  |  |  107|     87|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    174|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 87, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 87]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  496|      0|    #define pj_log_wrapper_5(arg)       pj_log_5 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|     87|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 87]
  |  |  ------------------
  ------------------
   68|       |
   69|     87|    pjsip_endpt_release_pool(dlg->endpt, dlg->pool);
   70|     87|}
sip_dialog.c:destroy_dialog:
  151|     87|{
  152|     87|    if (dlg->tp_sel.type != PJSIP_TPSELECTOR_NONE) {
  ------------------
  |  Branch (152:9): [True: 0, False: 87]
  ------------------
  153|      0|        pjsip_tpselector_dec_ref(&dlg->tp_sel);
  154|      0|        pj_bzero(&dlg->tp_sel, sizeof(pjsip_tpselector));
  155|      0|    }
  156|     87|    pjsip_auth_clt_deinit(&dlg->auth_sess);
  157|       |
  158|     87|    pj_grp_lock_dec_ref(dlg->grp_lock_);
  159|       |
  160|     87|    if (unlock_mutex)
  ------------------
  |  Branch (160:9): [True: 87, False: 0]
  ------------------
  161|     87|        pj_grp_lock_release(dlg->grp_lock_);
  162|     87|}
sip_dialog.c:unregister_and_destroy_dialog:
  888|     87|{
  889|     87|    pj_status_t status;
  890|       |
  891|       |    /* Lock must have been held. */
  892|       |
  893|       |    /* Check dialog state. */
  894|       |    /* Number of sessions must be zero. */
  895|     87|    PJ_ASSERT_RETURN(dlg->sess_count==0, PJ_EINVALIDOP);
  ------------------
  |  |   97|     87|            do { \
  |  |   98|     87|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 87]
  |  |  ------------------
  |  |   99|     87|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 87]
  |  |  ------------------
  ------------------
  |  Branch (895:5): [True: 0, False: 0]
  |  Branch (895:5): [True: 0, False: 0]
  ------------------
  896|       |
  897|       |    /* MUST not have pending transactions. */
  898|     87|    PJ_ASSERT_RETURN(dlg->tsx_count==0, PJ_EINVALIDOP);
  ------------------
  |  |   97|     87|            do { \
  |  |   98|     87|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 87]
  |  |  ------------------
  |  |   99|     87|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 87]
  |  |  ------------------
  ------------------
  |  Branch (898:5): [True: 0, False: 0]
  |  Branch (898:5): [True: 0, False: 0]
  ------------------
  899|       |
  900|       |    /* Unregister from user agent, if it has been registered (see #1924) */
  901|     87|    if (dlg->dlg_set) {
  ------------------
  |  Branch (901:9): [True: 87, False: 0]
  ------------------
  902|     87|        status = pjsip_ua_unregister_dlg(dlg->ua, dlg);
  903|     87|        if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (903:13): [True: 0, False: 87]
  ------------------
  904|      0|            pj_assert(!"Unexpected failed unregistration!");
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (904:13): [Folded, False: 0]
  |  Branch (904:13): [Folded, False: 0]
  ------------------
  905|      0|            return status;
  906|      0|        }
  907|     87|    }
  908|       |
  909|       |    /* Destroy this dialog. */
  910|     87|    destroy_dialog(dlg, unlock_mutex);
  911|       |
  912|     87|    return PJ_SUCCESS;
  913|     87|}

pjsip_endpt_register_module:
  161|      5|{
  162|      5|    pj_status_t status = PJ_SUCCESS;
  163|      5|    pjsip_module *m;
  164|      5|    unsigned i;
  165|       |
  166|      5|    pj_rwmutex_lock_write(endpt->mod_mutex);
  167|       |
  168|      5|    if (endpt->mod_running && !endpt->mod_reg_unreg) {
  ------------------
  |  Branch (168:9): [True: 0, False: 5]
  |  Branch (168:31): [True: 0, False: 0]
  ------------------
  169|      0|        PJ_LOG(2, (THIS_FILE, "Warning: Module \"%.*s\" registered during "
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  448|      0|    #define pj_log_wrapper_2(arg)       pj_log_2 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  170|      0|                              "operation. Enable PJSIP_SAFE_MODULE to prevent "
  171|      0|                              "race condition.",
  172|      0|                              (int)mod->name.slen, mod->name.ptr));
  173|       |
  174|      0|        endpt->mod_reg_unreg = PJ_TRUE;
  175|       |        /* Give some time to allow pjsip_endpt_process_rx_data() and
  176|       |         * endpt_on_tx_msg() to complete.
  177|       |         */
  178|      0|        pj_thread_sleep(100);
  179|      0|    }
  180|       |
  181|       |    /* Make sure that this module has not been registered. */
  182|     10|    PJ_ASSERT_ON_FAIL(  pj_list_find_node(&endpt->module_list, mod) == NULL,
  ------------------
  |  |  111|      5|            { \
  |  |  112|      5|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   65|      5|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  113|      5|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (113:21): [True: 0, False: 5]
  |  |  ------------------
  |  |  114|      5|            }
  ------------------
  |  Branch (182:5): [True: 0, False: 5]
  |  Branch (182:5): [True: 5, False: 0]
  ------------------
  183|     10|                        {status = PJ_EEXISTS; goto on_return;});
  184|       |
  185|       |    /* Make sure that no module with the same name has been registered. */
  186|     10|    PJ_ASSERT_ON_FAIL(  pj_list_search(&endpt->module_list, &mod->name, 
  ------------------
  |  |  111|      5|            { \
  |  |  112|      5|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   65|      5|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  113|      5|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (113:21): [True: 0, False: 5]
  |  |  ------------------
  |  |  114|      5|            }
  ------------------
  |  Branch (186:5): [True: 0, False: 5]
  |  Branch (186:5): [True: 5, False: 0]
  ------------------
  187|     10|                                       &cmp_mod_name)==NULL,
  188|     10|                        {status = PJ_EEXISTS; goto on_return; });
  189|       |
  190|       |    /* Find unused ID for this module. */
  191|     15|    for (i=0; i<PJ_ARRAY_SIZE(endpt->modules); ++i) {
  ------------------
  |  |  315|     15|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (191:15): [True: 15, False: 0]
  ------------------
  192|     15|        if (endpt->modules[i] == NULL)
  ------------------
  |  Branch (192:13): [True: 5, False: 10]
  ------------------
  193|      5|            break;
  194|     15|    }
  195|     10|    if (i == PJ_ARRAY_SIZE(endpt->modules)) {
  ------------------
  |  |  315|      5|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (195:9): [True: 0, False: 5]
  ------------------
  196|      0|        pj_assert(!"Too many modules registered!");
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (196:9): [Folded, False: 0]
  |  Branch (196:9): [Folded, False: 0]
  ------------------
  197|      0|        status = PJ_ETOOMANY;
  ------------------
  |  |  423|      0|#define PJ_ETOOMANY         (PJ_ERRNO_START_STATUS + 10)/* 70010 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  198|      0|        goto on_return;
  199|      0|    }
  200|       |
  201|       |    /* Assign the ID. */
  202|      5|    mod->id = i;
  203|       |
  204|       |    /* Try to load the module. */
  205|      5|    if (mod->load) {
  ------------------
  |  Branch (205:9): [True: 2, False: 3]
  ------------------
  206|      2|        status = (*mod->load)(endpt);
  207|      2|        if (status != PJ_SUCCESS)
  ------------------
  |  Branch (207:13): [True: 0, False: 2]
  ------------------
  208|      0|            goto on_return;
  209|      2|    }
  210|       |
  211|       |    /* Try to start the module. */
  212|      5|    if (mod->start) {
  ------------------
  |  Branch (212:9): [True: 1, False: 4]
  ------------------
  213|      1|        status = (*mod->start)();
  214|      1|        if (status != PJ_SUCCESS)
  ------------------
  |  Branch (214:13): [True: 0, False: 1]
  ------------------
  215|      0|            goto on_return;
  216|      1|    }
  217|       |
  218|       |    /* Save the module. */
  219|      5|    endpt->modules[i] = mod;
  220|       |
  221|       |    /* Put in the module list, sorted by priority. */
  222|      5|    m = endpt->module_list.next;
  223|     14|    while (m != &endpt->module_list) {
  ------------------
  |  Branch (223:12): [True: 10, False: 4]
  ------------------
  224|     10|        if (m->priority > mod->priority)
  ------------------
  |  Branch (224:13): [True: 1, False: 9]
  ------------------
  225|      1|            break;
  226|      9|        m = m->next;
  227|      9|    }
  228|      5|    pj_list_insert_before(m, mod);
  229|       |
  230|       |    /* Done. */
  231|       |
  232|      5|    PJ_LOG(4,(THIS_FILE, "Module \"%.*s\" registered", 
  ------------------
  |  |  106|      5|#define PJ_LOG(level,arg)       do { \
  |  |  107|      5|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|     10|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 5, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 5]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      5|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 5]
  |  |  ------------------
  ------------------
  233|      5|              (int)mod->name.slen, mod->name.ptr));
  234|       |
  235|      5|on_return:
  236|      5|    pj_rwmutex_unlock_write(endpt->mod_mutex);
  237|      5|    return status;
  238|      5|}
pjsip_endpt_get_request_headers:
  441|  1.81k|{
  442|  1.81k|    return &endpt->req_hdr;
  443|  1.81k|}
pjsip_endpt_create:
  452|      1|{
  453|      1|    pj_status_t status;
  454|      1|    pj_pool_t *pool;
  455|      1|    pjsip_endpoint *endpt;
  456|      1|    pjsip_max_fwd_hdr *mf_hdr;
  457|      1|    pj_lock_t *lock = NULL;
  458|       |
  459|       |
  460|      1|    status = pj_register_strerror(PJSIP_ERRNO_START, PJ_ERRNO_SPACE_SIZE,
  ------------------
  |  |   47|      1|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  ------------------
  |  |  |  |  535|      1|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      1|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  521|      1|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|      1|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  status = pj_register_strerror(PJSIP_ERRNO_START, PJ_ERRNO_SPACE_SIZE,
  ------------------
  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  ------------------
  461|      1|                                  &pjsip_strerror);
  462|      1|    pj_assert(status == PJ_SUCCESS);
  ------------------
  |  |   65|      1|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (462:5): [True: 0, False: 1]
  |  Branch (462:5): [True: 1, False: 0]
  ------------------
  463|       |
  464|      1|    PJ_LOG(5, (THIS_FILE, "Creating endpoint instance..."));
  ------------------
  |  |  106|      1|#define PJ_LOG(level,arg)       do { \
  |  |  107|      1|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      2|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 1, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 1]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  496|      0|    #define pj_log_wrapper_5(arg)       pj_log_5 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      1|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 1]
  |  |  ------------------
  ------------------
  465|       |
  466|      1|    *p_endpt = NULL;
  467|       |
  468|       |    /* Create pool */
  469|      1|    pool = pj_pool_create(pf, "pept%p", 
  470|      1|                          PJSIP_POOL_LEN_ENDPT, PJSIP_POOL_INC_ENDPT,
  ------------------
  |  |  974|      1|#   define PJSIP_POOL_LEN_ENDPT         (16000)
  ------------------
                                        PJSIP_POOL_LEN_ENDPT, PJSIP_POOL_INC_ENDPT,
  ------------------
  |  |  981|      1|#   define PJSIP_POOL_INC_ENDPT         (4000)
  ------------------
  471|      1|                          &pool_callback);
  472|      1|    if (!pool)
  ------------------
  |  Branch (472:9): [True: 0, False: 1]
  ------------------
  473|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  474|       |
  475|       |    /* Create endpoint. */
  476|      1|    endpt = PJ_POOL_ZALLOC_T(pool, pjsip_endpoint);
  ------------------
  |  |  583|      1|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  477|      1|    endpt->pool = pool;
  478|      1|    endpt->pf = pf;
  479|       |
  480|       |    /* Init modules list. */
  481|      1|    pj_list_init(&endpt->module_list);
  482|       |
  483|       |    /* Initialize exit callback list. */
  484|      1|    pj_list_init(&endpt->exit_cb_list);
  485|       |
  486|       |    /* Create R/W mutex for module manipulation. */
  487|      1|    status = pj_rwmutex_create(endpt->pool, "ept%p", &endpt->mod_mutex);
  488|      1|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (488:9): [True: 0, False: 1]
  ------------------
  489|      0|        goto on_error;
  490|       |
  491|       |    /* Init parser. */
  492|      1|    init_sip_parser();
  493|       |
  494|       |    /* Init tel: uri */
  495|      1|    pjsip_tel_uri_subsys_init();
  496|       |
  497|       |    /* Get name. */
  498|      1|    if (name != NULL) {
  ------------------
  |  Branch (498:9): [True: 1, False: 0]
  ------------------
  499|      1|        pj_str_t temp;
  500|      1|        pj_strdup_with_null(endpt->pool, &endpt->name, pj_cstr(&temp, name));
  501|      1|    } else {
  502|      0|        pj_strdup_with_null(endpt->pool, &endpt->name, pj_gethostname());
  503|      0|    }
  504|       |
  505|       |    /* Create mutex for the events, etc. */
  506|      1|    status = pj_mutex_create_recursive( endpt->pool, "ept%p", &endpt->mutex );
  507|      1|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (507:9): [True: 0, False: 1]
  ------------------
  508|      0|        goto on_error;
  509|      0|    }
  510|       |
  511|       |    /* Create timer heap to manage all timers within this endpoint. */
  512|      1|    status = pj_timer_heap_create( endpt->pool, PJSIP_MAX_TIMER_COUNT, 
  ------------------
  |  |  966|      1|#   define PJSIP_MAX_TIMER_COUNT        (2*pjsip_cfg()->tsx.max_count + \
  |  |  967|      1|                                         2*PJSIP_MAX_DIALOG_COUNT)
  |  |  ------------------
  |  |  |  |  327|      1|#   define PJSIP_MAX_DIALOG_COUNT       (512-1)
  |  |  ------------------
  ------------------
  513|      1|                                   &endpt->timer_heap);
  514|      1|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (514:9): [True: 0, False: 1]
  ------------------
  515|      0|        goto on_error;
  516|      0|    }
  517|       |
  518|       |    /* Set recursive lock for the timer heap. */
  519|      1|    status = pj_lock_create_recursive_mutex( endpt->pool, "edpt%p", &lock);
  520|      1|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (520:9): [True: 0, False: 1]
  ------------------
  521|      0|        goto on_error;
  522|      0|    }
  523|      1|    pj_timer_heap_set_lock(endpt->timer_heap, lock, PJ_TRUE);
  524|       |
  525|       |    /* Set maximum timed out entries to process in a single poll. */
  526|      1|    pj_timer_heap_set_max_timed_out_per_poll(endpt->timer_heap, 
  527|      1|                                             PJSIP_MAX_TIMED_OUT_ENTRIES);
  ------------------
  |  |  660|      1|#   define PJSIP_MAX_TIMED_OUT_ENTRIES  10
  ------------------
  528|       |
  529|       |    /* Create ioqueue. */
  530|      1|    status = pj_ioqueue_create( endpt->pool, PJSIP_MAX_TRANSPORTS, &endpt->ioqueue);
  ------------------
  |  |  337|      1|#   define PJSIP_MAX_TRANSPORTS         (PJ_IOQUEUE_MAX_HANDLES)
  |  |  ------------------
  |  |  |  |  738|      1|#   define PJ_IOQUEUE_MAX_HANDLES       (64)
  |  |  ------------------
  ------------------
  531|      1|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (531:9): [True: 0, False: 1]
  ------------------
  532|      0|        goto on_error;
  533|      0|    }
  534|       |
  535|       |    /* Create transport manager. */
  536|      1|    status = pjsip_tpmgr_create( endpt->pool, endpt,
  537|      1|                                 &endpt_on_rx_msg,
  538|      1|                                 &endpt_on_tx_msg,
  539|      1|                                 &endpt->transport_mgr);
  540|      1|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (540:9): [True: 0, False: 1]
  ------------------
  541|      0|        goto on_error;
  542|      0|    }
  543|       |
  544|       |    /* Create asynchronous DNS resolver. */
  545|      1|    status = pjsip_resolver_create(endpt->pool, &endpt->resolver);
  546|      1|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (546:9): [True: 0, False: 1]
  ------------------
  547|      0|        PJ_PERROR(4, (THIS_FILE, status,
  ------------------
  |  |  189|      0|#define PJ_PERROR(level,arg)    do { \
  |  |  190|      0|                                    pj_perror_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  611|      0|    #define pj_perror_wrapper_4(arg)    pj_perror_4 arg
  |  |  ------------------
  |  |  191|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (191:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  548|      0|                      "Error creating resolver instance"));
  549|      0|        goto on_error;
  550|      0|    }
  551|       |
  552|       |    /* Initialize request headers. */
  553|      1|    pj_list_init(&endpt->req_hdr);
  554|       |
  555|       |    /* Add "Max-Forwards" for request header. */
  556|      1|    mf_hdr = pjsip_max_fwd_hdr_create(endpt->pool,
  557|      1|                                      PJSIP_MAX_FORWARDS_VALUE);
  ------------------
  |  | 1060|      1|#define PJSIP_MAX_FORWARDS_VALUE        70
  ------------------
  558|      1|    pj_list_insert_before( &endpt->req_hdr, mf_hdr);
  559|       |
  560|       |    /* Initialize capability header list. */
  561|      1|    pj_list_init(&endpt->cap_hdr);
  562|       |
  563|       |
  564|       |    /* Done. */
  565|      1|    *p_endpt = endpt;
  566|      1|    return status;
  567|       |
  568|      0|on_error:
  569|      0|    if (endpt->transport_mgr) {
  ------------------
  |  Branch (569:9): [True: 0, False: 0]
  ------------------
  570|      0|        pjsip_tpmgr_destroy(endpt->transport_mgr);
  571|      0|        endpt->transport_mgr = NULL;
  572|      0|    }
  573|      0|    if (endpt->ioqueue) {
  ------------------
  |  Branch (573:9): [True: 0, False: 0]
  ------------------
  574|      0|        pj_ioqueue_destroy(endpt->ioqueue);
  575|      0|        endpt->ioqueue = NULL;
  576|      0|    }
  577|      0|    if (endpt->timer_heap) {
  ------------------
  |  Branch (577:9): [True: 0, False: 0]
  ------------------
  578|      0|        pj_timer_heap_destroy(endpt->timer_heap);
  579|      0|        endpt->timer_heap = NULL;
  580|      0|    }
  581|      0|    if (endpt->mutex) {
  ------------------
  |  Branch (581:9): [True: 0, False: 0]
  ------------------
  582|      0|        pj_mutex_destroy(endpt->mutex);
  583|      0|        endpt->mutex = NULL;
  584|      0|    }
  585|      0|    deinit_sip_parser();
  586|      0|    if (endpt->mod_mutex) {
  ------------------
  |  Branch (586:9): [True: 0, False: 0]
  ------------------
  587|      0|        pj_rwmutex_destroy(endpt->mod_mutex);
  588|      0|        endpt->mod_mutex = NULL;
  589|      0|    }
  590|      0|    pj_pool_release( endpt->pool );
  591|       |
  592|      0|    PJ_PERROR(4, (THIS_FILE, status, "Error creating endpoint"));
  ------------------
  |  |  189|      0|#define PJ_PERROR(level,arg)    do { \
  |  |  190|      0|                                    pj_perror_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  611|      0|    #define pj_perror_wrapper_4(arg)    pj_perror_4 arg
  |  |  ------------------
  |  |  191|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (191:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  593|      0|    return status;
  594|      1|}
pjsip_endpt_create_pool:
  677|  7.95k|{
  678|  7.95k|    pj_pool_t *pool;
  679|       |
  680|       |    /* Lock endpoint mutex. */
  681|       |    /* No need to lock mutex. Factory is thread safe.
  682|       |    pj_mutex_lock(endpt->mutex);
  683|       |     */
  684|       |
  685|       |    /* Create pool */
  686|  7.95k|    pool = pj_pool_create( endpt->pf, pool_name,
  687|  7.95k|                           initial, increment, &pool_callback);
  688|       |
  689|       |    /* Unlock mutex. */
  690|       |    /* No need to lock mutex. Factory is thread safe.
  691|       |    pj_mutex_unlock(endpt->mutex);
  692|       |     */
  693|       |
  694|  7.95k|    if (!pool) {
  ------------------
  |  Branch (694:9): [True: 0, False: 7.95k]
  ------------------
  695|      0|        PJ_LOG(4, (THIS_FILE, "Unable to create pool %s!", pool_name));
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  696|      0|    }
  697|       |
  698|  7.95k|    return pool;
  699|  7.95k|}
pjsip_endpt_release_pool:
  706|  7.95k|{
  707|  7.95k|    PJ_LOG(6, (THIS_FILE, "Releasing pool %s", pj_pool_getobjname(pool)));
  ------------------
  |  |  106|  7.95k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  7.95k|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|  15.9k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [Folded, False: 7.95k]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  7.95k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 7.95k]
  |  |  ------------------
  ------------------
  708|       |
  709|       |    /* Don't need to acquire mutex since pool factory is thread safe
  710|       |       pj_mutex_lock(endpt->mutex);
  711|       |     */
  712|  7.95k|    pj_pool_release( pool );
  713|       |
  714|  7.95k|    PJ_UNUSED_ARG(endpt);
  ------------------
  |  | 1537|  7.95k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  715|       |    /*
  716|       |    pj_mutex_unlock(endpt->mutex);
  717|       |     */
  718|  7.95k|}
pjsip_endpt_create_tdata:
 1185|    605|{
 1186|    605|    return pjsip_tx_data_create(endpt->transport_mgr, p_tdata);
 1187|    605|}
pjsip_endpt_get_tpmgr:
 1250|      1|{
 1251|      1|    return endpt->transport_mgr;
 1252|      1|}
pjsip_endpt_acquire_transport:
 1271|  2.98k|{
 1272|  2.98k|    return pjsip_tpmgr_acquire_transport(endpt->transport_mgr, type, 
 1273|  2.98k|                                         remote, addr_len, sel, transport);
 1274|  2.98k|}
sip_endpoint.c:cmp_mod_name:
  149|     20|{
  150|     20|    return pj_stricmp((const pj_str_t*)name, &((pjsip_module*)mod)->name);
  151|     20|}

pjsip_method_set:
  264|    604|{
  265|    604|    pj_assert(me < PJSIP_OTHER_METHOD);
  ------------------
  |  |   65|    604|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (265:5): [True: 0, False: 604]
  |  Branch (265:5): [True: 604, False: 0]
  ------------------
  266|    604|    m->id = me;
  267|    604|    m->name = *method_names[me];
  268|    604|}
pjsip_method_init_np:
  272|  2.50k|{
  273|  2.50k|    unsigned i;
  274|  16.1k|    for (i=0; i<PJ_ARRAY_SIZE(method_names); ++i) {
  ------------------
  |  |  315|  16.1k|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (274:15): [True: 13.9k, False: 2.20k]
  ------------------
  275|  13.9k|        if (pj_memcmp(str, method_names[i], sizeof(pj_str_t))==0 || 
  ------------------
  |  Branch (275:13): [True: 0, False: 13.9k]
  ------------------
  276|  13.9k|            pj_stricmp(str, method_names[i])==0) 
  ------------------
  |  Branch (276:13): [True: 292, False: 13.6k]
  ------------------
  277|    292|        {
  278|    292|            m->id = (pjsip_method_e)i;
  279|    292|            m->name = *method_names[i];
  280|    292|            return;
  281|    292|        }
  282|  13.9k|    }
  283|  2.20k|    m->id = PJSIP_OTHER_METHOD;
  284|  2.20k|    m->name = *str;
  285|  2.20k|}
pjsip_method_copy:
  290|    605|{
  291|    605|    method->id = rhs->id;
  292|    605|    if (rhs->id != PJSIP_OTHER_METHOD) {
  ------------------
  |  Branch (292:9): [True: 605, False: 0]
  ------------------
  293|    605|        method->name = rhs->name;
  294|    605|    } else {
  295|      0|        pj_strdup(pool, &method->name, &rhs->name);
  296|      0|    }
  297|    605|}
pjsip_msg_create:
  318|  6.68k|{
  319|  6.68k|    pjsip_msg *msg = PJ_POOL_ALLOC_T(pool, pjsip_msg);
  ------------------
  |  |  569|  6.68k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  320|  6.68k|    pj_list_init(&msg->hdr);
  321|  6.68k|    msg->type = type;
  322|       |    msg->body = NULL;
  323|  6.68k|    return msg;
  324|  6.68k|}
pjsip_hdr_find:
  361|  46.3k|{
  362|  46.3k|    const pjsip_hdr *hdr=(const pjsip_hdr*) start, *end=hdr_list;
  363|       |
  364|  46.3k|    if (hdr == NULL) {
  ------------------
  |  Branch (364:9): [True: 43.0k, False: 3.35k]
  ------------------
  365|  43.0k|        hdr = end->next;
  366|  43.0k|    }
  367|   324k|    for (; hdr!=end; hdr = hdr->next) {
  ------------------
  |  Branch (367:12): [True: 285k, False: 39.7k]
  ------------------
  368|   285k|        if (hdr->type == hdr_type)
  ------------------
  |  Branch (368:13): [True: 6.64k, False: 278k]
  ------------------
  369|  6.64k|            return (void*)hdr;
  370|   285k|    }
  371|  39.7k|    return NULL;
  372|  46.3k|}
pjsip_hdr_find_by_name:
  377|  23.9k|{
  378|  23.9k|    const pjsip_hdr *hdr=(const pjsip_hdr*) start, *end=hdr_list;
  379|       |
  380|  23.9k|    if (hdr == NULL) {
  ------------------
  |  Branch (380:9): [True: 23.9k, False: 0]
  ------------------
  381|  23.9k|        hdr = end->next;
  382|  23.9k|    }
  383|   194k|    for (; hdr!=end; hdr = hdr->next) {
  ------------------
  |  Branch (383:12): [True: 170k, False: 23.8k]
  ------------------
  384|   170k|        if (pj_stricmp(&hdr->name, name) == 0)
  ------------------
  |  Branch (384:13): [True: 30, False: 170k]
  ------------------
  385|     30|            return (void*)hdr;
  386|   170k|    }
  387|  23.8k|    return NULL;
  388|  23.9k|}
pjsip_msg_find_hdr:
  411|  46.3k|{
  412|  46.3k|    return pjsip_hdr_find(&msg->hdr, hdr_type, start);
  413|  46.3k|}
pjsip_msg_find_hdr_by_name:
  418|  23.9k|{
  419|  23.9k|    return pjsip_hdr_find_by_name(&msg->hdr, name, start);
  420|  23.9k|}
pjsip_hdr_clone:
  613|  7.03k|{
  614|  7.03k|    const pjsip_hdr *hdr = (const pjsip_hdr*) hdr_ptr;
  615|  7.03k|    return (*hdr->vptr->clone)(pool, hdr_ptr);
  616|  7.03k|}
pjsip_hdr_shallow_clone:
  620|    605|{
  621|    605|    const pjsip_hdr *hdr = (const pjsip_hdr*) hdr_ptr;
  622|    605|    return (*hdr->vptr->shallow_clone)(pool, hdr_ptr);
  623|    605|}
pjsip_media_type_cmp:
  697|  9.52M|{
  698|  9.52M|    int rc;
  699|       |
  700|  9.52M|    PJ_ASSERT_RETURN(mt1 && mt2, 1);
  ------------------
  |  |   97|  9.52M|            do { \
  |  |   98|  19.0M|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 9.52M, False: 0]
  |  |  |  Branch (98:23): [True: 9.52M, False: 0]
  |  |  ------------------
  |  |   99|  9.52M|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 9.52M]
  |  |  ------------------
  ------------------
  |  Branch (700:5): [True: 0, False: 0]
  |  Branch (700:5): [True: 0, False: 0]
  |  Branch (700:5): [True: 0, False: 0]
  |  Branch (700:5): [True: 0, False: 0]
  ------------------
  701|       |
  702|  9.52M|    rc = pj_stricmp(&mt1->type, &mt2->type);
  703|  9.52M|    if (rc) return rc;
  ------------------
  |  Branch (703:9): [True: 9.52M, False: 1.19k]
  ------------------
  704|       |
  705|  1.19k|    rc = pj_stricmp(&mt1->subtype, &mt2->subtype);
  706|  1.19k|    if (rc) return rc;
  ------------------
  |  Branch (706:9): [True: 217, False: 979]
  ------------------
  707|       |
  708|    979|    if (cmp_param) {
  ------------------
  |  Branch (708:9): [True: 0, False: 979]
  ------------------
  709|      0|        rc = pjsip_param_cmp(&mt1->param, &mt2->param, (cmp_param==1));
  710|      0|    }
  711|       |
  712|    979|    return rc;
  713|  1.19k|}
pjsip_media_type_cp:
  718|  1.01k|{
  719|  1.01k|    PJ_ASSERT_ON_FAIL(pool && dst && src, return);
  ------------------
  |  |  111|  1.01k|            { \
  |  |  112|  1.01k|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   65|  1.01k|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  113|  4.06k|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (113:23): [True: 1.01k, False: 0]
  |  |  |  Branch (113:23): [True: 1.01k, False: 0]
  |  |  |  Branch (113:23): [True: 1.01k, False: 0]
  |  |  ------------------
  |  |  114|  1.01k|            }
  ------------------
  |  Branch (719:5): [True: 0, False: 1.01k]
  |  Branch (719:5): [True: 0, False: 0]
  |  Branch (719:5): [True: 0, False: 0]
  |  Branch (719:5): [True: 1.01k, False: 0]
  |  Branch (719:5): [True: 1.01k, False: 0]
  |  Branch (719:5): [True: 1.01k, False: 0]
  ------------------
  720|  1.01k|    pj_strdup(pool, &dst->type,    &src->type);
  721|  1.01k|    pj_strdup(pool, &dst->subtype, &src->subtype);
  722|  1.01k|    pjsip_param_clone(pool, &dst->param, &src->param);
  723|  1.01k|}
pjsip_generic_string_hdr_init2:
  748|  3.96k|{
  749|  3.96k|    init_hdr(hdr, PJSIP_H_OTHER, &generic_hdr_vptr);
  750|  3.96k|    if (hname) {
  ------------------
  |  Branch (750:9): [True: 3.96k, False: 0]
  ------------------
  751|  3.96k|        hdr->name = *hname;
  752|  3.96k|        hdr->sname = *hname;
  753|  3.96k|    }
  754|  3.96k|    if (hvalue) {
  ------------------
  |  Branch (754:9): [True: 3.96k, False: 0]
  ------------------
  755|  3.96k|        hdr->hvalue = *hvalue;
  756|  3.96k|    } else {
  757|       |        hdr->hvalue.ptr = NULL;
  758|      0|        hdr->hvalue.slen = 0;
  759|      0|    }
  760|  3.96k|}
pjsip_generic_string_hdr_init:
  767|  3.96k|{
  768|  3.96k|    pjsip_generic_string_hdr *hdr = (pjsip_generic_string_hdr*) mem;
  769|  3.96k|    pj_str_t dup_hname, dup_hval;
  770|       |
  771|  3.96k|    if (hnames) {
  ------------------
  |  Branch (771:9): [True: 0, False: 3.96k]
  ------------------
  772|      0|        pj_strdup(pool, &dup_hname, hnames);
  773|  3.96k|    } else {
  774|  3.96k|        pj_bzero(&dup_hname, sizeof(pj_str_t));
  775|  3.96k|    }
  776|       |
  777|  3.96k|    if (hvalue) {
  ------------------
  |  Branch (777:9): [True: 0, False: 3.96k]
  ------------------
  778|      0|        pj_strdup(pool, &dup_hval, hvalue);
  779|  3.96k|    } else {
  780|  3.96k|        pj_bzero(&dup_hval, sizeof(pj_str_t));
  781|  3.96k|    }
  782|       |
  783|  3.96k|    pjsip_generic_string_hdr_init2(hdr, &dup_hname, &dup_hval);
  784|  3.96k|    return hdr;
  785|  3.96k|}
pjsip_generic_string_hdr_create:
  790|  3.96k|{
  791|  3.96k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_generic_string_hdr));
  792|  3.96k|    return pjsip_generic_string_hdr_init(pool, mem, hnames, hvalue);
  793|  3.96k|}
pjsip_cid_hdr_init:
 1060|  1.35k|{
 1061|  1.35k|    pjsip_cid_hdr *hdr = (pjsip_cid_hdr*) mem;
 1062|       |
 1063|  1.35k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|  1.35k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1064|       |
 1065|  1.35k|    init_hdr(hdr, PJSIP_H_CALL_ID, &generic_hdr_vptr);
 1066|  1.35k|    return hdr;
 1067|       |
 1068|  1.35k|}
pjsip_cid_hdr_create:
 1071|  1.35k|{
 1072|  1.35k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_cid_hdr));
 1073|  1.35k|    return pjsip_cid_hdr_init(pool, mem);
 1074|  1.35k|}
pjsip_clen_hdr_init:
 1094|    629|{
 1095|    629|    pjsip_clen_hdr *hdr = (pjsip_clen_hdr*) mem;
 1096|       |
 1097|    629|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|    629|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1098|       |
 1099|    629|    init_hdr(hdr, PJSIP_H_CONTENT_LENGTH, &clen_hdr_vptr);
 1100|    629|    hdr->len = 0;
 1101|    629|    return hdr;
 1102|    629|}
pjsip_clen_hdr_create:
 1105|    629|{
 1106|    629|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_clen_hdr));
 1107|    629|    return pjsip_clen_hdr_init(pool, mem);
 1108|    629|}
pjsip_cseq_hdr_init:
 1158|  1.53k|{
 1159|  1.53k|    pjsip_cseq_hdr *hdr = (pjsip_cseq_hdr*) mem;
 1160|       |
 1161|  1.53k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|  1.53k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1162|       |
 1163|  1.53k|    init_hdr(hdr, PJSIP_H_CSEQ, &cseq_hdr_vptr);
 1164|  1.53k|    hdr->cseq = 0;
 1165|  1.53k|    hdr->method.id = PJSIP_OTHER_METHOD;
 1166|       |    hdr->method.name.ptr = NULL;
 1167|  1.53k|    hdr->method.name.slen = 0;
 1168|  1.53k|    return hdr;
 1169|  1.53k|}
pjsip_cseq_hdr_create:
 1172|  1.53k|{
 1173|  1.53k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_cseq_hdr));
 1174|  1.53k|    return pjsip_cseq_hdr_init(pool, mem);
 1175|  1.53k|}
pjsip_contact_hdr_init:
 1238|  8.61k|{
 1239|  8.61k|    pjsip_contact_hdr *hdr = (pjsip_contact_hdr*) mem;
 1240|       |
 1241|  8.61k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|  8.61k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1242|       |
 1243|  8.61k|    pj_bzero(mem, sizeof(pjsip_contact_hdr));
 1244|  8.61k|    init_hdr(hdr, PJSIP_H_CONTACT, &contact_hdr_vptr);
 1245|  8.61k|    hdr->expires = PJSIP_EXPIRES_NOT_SPECIFIED;
  ------------------
  |  | 1427|  8.61k|#define PJSIP_EXPIRES_NOT_SPECIFIED     ((pj_uint32_t)0xFFFFFFFFUL)
  ------------------
 1246|  8.61k|    pj_list_init(&hdr->other_param);
 1247|  8.61k|    return hdr;
 1248|  8.61k|}
pjsip_contact_hdr_create:
 1251|  8.61k|{
 1252|  8.61k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_contact_hdr));
 1253|  8.61k|    return pjsip_contact_hdr_init(pool, mem);
 1254|  8.61k|}
pjsip_ctype_hdr_init:
 1379|  2.63k|{
 1380|  2.63k|    pjsip_ctype_hdr *hdr = (pjsip_ctype_hdr*) mem;
 1381|       |
 1382|  2.63k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|  2.63k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1383|       |
 1384|  2.63k|    pj_bzero(mem, sizeof(pjsip_ctype_hdr));
 1385|  2.63k|    init_hdr(hdr, PJSIP_H_CONTENT_TYPE, &ctype_hdr_vptr);
 1386|  2.63k|    pj_list_init(&hdr->media.param);
 1387|  2.63k|    return hdr;
 1388|       |
 1389|  2.63k|}
pjsip_ctype_hdr_create:
 1392|  2.63k|{
 1393|  2.63k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_ctype_hdr));
 1394|  2.63k|    return pjsip_ctype_hdr_init(pool, mem);
 1395|  2.63k|}
pjsip_expires_hdr_init:
 1473|    462|{
 1474|    462|    pjsip_expires_hdr *hdr = (pjsip_expires_hdr*) mem;
 1475|       |
 1476|    462|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|    462|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1477|       |
 1478|    462|    init_hdr(hdr, PJSIP_H_EXPIRES, &generic_int_hdr_vptr);
 1479|    462|    hdr->ivalue = value;
 1480|    462|    return hdr;
 1481|       |
 1482|    462|}
pjsip_expires_hdr_create:
 1486|    462|{
 1487|    462|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_expires_hdr));
 1488|    462|    return pjsip_expires_hdr_init(pool, mem, value);
 1489|    462|}
pjsip_from_hdr_init:
 1512|  2.24k|{
 1513|  2.24k|    pjsip_from_hdr *hdr = (pjsip_from_hdr*) mem;
 1514|       |
 1515|  2.24k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|  2.24k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1516|       |
 1517|  2.24k|    pj_bzero(mem, sizeof(pjsip_from_hdr));
 1518|  2.24k|    init_hdr(hdr, PJSIP_H_FROM, &fromto_hdr_vptr);
 1519|  2.24k|    pj_list_init(&hdr->other_param);
 1520|  2.24k|    return hdr;
 1521|  2.24k|}
pjsip_from_hdr_create:
 1524|  2.24k|{
 1525|  2.24k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_from_hdr));
 1526|  2.24k|    return pjsip_from_hdr_init(pool, mem);
 1527|  2.24k|}
pjsip_to_hdr_init:
 1531|  3.41k|{
 1532|  3.41k|    pjsip_to_hdr *hdr = (pjsip_to_hdr*) mem;
 1533|       |
 1534|  3.41k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|  3.41k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1535|       |
 1536|  3.41k|    pj_bzero(mem, sizeof(pjsip_to_hdr));
 1537|  3.41k|    init_hdr(hdr, PJSIP_H_TO, &fromto_hdr_vptr);
 1538|  3.41k|    pj_list_init(&hdr->other_param);
 1539|  3.41k|    return hdr;
 1540|       |
 1541|  3.41k|}
pjsip_to_hdr_create:
 1544|  3.41k|{
 1545|  3.41k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_to_hdr));
 1546|  3.41k|    return pjsip_to_hdr_init(pool, mem);
 1547|  3.41k|}
pjsip_max_fwd_hdr_init:
 1636|    634|{
 1637|    634|    pjsip_max_fwd_hdr *hdr = (pjsip_max_fwd_hdr*) mem;
 1638|       |
 1639|    634|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|    634|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1640|       |
 1641|    634|    init_hdr(hdr, PJSIP_H_MAX_FORWARDS, &generic_int_hdr_vptr);
 1642|    634|    hdr->ivalue = value;
 1643|    634|    return hdr;
 1644|       |
 1645|    634|}
pjsip_max_fwd_hdr_create:
 1649|    634|{
 1650|    634|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_max_fwd_hdr));
 1651|    634|    return pjsip_max_fwd_hdr_init(pool, mem, value);
 1652|    634|}
pjsip_min_expires_hdr_init:
 1662|    465|{
 1663|    465|    pjsip_min_expires_hdr *hdr = (pjsip_min_expires_hdr*) mem;
 1664|       |
 1665|    465|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|    465|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1666|       |
 1667|    465|    init_hdr(hdr, PJSIP_H_MIN_EXPIRES, &generic_int_hdr_vptr);
 1668|    465|    hdr->ivalue = value;
 1669|    465|    return hdr;
 1670|    465|}
pjsip_min_expires_hdr_create:
 1674|    465|{
 1675|    465|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_min_expires_hdr));
 1676|    465|    return pjsip_min_expires_hdr_init(pool, mem, value );
 1677|    465|}
pjsip_rr_hdr_init:
 1696|  1.43k|{
 1697|  1.43k|    pjsip_rr_hdr *hdr = (pjsip_rr_hdr*) mem;
 1698|       |
 1699|  1.43k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|  1.43k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1700|       |
 1701|  1.43k|    init_hdr(hdr, PJSIP_H_RECORD_ROUTE, &routing_hdr_vptr);
 1702|  1.43k|    pjsip_name_addr_init(&hdr->name_addr);
 1703|  1.43k|    pj_list_init(&hdr->other_param);
 1704|  1.43k|    return hdr;
 1705|       |
 1706|  1.43k|}
pjsip_rr_hdr_create:
 1709|  1.43k|{
 1710|  1.43k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_rr_hdr));
 1711|  1.43k|    return pjsip_rr_hdr_init(pool, mem);
 1712|  1.43k|}
pjsip_route_hdr_init:
 1716|  5.26k|{
 1717|  5.26k|    pjsip_route_hdr *hdr = (pjsip_route_hdr*) mem;
 1718|       |
 1719|  5.26k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|  5.26k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1720|       |
 1721|  5.26k|    init_hdr(hdr, PJSIP_H_ROUTE, &routing_hdr_vptr);
 1722|  5.26k|    pjsip_name_addr_init(&hdr->name_addr);
 1723|  5.26k|    pj_list_init(&hdr->other_param);
 1724|  5.26k|    return hdr;
 1725|  5.26k|}
pjsip_route_hdr_create:
 1728|  5.26k|{
 1729|  5.26k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_route_hdr));
 1730|  5.26k|    return pjsip_route_hdr_init(pool, mem);
 1731|  5.26k|}
pjsip_require_hdr_init:
 1831|    195|{
 1832|    195|    pjsip_require_hdr *hdr = (pjsip_require_hdr*) mem;
 1833|       |
 1834|    195|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|    195|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1835|       |
 1836|    195|    init_hdr(hdr, PJSIP_H_REQUIRE, &generic_array_hdr_vptr);
 1837|    195|    hdr->count = 0;
 1838|    195|    return hdr;
 1839|    195|}
pjsip_require_hdr_create:
 1842|    195|{
 1843|    195|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_require_hdr));
 1844|    195|    return pjsip_require_hdr_init(pool, mem);
 1845|    195|}
pjsip_supported_hdr_init:
 1964|  4.43k|{
 1965|  4.43k|    pjsip_supported_hdr *hdr = (pjsip_supported_hdr*) mem;
 1966|       |
 1967|  4.43k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|  4.43k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1968|  4.43k|    init_hdr(hdr, PJSIP_H_SUPPORTED, &generic_array_hdr_vptr);
 1969|  4.43k|    hdr->count = 0;
 1970|  4.43k|    return hdr;
 1971|  4.43k|}
pjsip_supported_hdr_create:
 1974|  4.43k|{
 1975|  4.43k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_supported_hdr));
 1976|  4.43k|    return pjsip_supported_hdr_init(pool, mem);
 1977|  4.43k|}
pjsip_unsupported_hdr_init:
 1986|    195|{
 1987|    195|    pjsip_unsupported_hdr *hdr = (pjsip_unsupported_hdr*) mem;
 1988|       |    
 1989|    195|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|    195|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1990|       |
 1991|    195|    init_hdr(hdr, PJSIP_H_UNSUPPORTED, &generic_array_hdr_vptr);
 1992|    195|    hdr->count = 0;
 1993|    195|    return hdr;
 1994|    195|}
pjsip_unsupported_hdr_create:
 1997|    195|{
 1998|    195|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_unsupported_hdr));
 1999|    195|    return pjsip_unsupported_hdr_init(pool, mem);
 2000|    195|}
pjsip_via_hdr_init:
 2019|  5.56k|{
 2020|  5.56k|    pjsip_via_hdr *hdr = (pjsip_via_hdr*) mem;
 2021|       |
 2022|  5.56k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|  5.56k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 2023|       |
 2024|  5.56k|    pj_bzero(mem, sizeof(pjsip_via_hdr));
 2025|  5.56k|    init_hdr(hdr, PJSIP_H_VIA, &via_hdr_vptr);
 2026|  5.56k|    hdr->ttl_param = -1;
 2027|  5.56k|    hdr->rport_param = -1;
 2028|  5.56k|    pj_list_init(&hdr->other_param);
 2029|  5.56k|    return hdr;
 2030|       |
 2031|  5.56k|}
pjsip_via_hdr_create:
 2034|  5.56k|{
 2035|  5.56k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_via_hdr));
 2036|  5.56k|    return pjsip_via_hdr_init(pool, mem);
 2037|  5.56k|}
sip_msg.c:pjsip_generic_int_hdr_shallow_clone:
  912|    605|{
  913|    605|    pjsip_generic_int_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_generic_int_hdr);
  ------------------
  |  |  569|    605|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  914|    605|    pj_memcpy(hdr, rhs, sizeof(*hdr));
  915|    605|    return hdr;
  916|    605|}
sip_msg.c:pjsip_routing_hdr_clone:
 1805|  6.71k|{
 1806|  6.71k|    pjsip_routing_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_routing_hdr);
  ------------------
  |  |  569|  6.71k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1807|       |
 1808|  6.71k|    init_hdr(hdr, rhs->type, rhs->vptr);
 1809|  6.71k|    pjsip_name_addr_init(&hdr->name_addr);
 1810|  6.71k|    pjsip_name_addr_assign(pool, &hdr->name_addr, &rhs->name_addr);
 1811|  6.71k|    pjsip_param_clone( pool, &hdr->other_param, &rhs->other_param);
 1812|  6.71k|    return hdr;
 1813|  6.71k|}

pjsip_multipart_create:
  224|    613|{
  225|    613|    pjsip_msg_body *body;
  226|    613|    pjsip_param *ctype_param;
  227|    613|    struct multipart_data *mp_data;
  228|    613|    pj_str_t STR_BOUNDARY = { "boundary", 8 };
  229|       |
  230|    613|    PJ_ASSERT_RETURN(pool, NULL);
  ------------------
  |  |   97|    613|            do { \
  |  |   98|    613|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 613]
  |  |  ------------------
  |  |   99|    613|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 613]
  |  |  ------------------
  ------------------
  |  Branch (230:5): [True: 0, False: 0]
  |  Branch (230:5): [True: 0, False: 0]
  ------------------
  231|       |
  232|    613|    body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body);
  ------------------
  |  |  583|    613|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  233|       |
  234|       |    /* content-type */
  235|    613|    if (ctype && ctype->type.slen) {
  ------------------
  |  Branch (235:9): [True: 613, False: 0]
  |  Branch (235:18): [True: 613, False: 0]
  ------------------
  236|    613|        pjsip_media_type_cp(pool, &body->content_type, ctype);
  237|    613|    } else {
  238|      0|        pj_str_t STR_MULTIPART = {"multipart", 9};
  239|      0|        pj_str_t STR_MIXED = { "mixed", 5 };
  240|       |
  241|      0|        pjsip_media_type_init(&body->content_type,
  242|      0|                              &STR_MULTIPART, &STR_MIXED);
  243|      0|    }
  244|       |
  245|       |    /* multipart data */
  246|    613|    mp_data = PJ_POOL_ZALLOC_T(pool, struct multipart_data);
  ------------------
  |  |  583|    613|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  247|    613|    pj_list_init(&mp_data->part_head);
  248|    613|    if (boundary) {
  ------------------
  |  Branch (248:9): [True: 613, False: 0]
  ------------------
  249|    613|        pj_strdup(pool, &mp_data->boundary, boundary);
  250|    613|    } else {
  251|      0|        pj_create_unique_string(pool, &mp_data->boundary);
  252|      0|    }
  253|    613|    body->data = mp_data;
  254|       |
  255|       |    /* Add ";boundary" parameter to content_type parameter. */
  256|    613|    ctype_param = pjsip_param_find(&body->content_type.param, &STR_BOUNDARY);
  257|    613|    if (!ctype_param) {
  ------------------
  |  Branch (257:9): [True: 612, False: 1]
  ------------------
  258|    612|        ctype_param = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  569|    612|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  259|    612|        ctype_param->name = STR_BOUNDARY;
  260|    612|        pj_list_push_back(&body->content_type.param, ctype_param);
  261|    612|    }
  262|    613|    ctype_param->value = mp_data->boundary;
  263|       |
  264|       |    /* function pointers */
  265|    613|    body->print_body = &multipart_print_body;
  266|    613|    body->clone_data = &multipart_clone_data;
  267|       |
  268|    613|    return body;
  269|    613|}
pjsip_multipart_create_part:
  275|  12.5k|{
  276|  12.5k|    pjsip_multipart_part *mp;
  277|       |
  278|  12.5k|    mp = PJ_POOL_ZALLOC_T(pool, pjsip_multipart_part);
  ------------------
  |  |  583|  12.5k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  279|  12.5k|    pj_list_init(&mp->hdr);
  280|       |
  281|  12.5k|    return mp;
  282|  12.5k|}
pjsip_multipart_add_part:
  315|  12.5k|{
  316|  12.5k|    struct multipart_data *m_data;
  317|       |
  318|       |    /* All params must be specified */
  319|  12.5k|    PJ_ASSERT_RETURN(pool && mp && part, PJ_EINVAL);
  ------------------
  |  |   97|  12.5k|            do { \
  |  |   98|  50.2k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 12.5k, False: 0]
  |  |  |  Branch (98:23): [True: 12.5k, False: 0]
  |  |  |  Branch (98:23): [True: 12.5k, False: 0]
  |  |  ------------------
  |  |   99|  12.5k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 12.5k]
  |  |  ------------------
  ------------------
  |  Branch (319:5): [True: 0, False: 0]
  |  Branch (319:5): [True: 0, False: 0]
  |  Branch (319:5): [True: 0, False: 0]
  |  Branch (319:5): [True: 0, False: 0]
  |  Branch (319:5): [True: 0, False: 0]
  |  Branch (319:5): [True: 0, False: 0]
  ------------------
  320|       |
  321|       |    /* mp must really point to an actual multipart msg body */
  322|  12.5k|    PJ_ASSERT_RETURN(mp->print_body==&multipart_print_body, PJ_EINVAL);
  ------------------
  |  |   97|  12.5k|            do { \
  |  |   98|  12.5k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 12.5k]
  |  |  ------------------
  |  |   99|  12.5k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 12.5k]
  |  |  ------------------
  ------------------
  |  Branch (322:5): [True: 0, False: 0]
  |  Branch (322:5): [True: 0, False: 0]
  ------------------
  323|       |
  324|       |    /* The multipart part must contain a valid message body */
  325|  12.5k|    PJ_ASSERT_RETURN(part->body && part->body->print_body, PJ_EINVAL);
  ------------------
  |  |   97|  12.5k|            do { \
  |  |   98|  25.1k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 12.5k, False: 0]
  |  |  |  Branch (98:23): [True: 12.5k, False: 0]
  |  |  ------------------
  |  |   99|  12.5k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 12.5k]
  |  |  ------------------
  ------------------
  |  Branch (325:5): [True: 0, False: 0]
  |  Branch (325:5): [True: 0, False: 0]
  |  Branch (325:5): [True: 0, False: 0]
  |  Branch (325:5): [True: 0, False: 0]
  ------------------
  326|       |
  327|  12.5k|    m_data = (struct multipart_data*)mp->data;
  328|  12.5k|    pj_list_push_back(&m_data->part_head, part);
  329|       |
  330|  12.5k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1537|  12.5k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  331|       |
  332|  12.5k|    return PJ_SUCCESS;
  333|  12.5k|}
pjsip_multipart_get_first_part:
  340|     71|{
  341|     71|    struct multipart_data *m_data;
  342|       |
  343|       |    /* Must specify mandatory params */
  344|     71|    PJ_ASSERT_RETURN(mp, NULL);
  ------------------
  |  |   97|     71|            do { \
  |  |   98|     71|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 71]
  |  |  ------------------
  |  |   99|     71|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 71]
  |  |  ------------------
  ------------------
  |  Branch (344:5): [True: 0, False: 0]
  |  Branch (344:5): [True: 0, False: 0]
  ------------------
  345|       |
  346|       |    /* mp must really point to an actual multipart msg body */
  347|     71|    PJ_ASSERT_RETURN(mp->print_body==&multipart_print_body, NULL);
  ------------------
  |  |   97|     71|            do { \
  |  |   98|     71|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 71]
  |  |  ------------------
  |  |   99|     71|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 71]
  |  |  ------------------
  ------------------
  |  Branch (347:5): [True: 0, False: 0]
  |  Branch (347:5): [True: 0, False: 0]
  ------------------
  348|       |
  349|     71|    m_data = (struct multipart_data*)mp->data;
  350|     71|    if (pj_list_empty(&m_data->part_head))
  ------------------
  |  Branch (350:9): [True: 1, False: 70]
  ------------------
  351|      1|        return NULL;
  352|       |
  353|     70|    return m_data->part_head.next;
  354|     71|}
pjsip_multipart_get_next_part:
  362|  6.61k|{
  363|  6.61k|    struct multipart_data *m_data;
  364|       |
  365|       |    /* Must specify mandatory params */
  366|  6.61k|    PJ_ASSERT_RETURN(mp && part, NULL);
  ------------------
  |  |   97|  6.61k|            do { \
  |  |   98|  13.2k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 6.61k, False: 0]
  |  |  |  Branch (98:23): [True: 6.61k, False: 0]
  |  |  ------------------
  |  |   99|  6.61k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 6.61k]
  |  |  ------------------
  ------------------
  |  Branch (366:5): [True: 0, False: 0]
  |  Branch (366:5): [True: 0, False: 0]
  |  Branch (366:5): [True: 0, False: 0]
  |  Branch (366:5): [True: 0, False: 0]
  ------------------
  367|       |
  368|       |    /* mp must really point to an actual multipart msg body */
  369|  6.61k|    PJ_ASSERT_RETURN(mp->print_body==&multipart_print_body, NULL);
  ------------------
  |  |   97|  6.61k|            do { \
  |  |   98|  6.61k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 6.61k]
  |  |  ------------------
  |  |   99|  6.61k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 6.61k]
  |  |  ------------------
  ------------------
  |  Branch (369:5): [True: 0, False: 0]
  |  Branch (369:5): [True: 0, False: 0]
  ------------------
  370|       |
  371|  6.61k|    m_data = (struct multipart_data*)mp->data;
  372|       |
  373|       |    /* the part parameter must be really member of the list */
  374|  6.61k|    PJ_ASSERT_RETURN(pj_list_find_node(&m_data->part_head, part) != NULL,
  ------------------
  |  |   97|  6.61k|            do { \
  |  |   98|  6.61k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 6.61k]
  |  |  ------------------
  |  |   99|  6.61k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 6.61k]
  |  |  ------------------
  ------------------
  |  Branch (374:5): [True: 0, False: 0]
  |  Branch (374:5): [True: 0, False: 0]
  ------------------
  375|  6.61k|                     NULL);
  376|       |
  377|  6.61k|    if (part->next == &m_data->part_head)
  ------------------
  |  Branch (377:9): [True: 70, False: 6.54k]
  ------------------
  378|     70|        return NULL;
  379|       |
  380|  6.54k|    return part->next;
  381|  6.61k|}
pjsip_multipart_find_part:
  390|  13.3k|{
  391|  13.3k|    struct multipart_data *m_data;
  392|  13.3k|    pjsip_multipart_part *part;
  393|       |
  394|       |    /* Must specify mandatory params */
  395|  13.3k|    PJ_ASSERT_RETURN(mp && content_type, NULL);
  ------------------
  |  |   97|  13.3k|            do { \
  |  |   98|  26.6k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 13.3k, False: 0]
  |  |  |  Branch (98:23): [True: 13.3k, False: 0]
  |  |  ------------------
  |  |   99|  13.3k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 13.3k]
  |  |  ------------------
  ------------------
  |  Branch (395:5): [True: 0, False: 0]
  |  Branch (395:5): [True: 0, False: 0]
  |  Branch (395:5): [True: 0, False: 0]
  |  Branch (395:5): [True: 0, False: 0]
  ------------------
  396|       |
  397|       |    /* mp must really point to an actual multipart msg body */
  398|  13.3k|    PJ_ASSERT_RETURN(mp->print_body==&multipart_print_body, NULL);
  ------------------
  |  |   97|  13.3k|            do { \
  |  |   98|  13.3k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 13.3k]
  |  |  ------------------
  |  |   99|  13.3k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 13.3k]
  |  |  ------------------
  ------------------
  |  Branch (398:5): [True: 0, False: 0]
  |  Branch (398:5): [True: 0, False: 0]
  ------------------
  399|       |
  400|  13.3k|    m_data = (struct multipart_data*)mp->data;
  401|       |
  402|  13.3k|    if (start)
  ------------------
  |  Branch (402:9): [True: 0, False: 13.3k]
  ------------------
  403|      0|        part = start->next;
  404|  13.3k|    else
  405|  13.3k|        part = m_data->part_head.next;
  406|       |
  407|  9.54M|    while (part != &m_data->part_head) {
  ------------------
  |  Branch (407:12): [True: 9.52M, False: 12.3k]
  ------------------
  408|  9.52M|        if (pjsip_media_type_cmp(&part->body->content_type,
  ------------------
  |  Branch (408:13): [True: 979, False: 9.52M]
  ------------------
  409|  9.52M|                                 content_type, 0)==0)
  410|    979|        {
  411|    979|            return part;
  412|    979|        }
  413|  9.52M|        part = part->next;
  414|  9.52M|    }
  415|       |
  416|  12.3k|    return NULL;
  417|  13.3k|}
pjsip_multipart_parse:
  731|    677|{
  732|    677|    pj_str_t boundary, delim;
  733|    677|    char *curptr, *endptr;
  734|    677|    const pjsip_param *ctype_param;
  735|    677|    const pj_str_t STR_BOUNDARY = { "boundary", 8 };
  736|    677|    pjsip_msg_body *body = NULL;
  737|       |
  738|    677|    PJ_ASSERT_RETURN(pool && buf && len && ctype && !options, NULL);
  ------------------
  |  |   97|    677|            do { \
  |  |   98|  5.41k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 677, False: 0]
  |  |  |  Branch (98:23): [True: 677, False: 0]
  |  |  |  Branch (98:23): [True: 677, False: 0]
  |  |  |  Branch (98:23): [True: 677, False: 0]
  |  |  |  Branch (98:23): [True: 677, False: 0]
  |  |  ------------------
  |  |   99|    677|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 677]
  |  |  ------------------
  ------------------
  |  Branch (738:5): [True: 0, False: 0]
  |  Branch (738:5): [True: 0, False: 0]
  |  Branch (738:5): [True: 0, False: 0]
  |  Branch (738:5): [True: 0, False: 0]
  |  Branch (738:5): [True: 0, False: 0]
  |  Branch (738:5): [True: 0, False: 0]
  |  Branch (738:5): [True: 0, False: 0]
  |  Branch (738:5): [True: 0, False: 0]
  |  Branch (738:5): [True: 0, False: 0]
  |  Branch (738:5): [True: 0, False: 0]
  ------------------
  739|       |
  740|    677|    TRACE_((THIS_FILE, "Started parsing multipart body"));
  741|       |
  742|       |    /* Get the boundary value in the ctype */
  743|    677|    boundary.ptr = NULL;
  744|    677|    boundary.slen = 0;
  745|    677|    ctype_param = pjsip_param_find(&ctype->param, &STR_BOUNDARY);
  746|    677|    if (ctype_param) {
  ------------------
  |  Branch (746:9): [True: 25, False: 652]
  ------------------
  747|     25|        boundary = ctype_param->value;
  748|     25|        if (boundary.slen>2 && *boundary.ptr=='"') {
  ------------------
  |  Branch (748:13): [True: 22, False: 3]
  |  Branch (748:32): [True: 1, False: 21]
  ------------------
  749|       |            /* Remove quote */
  750|      1|            boundary.ptr++;
  751|      1|            boundary.slen -= 2;
  752|      1|        }
  753|     25|        TRACE_((THIS_FILE, "Boundary is specified: '%.*s'", (int)boundary.slen,
  754|     25|                boundary.ptr));
  755|     25|    }
  756|       |
  757|    677|    if (!boundary.slen) {
  ------------------
  |  Branch (757:9): [True: 654, False: 23]
  ------------------
  758|       |        /* Boundary not found or not specified. Try to be clever, get
  759|       |         * the boundary from the body.
  760|       |         */
  761|    654|        char *p=buf, *end=buf+len;
  762|       |
  763|    654|        PJ_LOG(4,(THIS_FILE, "Warning: boundary parameter not found or "
  ------------------
  |  |  106|    654|#define PJ_LOG(level,arg)       do { \
  |  |  107|    654|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|  1.30k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 654, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 654]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|    654|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 654]
  |  |  ------------------
  ------------------
  764|    654|                             "not specified when parsing multipart body"));
  765|       |
  766|       |        /* Find the first "--". This "--" must be right after a CRLF, unless
  767|       |         * it really appears at the start of the buffer.
  768|       |         */
  769|  1.14k|        for (;;) {
  770|  1.89k|            while (p!=end && *p!='-') ++p;
  ------------------
  |  Branch (770:20): [True: 1.85k, False: 39]
  |  Branch (770:30): [True: 756, False: 1.10k]
  ------------------
  771|       |
  772|  1.14k|            if (p == end)
  ------------------
  |  Branch (772:17): [True: 39, False: 1.10k]
  ------------------
  773|     39|                break;
  774|       |
  775|  1.10k|            if ((p+1<end) && *(p+1)=='-' &&
  ------------------
  |  Branch (775:17): [True: 1.09k, False: 10]
  |  Branch (775:30): [True: 847, False: 245]
  ------------------
  776|    847|                ((p>buf && *(p-1)=='\n') || (p==buf)))
  ------------------
  |  Branch (776:19): [True: 269, False: 578]
  |  Branch (776:28): [True: 37, False: 232]
  |  Branch (776:45): [True: 578, False: 232]
  ------------------
  777|    615|            {
  778|    615|                p+=2;
  779|    615|                break;
  780|    615|            } else {
  781|    487|                ++p;
  782|    487|            }
  783|  1.10k|        }
  784|       |
  785|    654|        if (p==end) {
  ------------------
  |  Branch (785:13): [True: 41, False: 613]
  ------------------
  786|       |            /* Unable to determine boundary. Maybe this is not a multipart
  787|       |             * message?
  788|       |             */
  789|     41|            PJ_LOG(4,(THIS_FILE, "Error: multipart boundary not specified and"
  ------------------
  |  |  106|     41|#define PJ_LOG(level,arg)       do { \
  |  |  107|     41|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|     82|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 41, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 41]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|     41|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 41]
  |  |  ------------------
  ------------------
  790|     41|                                 " unable to calculate from the body"));
  791|     41|            return NULL;
  792|     41|        }
  793|       |
  794|    613|        boundary.ptr = p;
  795|  24.8k|        while (p!=end && !pj_isspace(*p)) ++p;
  ------------------
  |  Branch (795:16): [True: 24.8k, False: 40]
  |  Branch (795:26): [True: 24.2k, False: 573]
  ------------------
  796|    613|        boundary.slen = p - boundary.ptr;
  797|       |
  798|    613|        TRACE_((THIS_FILE, "Boundary is calculated: '%.*s'",
  799|    613|                (int)boundary.slen, boundary.ptr));
  800|    613|    }
  801|       |
  802|       |
  803|       |    /* Build the delimiter:
  804|       |     *   delimiter = "--" boundary
  805|       |     */
  806|    636|    delim.slen = boundary.slen+2;
  807|    636|    delim.ptr = (char*)pj_pool_alloc(pool, (int)delim.slen);
  808|    636|    delim.ptr[0] = '-';
  809|    636|    delim.ptr[1] = '-';
  810|    636|    pj_memcpy(delim.ptr+2, boundary.ptr, boundary.slen);
  811|       |
  812|       |    /* Start parsing the body, skip until the first delimiter. */
  813|    636|    curptr = buf;
  814|    636|    endptr = buf + len;
  815|    636|    {
  816|    636|        pj_str_t strbody;
  817|       |
  818|    636|        strbody.ptr = buf; strbody.slen = len;
  819|    636|        curptr = pj_strstr(&strbody, &delim);
  820|    636|        if (!curptr)
  ------------------
  |  Branch (820:13): [True: 23, False: 613]
  ------------------
  821|     23|            return NULL;
  822|    636|    }
  823|       |
  824|    613|    body = pjsip_multipart_create(pool, ctype, &boundary);
  825|       |
  826|       |    /* Save full raw body */
  827|    613|    {
  828|    613|        struct multipart_data *mp = (struct multipart_data*)body->data;
  829|    613|        pj_strset(&mp->raw_data, buf, len);
  830|    613|    }
  831|       |
  832|  13.1k|    for (;;) {
  833|  13.1k|        char *start_body, *end_body;
  834|  13.1k|        pjsip_multipart_part *part;
  835|       |
  836|       |        /* Eat the boundary */
  837|  13.1k|        curptr += delim.slen;
  838|  13.1k|        if (curptr+1 < endptr && *curptr=='-' && *(curptr+1)=='-') {
  ------------------
  |  Branch (838:13): [True: 12.7k, False: 449]
  |  Branch (838:34): [True: 79, False: 12.6k]
  |  Branch (838:50): [True: 71, False: 8]
  ------------------
  839|       |            /* Found the closing delimiter */
  840|     71|            curptr += 2;
  841|     71|            break;
  842|     71|        }
  843|       |        /* Optional whitespace after delimiter */
  844|  13.4k|        while (curptr!=endptr && IS_SPACE(*curptr)) ++curptr;
  ------------------
  |  |   33|  13.0k|#define IS_SPACE(c)     ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (33:26): [True: 198, False: 12.8k]
  |  |  |  Branch (33:38): [True: 195, False: 12.6k]
  |  |  ------------------
  ------------------
  |  Branch (844:16): [True: 13.0k, False: 423]
  ------------------
  845|       |        /* Mandatory CRLF */
  846|  13.0k|        if (curptr == endptr) {
  ------------------
  |  Branch (846:13): [True: 423, False: 12.6k]
  ------------------
  847|    423|            PJ_LOG(2, (THIS_FILE, "Unexpected end of buffer after boundary"));
  ------------------
  |  |  106|    423|#define PJ_LOG(level,arg)       do { \
  |  |  107|    423|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    846|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 423, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 423]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  448|      0|    #define pj_log_wrapper_2(arg)       pj_log_2 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|    423|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 423]
  |  |  ------------------
  ------------------
  848|    423|            return NULL;
  849|    423|        }
  850|  12.6k|        if (*curptr=='\r') ++curptr;
  ------------------
  |  Branch (850:13): [True: 202, False: 12.4k]
  ------------------
  851|  12.6k|        if (curptr == endptr || *curptr!='\n') {
  ------------------
  |  Branch (851:13): [True: 9, False: 12.6k]
  |  Branch (851:33): [True: 39, False: 12.6k]
  ------------------
  852|       |            /* Expecting a newline here */
  853|     48|            PJ_LOG(2, (THIS_FILE, "Failed to find newline"));
  ------------------
  |  |  106|     48|#define PJ_LOG(level,arg)       do { \
  |  |  107|     48|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|     96|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 48, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 48]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  448|      0|    #define pj_log_wrapper_2(arg)       pj_log_2 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|     48|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 48]
  |  |  ------------------
  ------------------
  854|       |
  855|     48|            return NULL;
  856|     48|        }
  857|  12.6k|        ++curptr;
  858|       |
  859|       |        /* We now in the start of the body */
  860|  12.6k|        start_body = curptr;
  861|       |
  862|       |        /* Find the next delimiter */
  863|  12.6k|        {
  864|  12.6k|            pj_str_t subbody;
  865|       |
  866|  12.6k|            subbody.ptr = curptr; subbody.slen = endptr - curptr;
  867|  12.6k|            curptr = pj_strstr(&subbody, &delim);
  868|  12.6k|            if (!curptr) {
  ------------------
  |  Branch (868:17): [True: 71, False: 12.5k]
  ------------------
  869|       |                /* We're really expecting end delimiter to be found. */
  870|     71|                PJ_LOG(2, (THIS_FILE, "Failed to find end-delimiter"));
  ------------------
  |  |  106|     71|#define PJ_LOG(level,arg)       do { \
  |  |  107|     71|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|    142|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 71, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 71]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  448|      0|    #define pj_log_wrapper_2(arg)       pj_log_2 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|     71|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 71]
  |  |  ------------------
  ------------------
  871|     71|                return NULL;
  872|     71|            }
  873|  12.6k|        }
  874|       |
  875|  12.5k|        end_body = curptr;
  876|       |
  877|       |        /* Note that when body is empty, end_body will be equal
  878|       |         * to start_body.
  879|       |         */
  880|  12.5k|        if (end_body > start_body) {
  ------------------
  |  Branch (880:13): [True: 5.24k, False: 7.30k]
  ------------------
  881|       |            /* The newline preceeding the delimiter is conceptually part of
  882|       |             * the delimiter, so trim it from the body.
  883|       |             */
  884|  5.24k|            if (*(end_body-1) == '\n')
  ------------------
  |  Branch (884:17): [True: 3.79k, False: 1.45k]
  ------------------
  885|  3.79k|                --end_body;
  886|  5.24k|            if (end_body > start_body && *(end_body-1) == '\r')
  ------------------
  |  Branch (886:17): [True: 4.97k, False: 276]
  |  Branch (886:42): [True: 294, False: 4.67k]
  ------------------
  887|    294|                --end_body;
  888|  5.24k|        }
  889|       |
  890|       |        /* Now that we have determined the part's boundary, parse it
  891|       |         * to get the header and body part of the part.
  892|       |         */
  893|  12.5k|        part = parse_multipart_part(pool, start_body, end_body - start_body,
  894|  12.5k|                                    ctype);
  895|  12.5k|        if (part) {
  ------------------
  |  Branch (895:13): [True: 12.5k, False: 0]
  ------------------
  896|  12.5k|            TRACE_((THIS_FILE, "Adding part"));
  897|  12.5k|            pjsip_multipart_add_part(pool, body, part);
  898|  12.5k|        } else {
  899|      0|            PJ_LOG(2, (THIS_FILE, "Failed to add part"));
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  448|      0|    #define pj_log_wrapper_2(arg)       pj_log_2 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  900|      0|        }
  901|  12.5k|    }
  902|     71|    TRACE_((THIS_FILE, "pjsip_multipart_parse finished: %p", body));
  903|       |
  904|     71|    return body;
  905|    613|}
sip_multipart.c:parse_multipart_part:
  638|  12.5k|{
  639|  12.5k|    pjsip_multipart_part *part = pjsip_multipart_create_part(pool);
  640|  12.5k|    char *p = start, *end = start+len, *end_hdr = NULL, *start_body;
  641|  12.5k|    pjsip_ctype_hdr *ctype_hdr = NULL;
  642|       |
  643|  12.5k|    TRACE_((THIS_FILE, "Parsing part: begin--\n%.*s\n--end",
  644|  12.5k|            (int)len, start));
  645|       |
  646|       |    /* Find the end of header area, by looking at an empty line */
  647|  19.3k|    for (;;) {
  648|  75.3k|        while (p!=end && *p!='\n') ++p;
  ------------------
  |  Branch (648:16): [True: 66.5k, False: 8.75k]
  |  Branch (648:26): [True: 55.9k, False: 10.5k]
  ------------------
  649|  19.3k|        if (p==end) {
  ------------------
  |  Branch (649:13): [True: 8.75k, False: 10.5k]
  ------------------
  650|  8.75k|            start_body = end;
  651|  8.75k|            break;
  652|  8.75k|        }
  653|  10.5k|        if ((p==start) || (p==start+1 && *(p-1)=='\r')) {
  ------------------
  |  Branch (653:13): [True: 213, False: 10.3k]
  |  Branch (653:28): [True: 1.64k, False: 8.73k]
  |  Branch (653:42): [True: 196, False: 1.45k]
  ------------------
  654|       |            /* Empty header section */
  655|    409|            end_hdr = start;
  656|    409|            start_body = ++p;
  657|    409|            break;
  658|  10.1k|        } else if (p==end-1) {
  ------------------
  |  Branch (658:20): [True: 2.87k, False: 7.30k]
  ------------------
  659|       |            /* Empty body section */
  660|  2.87k|            end_hdr = end;
  661|  2.87k|            start_body = ++p;
  662|  2.87k|            break;
  663|  7.30k|        } else if ((p>=start+1 && *(p-1)=='\n') ||
  ------------------
  |  Branch (663:21): [True: 7.30k, False: 0]
  |  Branch (663:35): [True: 301, False: 7.00k]
  ------------------
  664|  7.00k|                   (p>=start+2 && *(p-1)=='\r' && *(p-2)=='\n'))
  ------------------
  |  Branch (664:21): [True: 5.95k, False: 1.05k]
  |  Branch (664:35): [True: 1.20k, False: 4.75k]
  |  Branch (664:51): [True: 205, False: 995]
  ------------------
  665|    506|        {
  666|       |            /* Found it */
  667|    506|            end_hdr = (*(p-1)=='\r') ? (p-1) : p;
  ------------------
  |  Branch (667:23): [True: 205, False: 301]
  ------------------
  668|    506|            start_body = ++p;
  669|    506|            break;
  670|  6.80k|        } else {
  671|  6.80k|            ++p;
  672|  6.80k|        }
  673|  10.5k|    }
  674|       |
  675|       |    /* Parse the headers */
  676|  12.5k|    if (end_hdr-start > 0) {
  ------------------
  |  Branch (676:9): [True: 3.38k, False: 9.16k]
  ------------------
  677|  3.38k|        pjsip_hdr *hdr;
  678|  3.38k|        pj_status_t status;
  679|       |
  680|  3.38k|        status = pjsip_parse_headers(pool, start, end_hdr-start, 
  681|  3.38k|                                     &part->hdr, 0);
  682|  3.38k|        if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (682:13): [True: 0, False: 3.38k]
  ------------------
  683|      0|            PJ_PERROR(2,(THIS_FILE, status, "Warning: error parsing multipart"
  ------------------
  |  |  189|      0|#define PJ_PERROR(level,arg)    do { \
  |  |  190|      0|                                    pj_perror_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  579|      0|    #define pj_perror_wrapper_2(arg)    pj_perror_2 arg
  |  |  ------------------
  |  |  191|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (191:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  684|      0|                                            " header"));
  685|      0|        }
  686|       |
  687|       |        /* Find Content-Type header */
  688|  3.38k|        hdr = part->hdr.next;
  689|  6.80k|        while (hdr != &part->hdr) {
  ------------------
  |  Branch (689:16): [True: 3.42k, False: 3.38k]
  ------------------
  690|  3.42k|            TRACE_((THIS_FILE, "Header parsed: %.*s", (int)hdr->name.slen,
  691|  3.42k|                    hdr->name.ptr));
  692|  3.42k|            if (hdr->type == PJSIP_H_CONTENT_TYPE) {
  ------------------
  |  Branch (692:17): [True: 508, False: 2.91k]
  ------------------
  693|    508|                ctype_hdr = (pjsip_ctype_hdr*)hdr;
  694|    508|            }
  695|  3.42k|            hdr = hdr->next;
  696|  3.42k|        }
  697|  3.38k|    }
  698|       |
  699|       |    /* Assign the body */
  700|  12.5k|    part->body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body);
  ------------------
  |  |  583|  12.5k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  701|  12.5k|    if (ctype_hdr) {
  ------------------
  |  Branch (701:9): [True: 290, False: 12.2k]
  ------------------
  702|    290|        pjsip_media_type_cp(pool, &part->body->content_type, &ctype_hdr->media);
  703|  12.2k|    } else if (pct && pj_stricmp2(&pct->subtype, "digest")==0) {
  ------------------
  |  Branch (703:16): [True: 12.2k, False: 0]
  |  Branch (703:23): [True: 5.82k, False: 6.43k]
  ------------------
  704|  5.82k|        part->body->content_type.type = pj_str("message");
  705|  5.82k|        part->body->content_type.subtype = pj_str("rfc822");
  706|  6.43k|    } else {
  707|  6.43k|        part->body->content_type.type = pj_str("text");
  708|  6.43k|        part->body->content_type.subtype = pj_str("plain");
  709|  6.43k|    }
  710|       |
  711|  12.5k|    if (start_body < end) {
  ------------------
  |  Branch (711:9): [True: 803, False: 11.7k]
  ------------------
  712|    803|        part->body->data = start_body;
  713|    803|        part->body->len = (unsigned)(end - start_body);
  714|  11.7k|    } else {
  715|  11.7k|        part->body->data = (void*)"";
  716|  11.7k|        part->body->len = 0;
  717|  11.7k|    }
  718|  12.5k|    TRACE_((THIS_FILE, "Body parsed: \"%.*s\"", (int)part->body->len,
  719|  12.5k|            part->body->data));
  720|  12.5k|    part->body->print_body = &pjsip_print_text_body;
  721|  12.5k|    part->body->clone_data = &pjsip_clone_text_data;
  722|       |
  723|  12.5k|    return part;
  724|  12.5k|}

pjsip_parser_const:
  290|  17.7k|{
  291|  17.7k|    return &pconst;
  292|  17.7k|}
init_sip_parser:
  549|      1|{
  550|      1|    pj_enter_critical_section();
  551|      1|    if (++parser_is_initialized == 1) {
  ------------------
  |  Branch (551:9): [True: 1, False: 0]
  ------------------
  552|      1|        init_parser();
  553|      1|    }
  554|      1|    pj_leave_critical_section();
  555|      1|}
pjsip_register_hdr_parser:
  665|     23|{
  666|     23|    unsigned i;
  667|     23|    pj_size_t len;
  668|     23|    char hname_lcase[PJSIP_MAX_HNAME_LEN+1];
  669|     23|    pj_status_t status;
  670|       |
  671|       |    /* Check that name is not too long */
  672|     23|    len = pj_ansi_strlen(hname);
  ------------------
  |  |   69|     23|#define pj_ansi_strlen          strlen
  ------------------
  673|     23|    if (len > PJSIP_MAX_HNAME_LEN) {
  ------------------
  |  | 1145|     23|#define PJSIP_MAX_HNAME_LEN             64
  ------------------
  |  Branch (673:9): [True: 0, False: 23]
  ------------------
  674|      0|        pj_assert(!"Header name is too long!");
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (674:9): [Folded, False: 0]
  |  Branch (674:9): [Folded, False: 0]
  ------------------
  675|      0|        return PJ_ENAMETOOLONG;
  ------------------
  |  |  398|      0|#define PJ_ENAMETOOLONG     (PJ_ERRNO_START_STATUS + 5) /* 70005 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  676|      0|    }
  677|       |
  678|       |    /* Register the normal Mixed-Case name */
  679|     23|    status = int_register_parser(hname, fptr);
  680|     23|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (680:9): [True: 0, False: 23]
  ------------------
  681|      0|        return status;
  682|      0|    }
  683|       |
  684|       |    /* Get the lower-case name */
  685|    238|    for (i=0; i<len; ++i) {
  ------------------
  |  Branch (685:15): [True: 215, False: 23]
  ------------------
  686|    215|        hname_lcase[i] = (char)pj_tolower(hname[i]);
  687|    215|    }
  688|     23|    hname_lcase[len] = '\0';
  689|       |
  690|       |    /* Register the lower-case version of the name */
  691|     23|    status = int_register_parser(hname_lcase, fptr);
  692|     23|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (692:9): [True: 0, False: 23]
  ------------------
  693|      0|        return status;
  694|      0|    }
  695|       |    
  696|       |
  697|       |    /* Register the shortname version of the name */
  698|     23|    if (hshortname) {
  ------------------
  |  Branch (698:9): [True: 8, False: 15]
  ------------------
  699|      8|        status = int_register_parser(hshortname, fptr);
  700|      8|        if (status != PJ_SUCCESS) 
  ------------------
  |  Branch (700:13): [True: 0, False: 8]
  ------------------
  701|      0|            return status;
  702|      8|    }
  703|     23|    return PJ_SUCCESS;
  704|     23|}
pjsip_register_uri_parser:
  783|      3|{
  784|      3|    if (uri_handler_count >= PJ_ARRAY_SIZE(uri_handler))
  ------------------
  |  |  315|      3|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (784:9): [True: 0, False: 3]
  ------------------
  785|      0|        return PJ_ETOOMANY;
  ------------------
  |  |  423|      0|#define PJ_ETOOMANY         (PJ_ERRNO_START_STATUS + 10)/* 70010 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  786|       |
  787|      3|    uri_handler[uri_handler_count].scheme = pj_str((char*)scheme);
  788|      3|    uri_handler[uri_handler_count].parse = func;
  789|      3|    ++uri_handler_count;
  790|       |
  791|      3|    return PJ_SUCCESS;
  792|      3|}
pjsip_parse_msg:
  798|  6.10k|{
  799|  6.10k|    pjsip_msg *msg = NULL;
  800|  6.10k|    pj_scanner scanner;
  801|  6.10k|    pjsip_parse_ctx context;
  802|       |
  803|  6.10k|    pj_scan_init(&scanner, buf, size, PJ_SCAN_AUTOSKIP_WS_HEADER, 
  804|  6.10k|                 &on_syntax_error);
  805|       |
  806|  6.10k|    context.scanner = &scanner;
  807|  6.10k|    context.pool = pool;
  808|  6.10k|    context.rdata = NULL;
  809|       |
  810|  6.10k|    msg = int_parse_msg(&context, err_list);
  811|       |
  812|  6.10k|    pj_scan_fini(&scanner);
  813|  6.10k|    return msg;
  814|  6.10k|}
pjsip_parse_uri:
  960|  7.88k|{
  961|  7.88k|    pj_scanner scanner;
  962|  7.88k|    pjsip_uri *uri = NULL;
  963|  7.88k|    PJ_USE_EXCEPTION;
  ------------------
  |  |  367|  7.88k|#define PJ_USE_EXCEPTION    struct pj_exception_state_t pj_x_except__; int pj_x_code__
  ------------------
  964|       |
  965|  7.88k|    pj_scan_init(&scanner, buf, size, 0, &on_syntax_error);
  966|       |
  967|       |    
  968|  7.88k|    PJ_TRY {
  ------------------
  |  |  373|  7.88k|#define PJ_TRY              if (1) { \
  |  |  ------------------
  |  |  |  Branch (373:33): [True: 7.88k, Folded]
  |  |  ------------------
  |  |  374|  7.88k|                                pj_push_exception_handler_(&pj_x_except__); \
  |  |  375|  7.88k|                                pj_x_code__ = pj_setjmp(pj_x_except__.state); \
  |  |  ------------------
  |  |  |  |   31|  7.88k|#    define pj_setjmp(buf)      setjmp(buf)
  |  |  ------------------
  |  |  376|  7.88k|                                if (pj_x_code__ == 0)
  |  |  ------------------
  |  |  |  Branch (376:37): [True: 7.88k, False: 0]
  |  |  ------------------
  ------------------
  969|  7.88k|        uri = int_parse_uri_or_name_addr(&scanner, pool, option);
  970|  7.88k|    }
  971|      0|    PJ_CATCH_ANY {
  972|      0|        uri = NULL;
  973|      0|    }
  974|  7.88k|    PJ_END;
  ------------------
  |  |  394|  7.88k|#define PJ_END                  pj_pop_exception_handler_(&pj_x_except__); \
  |  |  395|  7.88k|                            } else {}
  ------------------
  975|       |
  976|       |    /* Must have exhausted all inputs. */
  977|  7.88k|    if (pj_scan_is_eof(&scanner) || IS_NEWLINE(*scanner.curptr)) {
  ------------------
  |  |   62|  3.96k|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 136, False: 3.83k]
  |  |  |  Branch (62:39): [True: 175, False: 3.65k]
  |  |  ------------------
  ------------------
  |  Branch (977:9): [True: 3.91k, False: 3.96k]
  ------------------
  978|       |        /* Success. */
  979|  4.22k|        pj_scan_fini(&scanner);
  980|  4.22k|        return uri;
  981|  4.22k|    }
  982|       |
  983|       |    /* Still have some characters unparsed. */
  984|  3.65k|    pj_scan_fini(&scanner);
  985|       |    return NULL;
  986|  7.88k|}
pjsip_parse_param_imp:
 1268|  34.6k|{
 1269|  34.6k|    parse_param_imp(scanner, pool, pname, pvalue, &pconst.pjsip_TOKEN_SPEC,
 1270|       |                    // Token does not need to be unescaped.
 1271|       |                    // Refer to PR #2933.
 1272|       |                    // &pconst.pjsip_TOKEN_SPEC_ESC,
 1273|       |                    NULL, option);
 1274|  34.6k|}
pjsip_parse_uri_param_imp:
 1281|  8.69k|{
 1282|  8.69k|    parse_param_imp(scanner,pool, pname, pvalue, &pconst.pjsip_PARAM_CHAR_SPEC,
 1283|  8.69k|                    &pconst.pjsip_PARAM_CHAR_SPEC_ESC, option);
 1284|  8.69k|}
pjsip_parse_end_hdr_imp:
 1761|  4.75k|{
 1762|  4.75k|    parse_hdr_end(scanner);
 1763|  4.75k|}
pjsip_parse_hdr:
 2417|    691|{
 2418|    691|    pj_scanner scanner;
 2419|    691|    pjsip_hdr *hdr = NULL;
 2420|    691|    pjsip_parse_ctx context;
 2421|    691|    PJ_USE_EXCEPTION;
  ------------------
  |  |  367|    691|#define PJ_USE_EXCEPTION    struct pj_exception_state_t pj_x_except__; int pj_x_code__
  ------------------
 2422|       |
 2423|    691|    pj_scan_init(&scanner, buf, size, PJ_SCAN_AUTOSKIP_WS_HEADER, 
 2424|    691|                 &on_syntax_error);
 2425|       |
 2426|    691|    context.scanner = &scanner;
 2427|    691|    context.pool = pool;
 2428|    691|    context.rdata = NULL;
 2429|       |
 2430|    691|    PJ_TRY {
  ------------------
  |  |  373|    691|#define PJ_TRY              if (1) { \
  |  |  ------------------
  |  |  |  Branch (373:33): [True: 691, Folded]
  |  |  ------------------
  |  |  374|    691|                                pj_push_exception_handler_(&pj_x_except__); \
  |  |  375|    691|                                pj_x_code__ = pj_setjmp(pj_x_except__.state); \
  |  |  ------------------
  |  |  |  |   31|    691|#    define pj_setjmp(buf)      setjmp(buf)
  |  |  ------------------
  |  |  376|    691|                                if (pj_x_code__ == 0)
  |  |  ------------------
  |  |  |  Branch (376:37): [True: 691, False: 0]
  |  |  ------------------
  ------------------
 2431|    691|        pjsip_parse_hdr_func *func = find_handler(hname);
 2432|    691|        if (func) {
  ------------------
  |  Branch (2432:13): [True: 691, False: 0]
  ------------------
 2433|    691|            hdr = (*func)(&context);
 2434|    691|        } else {
 2435|      0|            hdr = parse_hdr_generic_string(&context);
 2436|      0|            hdr->type = PJSIP_H_OTHER;
 2437|      0|            pj_strdup(pool, &hdr->name, hname);
 2438|      0|            hdr->sname = hdr->name;
 2439|      0|        }
 2440|       |
 2441|    691|    } 
 2442|      0|    PJ_CATCH_ANY {
 2443|      0|        hdr = NULL;
 2444|      0|    }
 2445|    691|    PJ_END
  ------------------
  |  |  394|    691|#define PJ_END                  pj_pop_exception_handler_(&pj_x_except__); \
  |  |  395|    691|                            } else {}
  ------------------
 2446|       |
 2447|    691|    if (parsed_len) {
  ------------------
  |  Branch (2447:9): [True: 0, False: 691]
  ------------------
 2448|      0|        *parsed_len = (unsigned)(scanner.curptr - scanner.begin);
 2449|      0|    }
 2450|       |
 2451|    691|    pj_scan_fini(&scanner);
 2452|       |
 2453|    691|    return hdr;
 2454|    691|}
pjsip_parse_headers:
 2460|  3.38k|{
 2461|  3.38k|    enum { STOP_ON_ERROR = 1 };
 2462|  3.38k|    pj_str_t hname = {0, 0};
 2463|  3.38k|    pj_scanner scanner;
 2464|  3.38k|    pjsip_parse_ctx ctx;
 2465|       |
 2466|  3.38k|    PJ_USE_EXCEPTION;
  ------------------
  |  |  367|  3.38k|#define PJ_USE_EXCEPTION    struct pj_exception_state_t pj_x_except__; int pj_x_code__
  ------------------
 2467|       |
 2468|  3.38k|    pj_scan_init(&scanner, input, size, PJ_SCAN_AUTOSKIP_WS_HEADER,
 2469|  3.38k|                 &on_syntax_error);
 2470|       |
 2471|  3.38k|    pj_bzero(&ctx, sizeof(ctx));
 2472|  3.38k|    ctx.scanner = &scanner;
 2473|  3.38k|    ctx.pool = pool;
 2474|       |
 2475|  5.26k|retry_parse:
 2476|  5.26k|    PJ_TRY
  ------------------
  |  |  373|  5.26k|#define PJ_TRY              if (1) { \
  |  |  ------------------
  |  |  |  Branch (373:33): [True: 5.26k, Folded]
  |  |  ------------------
  |  |  374|  5.26k|                                pj_push_exception_handler_(&pj_x_except__); \
  |  |  375|  5.26k|                                pj_x_code__ = pj_setjmp(pj_x_except__.state); \
  |  |  ------------------
  |  |  |  |   31|  5.26k|#    define pj_setjmp(buf)      setjmp(buf)
  |  |  ------------------
  |  |  376|  5.26k|                                if (pj_x_code__ == 0)
  |  |  ------------------
  |  |  |  Branch (376:37): [True: 5.26k, False: 0]
  |  |  ------------------
  ------------------
 2477|  5.26k|    {
 2478|       |        /* Parse headers. */
 2479|  7.33k|        do {
 2480|  7.33k|            pjsip_parse_hdr_func * func;
 2481|  7.33k|            pjsip_hdr *hdr = NULL;
 2482|       |
 2483|       |            /* Init hname just in case parsing fails.
 2484|       |             * Ref: PROTOS #2412
 2485|       |             */
 2486|  7.33k|            hname.slen = 0;
 2487|       |
 2488|       |            /* Get hname. */            
 2489|  7.33k|            pj_scan_get( &scanner, &pconst.pjsip_TOKEN_SPEC, &hname);
 2490|  7.33k|            if (pj_scan_get_char( &scanner ) != ':') {
  ------------------
  |  Branch (2490:17): [True: 1.65k, False: 5.68k]
  ------------------
 2491|  1.65k|                PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|  1.65k|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 2492|  1.65k|            }
 2493|       |
 2494|       |            /* Find handler. */
 2495|  5.68k|            func = find_handler(&hname);
 2496|       |
 2497|       |            /* Call the handler if found.
 2498|       |             * If no handler is found, then treat the header as generic
 2499|       |             * hname/hvalue pair.
 2500|       |             */
 2501|  5.68k|            if (func) {
  ------------------
  |  Branch (2501:17): [True: 3.42k, False: 2.25k]
  ------------------
 2502|  3.42k|                hdr = (*func)(&ctx);
 2503|  3.42k|            } else {
 2504|  2.25k|                hdr = parse_hdr_generic_string(&ctx);
 2505|  2.25k|                hdr->name = hdr->sname = hname;
 2506|  2.25k|            }
 2507|       |
 2508|       |            /* Single parse of header line can produce multiple headers.
 2509|       |             * For example, if one Contact: header contains Contact list
 2510|       |             * separated by comma, then these Contacts will be split into
 2511|       |             * different Contact headers.
 2512|       |             * So here we must insert list instead of just insert one header.
 2513|       |             */
 2514|  5.68k|            if (hdr)
  ------------------
  |  Branch (2514:17): [True: 3.05k, False: 2.63k]
  ------------------
 2515|  3.05k|                pj_list_insert_nodes_before(hlist, hdr);
 2516|       |
 2517|       |            /* Parse until EOF or an empty line is found. */
 2518|  5.68k|        } while (!pj_scan_is_eof(&scanner) && !IS_NEWLINE(*scanner.curptr));
  ------------------
  |  |   62|  2.50k|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 233, False: 2.27k]
  |  |  |  Branch (62:39): [True: 206, False: 2.06k]
  |  |  ------------------
  ------------------
  |  Branch (2518:18): [True: 2.50k, False: 3.17k]
  ------------------
 2519|       |
 2520|       |        /* If empty line is found, eat it. */
 2521|  3.61k|        if (!pj_scan_is_eof(&scanner)) {
  ------------------
  |  Branch (2521:13): [True: 439, False: 3.17k]
  ------------------
 2522|    439|            if (IS_NEWLINE(*scanner.curptr)) {
  ------------------
  |  |   62|    439|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 233, False: 206]
  |  |  |  Branch (62:39): [True: 206, False: 0]
  |  |  ------------------
  ------------------
 2523|    439|                pj_scan_get_newline(&scanner);
 2524|    439|            }
 2525|    439|        }
 2526|  3.61k|    }
 2527|      0|    PJ_CATCH_ANY
 2528|      0|    {
 2529|      0|        PJ_LOG(4,(THIS_FILE, "Error parsing header: '%.*s' line %d col %d",
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.28k|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 4.28k, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 4.28k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  480|      0|    #define pj_log_wrapper_4(arg)       pj_log_4 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2530|      0|                  (int)hname.slen, hname.ptr, scanner.line,
 2531|      0|                  pj_scan_get_col(&scanner)));
 2532|       |
 2533|       |        /* Exception was thrown during parsing. */
 2534|      0|        if ((options & STOP_ON_ERROR) == STOP_ON_ERROR) {
  ------------------
  |  Branch (2534:13): [True: 0, False: 0]
  ------------------
 2535|      0|            pj_scan_fini(&scanner);
 2536|      0|            return PJSIP_EINVALIDHDR;
  ------------------
  |  |  175|      0|#define PJSIP_EINVALIDHDR       (PJSIP_ERRNO_START_PJSIP + 51)  /* 171051 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2537|      0|        }
 2538|       |
 2539|       |        /* Skip until newline, and parse next header. */
 2540|  3.00k|        if (!pj_scan_is_eof(&scanner)) {
  ------------------
  |  Branch (2540:13): [True: 3.00k, False: 18.4E]
  ------------------
 2541|       |            /* Skip until next line.
 2542|       |             * Watch for header continuation.
 2543|       |             */
 2544|  3.25k|            do {
 2545|  3.25k|                pj_scan_skip_line(&scanner);
 2546|  3.25k|            } while (IS_SPACE(*scanner.curptr));
  ------------------
  |  |   63|  3.25k|#define IS_SPACE(c)     ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (63:26): [True: 196, False: 3.05k]
  |  |  |  Branch (63:38): [True: 58, False: 3.00k]
  |  |  ------------------
  ------------------
 2547|  3.00k|        }
 2548|       |
 2549|       |        /* Restore flag. Flag may be set in int_parse_sip_url() */
 2550|      0|        scanner.skip_ws = PJ_SCAN_AUTOSKIP_WS_HEADER;
 2551|       |
 2552|       |        /* Continue parse next header, if any. */
 2553|  2.28k|        if (!pj_scan_is_eof(&scanner) && !IS_NEWLINE(*scanner.curptr)) {
  ------------------
  |  |   62|  2.28k|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 195, False: 2.08k]
  |  |  |  Branch (62:39): [True: 207, False: 1.87k]
  |  |  ------------------
  ------------------
  |  Branch (2553:13): [True: 2.28k, False: 18.4E]
  ------------------
 2554|  1.87k|            goto retry_parse;
 2555|  1.87k|        }
 2556|       |
 2557|      0|    }
 2558|  1.73k|    PJ_END;
  ------------------
  |  |  394|  1.73k|#define PJ_END                  pj_pop_exception_handler_(&pj_x_except__); \
  |  |  395|  1.73k|                            } else {}
  ------------------
 2559|       |
 2560|  1.73k|    return PJ_SUCCESS;
 2561|  5.26k|}
sip_parser.c:init_parser:
  329|      1|{
  330|      1|    pj_status_t status;
  331|       |
  332|       |    /*
  333|       |     * Syntax error exception number.
  334|       |     */
  335|      1|    pj_assert (PJSIP_SYN_ERR_EXCEPTION == -1);
  ------------------
  |  |   65|      1|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (335:5): [True: 0, False: 1]
  |  Branch (335:5): [True: 1, False: 0]
  ------------------
  336|      1|    status = pj_exception_id_alloc("PJSIP syntax error", 
  337|      1|                                   &PJSIP_SYN_ERR_EXCEPTION);
  338|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (338:5): [True: 0, False: 0]
  |  Branch (338:5): [True: 0, False: 0]
  ------------------
  339|       |
  340|       |    /*
  341|       |     * Invalid value exception.
  342|       |     */
  343|      1|    pj_assert (PJSIP_EINVAL_ERR_EXCEPTION == -2);
  ------------------
  |  |   65|      1|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (343:5): [True: 0, False: 1]
  |  Branch (343:5): [True: 1, False: 0]
  ------------------
  344|      1|    status = pj_exception_id_alloc("PJSIP invalid value error", 
  345|      1|                                   &PJSIP_EINVAL_ERR_EXCEPTION);
  346|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (346:5): [True: 0, False: 0]
  |  Branch (346:5): [True: 0, False: 0]
  ------------------
  347|       |
  348|       |    /*
  349|       |     * Init character input spec (cis)
  350|       |     */
  351|       |
  352|      1|    pj_cis_buf_init(&cis_buf);
  353|       |
  354|      1|    status = pj_cis_init(&cis_buf, &pconst.pjsip_DIGIT_SPEC);
  355|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (355:5): [True: 0, False: 0]
  |  Branch (355:5): [True: 0, False: 0]
  ------------------
  356|      1|    pj_cis_add_num(&pconst.pjsip_DIGIT_SPEC);
  357|       |    
  358|      1|    status = pj_cis_init(&cis_buf, &pconst.pjsip_ALPHA_SPEC);
  359|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (359:5): [True: 0, False: 0]
  |  Branch (359:5): [True: 0, False: 0]
  ------------------
  360|      1|    pj_cis_add_alpha( &pconst.pjsip_ALPHA_SPEC );
  361|       |    
  362|      1|    status = pj_cis_init(&cis_buf, &pconst.pjsip_ALNUM_SPEC);
  363|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (363:5): [True: 0, False: 0]
  |  Branch (363:5): [True: 0, False: 0]
  ------------------
  364|      1|    pj_cis_add_alpha( &pconst.pjsip_ALNUM_SPEC );
  365|      1|    pj_cis_add_num( &pconst.pjsip_ALNUM_SPEC );
  366|       |
  367|      1|    status = pj_cis_init(&cis_buf, &pconst.pjsip_NOT_NEWLINE);
  368|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (368:5): [True: 0, False: 0]
  |  Branch (368:5): [True: 0, False: 0]
  ------------------
  369|      1|    pj_cis_add_str(&pconst.pjsip_NOT_NEWLINE, "\r\n");
  370|      1|    pj_cis_invert(&pconst.pjsip_NOT_NEWLINE);
  371|       |
  372|      1|    status = pj_cis_init(&cis_buf, &pconst.pjsip_NOT_COMMA_OR_NEWLINE);
  373|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (373:5): [True: 0, False: 0]
  |  Branch (373:5): [True: 0, False: 0]
  ------------------
  374|      1|    pj_cis_add_str( &pconst.pjsip_NOT_COMMA_OR_NEWLINE, ",\r\n");
  375|      1|    pj_cis_invert(&pconst.pjsip_NOT_COMMA_OR_NEWLINE);
  376|       |
  377|      1|    status = pj_cis_dup(&pconst.pjsip_TOKEN_SPEC, &pconst.pjsip_ALNUM_SPEC);
  378|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (378:5): [True: 0, False: 0]
  |  Branch (378:5): [True: 0, False: 0]
  ------------------
  379|      1|    pj_cis_add_str( &pconst.pjsip_TOKEN_SPEC, TOKEN);
  ------------------
  |  |   47|      1|#define TOKEN               "-.!%*_`'~+"   /* '=' was removed for parsing 
  ------------------
  380|       |
  381|       |    /* Token is allowed to have '%' so we do not need this. */
  382|       |    /*
  383|       |    status = pj_cis_dup(&pconst.pjsip_TOKEN_SPEC_ESC, &pconst.pjsip_TOKEN_SPEC);
  384|       |    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  385|       |    pj_cis_del_str(&pconst.pjsip_TOKEN_SPEC_ESC, "%");
  386|       |    */
  387|       |
  388|      1|    status = pj_cis_dup(&pconst.pjsip_VIA_PARAM_SPEC, &pconst.pjsip_TOKEN_SPEC);
  389|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (389:5): [True: 0, False: 0]
  |  Branch (389:5): [True: 0, False: 0]
  ------------------
  390|      1|    pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC, "[:]");
  391|       |
  392|       |    /* Token is allowed to have '%' */
  393|       |    /*
  394|       |    status = pj_cis_dup(&pconst.pjsip_VIA_PARAM_SPEC_ESC, &pconst.pjsip_TOKEN_SPEC_ESC);
  395|       |    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  396|       |    pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC_ESC, "[:]");
  397|       |    */
  398|       |
  399|      1|    status = pj_cis_dup(&pconst.pjsip_HOST_SPEC, &pconst.pjsip_ALNUM_SPEC);
  400|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (400:5): [True: 0, False: 0]
  |  Branch (400:5): [True: 0, False: 0]
  ------------------
  401|      1|    pj_cis_add_str( &pconst.pjsip_HOST_SPEC, HOST);
  ------------------
  |  |   49|      1|#define HOST                "_-."
  ------------------
  402|       |
  403|      1|    status = pj_cis_dup(&pconst.pjsip_HEX_SPEC, &pconst.pjsip_DIGIT_SPEC);
  404|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (404:5): [True: 0, False: 0]
  |  Branch (404:5): [True: 0, False: 0]
  ------------------
  405|      1|    pj_cis_add_str( &pconst.pjsip_HEX_SPEC, HEX_DIGIT);
  ------------------
  |  |   50|      1|#define HEX_DIGIT           "abcdefABCDEF"
  ------------------
  406|       |
  407|      1|    status = pj_cis_dup(&pconst.pjsip_PARAM_CHAR_SPEC, &pconst.pjsip_ALNUM_SPEC);
  408|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (408:5): [True: 0, False: 0]
  |  Branch (408:5): [True: 0, False: 0]
  ------------------
  409|      1|    pj_cis_add_str(&pconst.pjsip_PARAM_CHAR_SPEC, PARAM_CHAR);
  ------------------
  |  |   51|      1|#define PARAM_CHAR          "[]/:&+$" UNRESERVED ESCAPED
  |  |  ------------------
  |  |  |  |   44|      1|#define ESCAPED             "%"
  |  |  ------------------
  ------------------
  410|       |
  411|      1|    status = pj_cis_dup(&pconst.pjsip_PARAM_CHAR_SPEC_ESC, &pconst.pjsip_PARAM_CHAR_SPEC);
  412|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (412:5): [True: 0, False: 0]
  |  Branch (412:5): [True: 0, False: 0]
  ------------------
  413|      1|    pj_cis_del_str(&pconst.pjsip_PARAM_CHAR_SPEC_ESC, ESCAPED);
  ------------------
  |  |   44|      1|#define ESCAPED             "%"
  ------------------
  414|       |
  415|      1|    status = pj_cis_dup(&pconst.pjsip_HDR_CHAR_SPEC, &pconst.pjsip_ALNUM_SPEC);
  416|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (416:5): [True: 0, False: 0]
  |  Branch (416:5): [True: 0, False: 0]
  ------------------
  417|      1|    pj_cis_add_str(&pconst.pjsip_HDR_CHAR_SPEC, HDR_CHAR);
  ------------------
  |  |   53|      1|#define HDR_CHAR            HNV_UNRESERVED UNRESERVED ESCAPED
  |  |  ------------------
  |  |  |  |   52|      1|#define HNV_UNRESERVED      "[]/?:+$"
  |  |  ------------------
  |  |               #define HDR_CHAR            HNV_UNRESERVED UNRESERVED ESCAPED
  |  |  ------------------
  |  |  |  |   44|      1|#define ESCAPED             "%"
  |  |  ------------------
  ------------------
  418|       |
  419|      1|    status = pj_cis_dup(&pconst.pjsip_HDR_CHAR_SPEC_ESC, &pconst.pjsip_HDR_CHAR_SPEC);
  420|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (420:5): [True: 0, False: 0]
  |  Branch (420:5): [True: 0, False: 0]
  ------------------
  421|      1|    pj_cis_del_str(&pconst.pjsip_HDR_CHAR_SPEC_ESC, ESCAPED);
  ------------------
  |  |   44|      1|#define ESCAPED             "%"
  ------------------
  422|       |
  423|      1|    status = pj_cis_dup(&pconst.pjsip_USER_SPEC, &pconst.pjsip_ALNUM_SPEC);
  424|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (424:5): [True: 0, False: 0]
  |  Branch (424:5): [True: 0, False: 0]
  ------------------
  425|      1|    pj_cis_add_str( &pconst.pjsip_USER_SPEC, UNRESERVED ESCAPED USER_UNRESERVED );
  ------------------
  |  |   43|      1|#define UNRESERVED          ALNUM MARK
  |  |  ------------------
  |  |  |  |   42|      1|#define MARK                "-_.!~*'()"
  |  |  ------------------
  ------------------
                  pj_cis_add_str( &pconst.pjsip_USER_SPEC, UNRESERVED ESCAPED USER_UNRESERVED );
  ------------------
  |  |   45|      1|#define USER_UNRESERVED     "&=+$,;?/"
  ------------------
  426|       |
  427|      1|    status = pj_cis_dup(&pconst.pjsip_USER_SPEC_ESC, &pconst.pjsip_USER_SPEC);
  428|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (428:5): [True: 0, False: 0]
  |  Branch (428:5): [True: 0, False: 0]
  ------------------
  429|      1|    pj_cis_del_str( &pconst.pjsip_USER_SPEC_ESC, ESCAPED);
  ------------------
  |  |   44|      1|#define ESCAPED             "%"
  ------------------
  430|       |
  431|      1|    status = pj_cis_dup(&pconst.pjsip_USER_SPEC_LENIENT, &pconst.pjsip_USER_SPEC);
  432|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (432:5): [True: 0, False: 0]
  |  Branch (432:5): [True: 0, False: 0]
  ------------------
  433|      1|    pj_cis_add_str(&pconst.pjsip_USER_SPEC_LENIENT, "#");
  434|       |
  435|      1|    status = pj_cis_dup(&pconst.pjsip_USER_SPEC_LENIENT_ESC, &pconst.pjsip_USER_SPEC_ESC);
  436|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (436:5): [True: 0, False: 0]
  |  Branch (436:5): [True: 0, False: 0]
  ------------------
  437|      1|    pj_cis_add_str(&pconst.pjsip_USER_SPEC_LENIENT_ESC, "#");
  438|       |
  439|      1|    status = pj_cis_dup(&pconst.pjsip_PASSWD_SPEC, &pconst.pjsip_ALNUM_SPEC);
  440|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (440:5): [True: 0, False: 0]
  |  Branch (440:5): [True: 0, False: 0]
  ------------------
  441|      1|    pj_cis_add_str( &pconst.pjsip_PASSWD_SPEC, UNRESERVED ESCAPED PASS);
  ------------------
  |  |   43|      1|#define UNRESERVED          ALNUM MARK
  |  |  ------------------
  |  |  |  |   42|      1|#define MARK                "-_.!~*'()"
  |  |  ------------------
  ------------------
                  pj_cis_add_str( &pconst.pjsip_PASSWD_SPEC, UNRESERVED ESCAPED PASS);
  ------------------
  |  |   46|      1|#define PASS                "&=+$,"
  ------------------
  442|       |
  443|      1|    status = pj_cis_dup(&pconst.pjsip_PASSWD_SPEC_ESC, &pconst.pjsip_PASSWD_SPEC);
  444|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (444:5): [True: 0, False: 0]
  |  Branch (444:5): [True: 0, False: 0]
  ------------------
  445|      1|    pj_cis_del_str( &pconst.pjsip_PASSWD_SPEC_ESC, ESCAPED);
  ------------------
  |  |   44|      1|#define ESCAPED             "%"
  ------------------
  446|       |
  447|      1|    status = pj_cis_init(&cis_buf, &pconst.pjsip_PROBE_USER_HOST_SPEC);
  448|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (448:5): [True: 0, False: 0]
  |  Branch (448:5): [True: 0, False: 0]
  ------------------
  449|      1|    pj_cis_add_str( &pconst.pjsip_PROBE_USER_HOST_SPEC, "@ \n>");
  450|      1|    pj_cis_invert( &pconst.pjsip_PROBE_USER_HOST_SPEC );
  451|       |
  452|      1|    status = pj_cis_init(&cis_buf, &pconst.pjsip_DISPLAY_SPEC);
  453|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (453:5): [True: 0, False: 0]
  |  Branch (453:5): [True: 0, False: 0]
  ------------------
  454|      1|    pj_cis_add_str( &pconst.pjsip_DISPLAY_SPEC, ":\r\n<");
  455|      1|    pj_cis_invert(&pconst.pjsip_DISPLAY_SPEC);
  456|       |
  457|      1|    status = pj_cis_dup(&pconst.pjsip_OTHER_URI_CONTENT, &pconst.pjsip_ALNUM_SPEC);
  458|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (458:5): [True: 0, False: 0]
  |  Branch (458:5): [True: 0, False: 0]
  ------------------
  459|      1|    pj_cis_add_str( &pconst.pjsip_OTHER_URI_CONTENT, GENERIC_URI_CHARS);
  ------------------
  |  |   58|      1|#define GENERIC_URI_CHARS   "#?;:@&=+-_.!~*'()%$,/" "%"
  ------------------
  460|       |
  461|       |    /*
  462|       |     * Register URI parsers.
  463|       |     */
  464|       |
  465|      1|    status = pjsip_register_uri_parser("sip", &int_parse_sip_url);
  466|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (466:5): [True: 0, False: 0]
  |  Branch (466:5): [True: 0, False: 0]
  ------------------
  467|       |
  468|      1|    status = pjsip_register_uri_parser("sips", &int_parse_sip_url);
  469|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (469:5): [True: 0, False: 0]
  |  Branch (469:5): [True: 0, False: 0]
  ------------------
  470|       |
  471|       |    /*
  472|       |     * Register header parsers.
  473|       |     */
  474|       |
  475|      1|    status = pjsip_register_hdr_parser( "Accept", NULL, &parse_hdr_accept);
  476|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (476:5): [True: 0, False: 0]
  |  Branch (476:5): [True: 0, False: 0]
  ------------------
  477|       |
  478|      1|    status = pjsip_register_hdr_parser( "Allow", NULL, &parse_hdr_allow);
  479|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (479:5): [True: 0, False: 0]
  |  Branch (479:5): [True: 0, False: 0]
  ------------------
  480|       |
  481|      1|    status = pjsip_register_hdr_parser( "Call-ID", "i", &parse_hdr_call_id);
  482|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (482:5): [True: 0, False: 0]
  |  Branch (482:5): [True: 0, False: 0]
  ------------------
  483|       |
  484|      1|    status = pjsip_register_hdr_parser( "Contact", "m", &parse_hdr_contact);
  485|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (485:5): [True: 0, False: 0]
  |  Branch (485:5): [True: 0, False: 0]
  ------------------
  486|       |
  487|      1|    status = pjsip_register_hdr_parser( "Content-Length", "l", 
  488|      1|                                        &parse_hdr_content_len);
  489|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (489:5): [True: 0, False: 0]
  |  Branch (489:5): [True: 0, False: 0]
  ------------------
  490|       |
  491|      1|    status = pjsip_register_hdr_parser( "Content-Type", "c", 
  492|      1|                                        &parse_hdr_content_type);
  493|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (493:5): [True: 0, False: 0]
  |  Branch (493:5): [True: 0, False: 0]
  ------------------
  494|       |
  495|      1|    status = pjsip_register_hdr_parser( "CSeq", NULL, &parse_hdr_cseq);
  496|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (496:5): [True: 0, False: 0]
  |  Branch (496:5): [True: 0, False: 0]
  ------------------
  497|       |
  498|      1|    status = pjsip_register_hdr_parser( "Expires", NULL, &parse_hdr_expires);
  499|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (499:5): [True: 0, False: 0]
  |  Branch (499:5): [True: 0, False: 0]
  ------------------
  500|       |
  501|      1|    status = pjsip_register_hdr_parser( "From", "f", &parse_hdr_from);
  502|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (502:5): [True: 0, False: 0]
  |  Branch (502:5): [True: 0, False: 0]
  ------------------
  503|       |
  504|      1|    status = pjsip_register_hdr_parser( "Max-Forwards", NULL, 
  505|      1|                                        &parse_hdr_max_forwards);
  506|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (506:5): [True: 0, False: 0]
  |  Branch (506:5): [True: 0, False: 0]
  ------------------
  507|       |
  508|      1|    status = pjsip_register_hdr_parser( "Min-Expires", NULL, 
  509|      1|                                        &parse_hdr_min_expires);
  510|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (510:5): [True: 0, False: 0]
  |  Branch (510:5): [True: 0, False: 0]
  ------------------
  511|       |
  512|      1|    status = pjsip_register_hdr_parser( "Record-Route", NULL, &parse_hdr_rr);
  513|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (513:5): [True: 0, False: 0]
  |  Branch (513:5): [True: 0, False: 0]
  ------------------
  514|       |
  515|      1|    status = pjsip_register_hdr_parser( "Route", NULL, &parse_hdr_route);
  516|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (516:5): [True: 0, False: 0]
  |  Branch (516:5): [True: 0, False: 0]
  ------------------
  517|       |
  518|      1|    status = pjsip_register_hdr_parser( "Require", NULL, &parse_hdr_require);
  519|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (519:5): [True: 0, False: 0]
  |  Branch (519:5): [True: 0, False: 0]
  ------------------
  520|       |
  521|      1|    status = pjsip_register_hdr_parser( "Retry-After", NULL, 
  522|      1|                                        &parse_hdr_retry_after);
  523|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (523:5): [True: 0, False: 0]
  |  Branch (523:5): [True: 0, False: 0]
  ------------------
  524|       |
  525|      1|    status = pjsip_register_hdr_parser( "Supported", "k", 
  526|      1|                                        &parse_hdr_supported);
  527|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (527:5): [True: 0, False: 0]
  |  Branch (527:5): [True: 0, False: 0]
  ------------------
  528|       |
  529|      1|    status = pjsip_register_hdr_parser( "To", "t", &parse_hdr_to);
  530|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (530:5): [True: 0, False: 0]
  |  Branch (530:5): [True: 0, False: 0]
  ------------------
  531|       |
  532|      1|    status = pjsip_register_hdr_parser( "Unsupported", NULL, 
  533|      1|                                        &parse_hdr_unsupported);
  534|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (534:5): [True: 0, False: 0]
  |  Branch (534:5): [True: 0, False: 0]
  ------------------
  535|       |
  536|      1|    status = pjsip_register_hdr_parser( "Via", "v", &parse_hdr_via);
  537|      1|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (537:5): [True: 0, False: 0]
  |  Branch (537:5): [True: 0, False: 0]
  ------------------
  538|       |
  539|       |    /* 
  540|       |     * Register auth parser. 
  541|       |     */
  542|       |
  543|      1|    status = pjsip_auth_init_parser();
  544|       |
  545|      1|    return status;
  546|      1|}
sip_parser.c:int_parse_sip_url:
 1508|  10.7k|{
 1509|  10.7k|    pj_str_t scheme;
 1510|  10.7k|    pjsip_sip_uri *url = NULL;
 1511|  10.7k|    int colon;
 1512|  10.7k|    int skip_ws = scanner->skip_ws;
 1513|  10.7k|    scanner->skip_ws = 0;
 1514|       |
 1515|  10.7k|    pj_scan_get(scanner, &pconst.pjsip_TOKEN_SPEC, &scheme);
 1516|  10.7k|    colon = pj_scan_get_char(scanner);
 1517|  10.7k|    if (colon != ':') {
  ------------------
  |  Branch (1517:9): [True: 0, False: 10.7k]
  ------------------
 1518|      0|        PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|      0|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1519|      0|    }
 1520|       |
 1521|  10.7k|    if (parser_stricmp(scheme, pconst.pjsip_SIP_STR)==0) {
  ------------------
  |  |  207|  10.7k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|  10.5k|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 217, False: 10.5k]
  |  |  |  Branch (207:54): [True: 0, False: 10.5k]
  |  |  ------------------
  ------------------
  |  Branch (1521:9): [True: 10.5k, False: 217]
  ------------------
 1522|  10.5k|        url = pjsip_sip_uri_create(pool, 0);
 1523|       |
 1524|  10.5k|    } else if (parser_stricmp(scheme, pconst.pjsip_SIPS_STR)==0) {
  ------------------
  |  |  207|    217|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    217|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 0, False: 217]
  |  |  |  Branch (207:54): [True: 0, False: 217]
  |  |  ------------------
  ------------------
  |  Branch (1524:16): [True: 217, False: 0]
  ------------------
 1525|    217|        url = pjsip_sip_uri_create(pool, 1);
 1526|       |
 1527|    217|    } else {
 1528|      0|        PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|      0|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1529|       |        /* should not reach here */
 1530|      0|        UNREACHED({
 1531|      0|            pj_assert(0);
 1532|      0|            return 0;
 1533|      0|        })
 1534|      0|    }
 1535|       |
 1536|  10.7k|    if (int_is_next_user(scanner)) {
  ------------------
  |  Branch (1536:9): [True: 2.16k, False: 8.55k]
  ------------------
 1537|       |#if defined (PJSIP_URI_USE_ORIG_USERPASS) && (PJSIP_URI_USE_ORIG_USERPASS)
 1538|       |        char *start = scanner->curptr;
 1539|       |        pj_str_t orig;
 1540|       |#endif
 1541|       |
 1542|  2.16k|        int_parse_user_pass(scanner, pool, &url->user, &url->passwd);
 1543|       |
 1544|       |#if defined (PJSIP_URI_USE_ORIG_USERPASS) && (PJSIP_URI_USE_ORIG_USERPASS)
 1545|       |        pj_strset3(&orig, start, scanner->curptr - 1);
 1546|       |        pj_strdup(pool, &url->orig_userpass, &orig);
 1547|       |#endif
 1548|  2.16k|    }
 1549|       |
 1550|       |    /* Get host:port */
 1551|  10.7k|    int_parse_uri_host_port(scanner, &url->host, &url->port);
 1552|       |
 1553|       |    /* Get URL parameters. */
 1554|  10.7k|    if (parse_params) {
  ------------------
  |  Branch (1554:9): [True: 7.04k, False: 3.67k]
  ------------------
 1555|  15.7k|      while (*scanner->curptr == ';' ) {
  ------------------
  |  Branch (1555:14): [True: 8.69k, False: 7.04k]
  ------------------
 1556|  8.69k|        pj_str_t pname, pvalue;
 1557|       |
 1558|  8.69k|        int_parse_uri_param( scanner, pool, &pname, &pvalue, 0);
 1559|       |
 1560|  8.69k|        if (!parser_stricmp(pname, pconst.pjsip_USER_STR) && pvalue.slen) {
  ------------------
  |  |  207|  17.3k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    656|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 8.03k, False: 656]
  |  |  |  Branch (207:54): [True: 261, False: 395]
  |  |  ------------------
  ------------------
  |  Branch (1560:62): [True: 201, False: 194]
  ------------------
 1561|    201|            url->user_param = pvalue;
 1562|       |
 1563|  8.49k|        } else if (!parser_stricmp(pname, pconst.pjsip_METHOD_STR) && pvalue.slen) {
  ------------------
  |  |  207|  16.9k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    636|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 7.85k, False: 636]
  |  |  |  Branch (207:54): [True: 232, False: 404]
  |  |  ------------------
  ------------------
  |  Branch (1563:71): [True: 210, False: 194]
  ------------------
 1564|    210|            url->method_param = pvalue;
 1565|       |
 1566|  8.28k|        } else if (!parser_stricmp(pname, pconst.pjsip_TRANSPORT_STR) && pvalue.slen) {
  ------------------
  |  |  207|  16.5k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    700|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 7.58k, False: 700]
  |  |  |  Branch (207:54): [True: 308, False: 392]
  |  |  ------------------
  ------------------
  |  Branch (1566:74): [True: 198, False: 194]
  ------------------
 1567|    198|            url->transport_param = pvalue;
 1568|       |
 1569|  8.08k|        } else if (!parser_stricmp(pname, pconst.pjsip_TTL_STR) && pvalue.slen) {
  ------------------
  |  |  207|  16.1k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|  1.18k|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 6.90k, False: 1.18k]
  |  |  |  Branch (207:54): [True: 364, False: 818]
  |  |  ------------------
  ------------------
  |  Branch (1569:68): [True: 615, False: 203]
  ------------------
 1570|    615|            strtoi_validate(&pvalue, PJSIP_MIN_TTL, PJSIP_MAX_TTL,
  ------------------
  |  |   47|    615|#define PJSIP_MIN_TTL               0           /**< For limit checks */
  ------------------
                          strtoi_validate(&pvalue, PJSIP_MIN_TTL, PJSIP_MAX_TTL,
  ------------------
  |  |   48|    615|#define PJSIP_MAX_TTL               PJ_MAXUINT8 /**< For limit checks */
  |  |  ------------------
  |  |  |  |   39|    615|#define PJ_MAXUINT8     0xff
  |  |  ------------------
  ------------------
 1571|    615|                            &url->ttl_param);
 1572|  7.47k|        } else if (!parser_stricmp(pname, pconst.pjsip_MADDR_STR) && pvalue.slen) {
  ------------------
  |  |  207|  14.9k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    703|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 6.76k, False: 703]
  |  |  |  Branch (207:54): [True: 308, False: 395]
  |  |  ------------------
  ------------------
  |  Branch (1572:70): [True: 201, False: 194]
  ------------------
 1573|    201|            url->maddr_param = pvalue;
 1574|       |
 1575|  7.27k|        } else if (!parser_stricmp(pname, pconst.pjsip_LR_STR)) {
  ------------------
  |  |  207|  7.27k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    614|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 6.65k, False: 614]
  |  |  |  Branch (207:54): [True: 419, False: 195]
  |  |  ------------------
  ------------------
 1576|    195|            url->lr_param = 1;
 1577|       |
 1578|  7.07k|        } else {
 1579|  7.07k|            pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  569|  7.07k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1580|  7.07k|            p->name = pname;
 1581|  7.07k|            p->value = pvalue;
 1582|  7.07k|            pj_list_insert_before(&url->other_param, p);
 1583|  7.07k|        }
 1584|  8.69k|      }
 1585|  7.04k|    }
 1586|       |
 1587|       |    /* Get header params. */
 1588|  10.7k|    if (parse_params && *scanner->curptr == '?') {
  ------------------
  |  Branch (1588:9): [True: 6.85k, False: 3.87k]
  |  Branch (1588:25): [True: 448, False: 6.40k]
  ------------------
 1589|  1.51k|      do {
 1590|  1.51k|        pjsip_param *param;
 1591|  1.51k|        param = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  569|  1.51k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1592|  1.51k|        int_parse_hparam(scanner, pool, &param->name, &param->value);
 1593|  1.51k|        pj_list_insert_before(&url->header_param, param);
 1594|  1.51k|      } while (*scanner->curptr == '&');
  ------------------
  |  Branch (1594:16): [True: 1.06k, False: 448]
  ------------------
 1595|    448|    }
 1596|       |
 1597|  10.7k|    scanner->skip_ws = skip_ws;
 1598|  10.7k|    pj_scan_skip_whitespace(scanner);
 1599|  10.7k|    return url;
 1600|  10.7k|}
sip_parser.c:int_is_next_user:
 1377|  10.7k|{
 1378|  10.7k|    pj_str_t dummy;
 1379|  10.7k|    int is_user;
 1380|       |
 1381|       |    /* Find character '@'. If this character exist, then the token
 1382|       |     * must be a username.
 1383|       |     */
 1384|  10.7k|    if (pj_scan_peek( scanner, &pconst.pjsip_PROBE_USER_HOST_SPEC, &dummy) == '@')
  ------------------
  |  Branch (1384:9): [True: 2.16k, False: 8.55k]
  ------------------
 1385|  2.16k|        is_user = 1;
 1386|  8.55k|    else
 1387|  8.55k|        is_user = 0;
 1388|       |
 1389|  10.7k|    return is_user;
 1390|  10.7k|}
sip_parser.c:int_parse_user_pass:
 1395|  2.16k|{
 1396|  2.16k|    parser_get_and_unescape(scanner, pool, &pconst.pjsip_USER_SPEC_LENIENT, 
 1397|  2.16k|                            &pconst.pjsip_USER_SPEC_LENIENT_ESC, user);
 1398|       |
 1399|  2.16k|    if ( *scanner->curptr == ':') {
  ------------------
  |  Branch (1399:10): [True: 324, False: 1.84k]
  ------------------
 1400|    324|        pj_scan_get_char( scanner );
 1401|    324|        parser_get_and_unescape(scanner, pool, &pconst.pjsip_PASSWD_SPEC,
 1402|    324|                                &pconst.pjsip_PASSWD_SPEC_ESC, pass);
 1403|  1.84k|    } else {
 1404|  1.84k|        pass->ptr = NULL;
 1405|  1.84k|        pass->slen = 0;
 1406|  1.84k|    }
 1407|       |
 1408|       |    /* Get the '@' */
 1409|  2.16k|    pj_scan_get_char( scanner );
 1410|  2.16k|}
sip_parser.c:parser_get_and_unescape:
  214|  14.6k|{
  215|       |#if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0
  216|       |    PJ_UNUSED_ARG(pool);
  217|       |    PJ_UNUSED_ARG(spec);
  218|       |    pj_scan_get_unescape(scanner, unesc_spec, token);
  219|       |#else
  220|  14.6k|    PJ_UNUSED_ARG(unesc_spec);
  ------------------
  |  | 1537|  14.6k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  221|  14.6k|    pj_scan_get(scanner, spec, token);
  222|  14.6k|    *token = pj_str_unescape(pool, token);
  223|  14.6k|#endif
  224|  14.6k|}
sip_parser.c:int_parse_uri_host_port:
 1361|  10.5k|{
 1362|  10.5k|    int_parse_host(scanner, host);
 1363|       |
 1364|       |    /* RFC3261 section 19.1.2: host don't need to be unescaped */
 1365|  10.5k|    if (*scanner->curptr == ':') {
  ------------------
  |  Branch (1365:9): [True: 431, False: 10.1k]
  ------------------
 1366|    431|        pj_str_t port;
 1367|    431|        pj_scan_get_char(scanner);
 1368|    431|        pj_scan_get(scanner, &pconst.pjsip_DIGIT_SPEC, &port);
 1369|    431|        strtoi_validate(&port, PJSIP_MIN_PORT, PJSIP_MAX_PORT, p_port);
  ------------------
  |  |   45|    431|#define PJSIP_MIN_PORT              0           /**< For limit checks */
  ------------------
                      strtoi_validate(&port, PJSIP_MIN_PORT, PJSIP_MAX_PORT, p_port);
  ------------------
  |  |   46|    431|#define PJSIP_MAX_PORT              PJ_MAXUINT16/**< For limit checks */
  |  |  ------------------
  |  |  |  |   36|    431|#define PJ_MAXUINT16    0xffff
  |  |  ------------------
  ------------------
 1370|  10.1k|    } else {
 1371|  10.1k|        *p_port = 0;
 1372|  10.1k|    }
 1373|  10.5k|}
sip_parser.c:int_parse_host:
 1344|  12.7k|{
 1345|  12.7k|    if (*scanner->curptr == '[') {
  ------------------
  |  Branch (1345:9): [True: 1.06k, False: 11.6k]
  ------------------
 1346|       |        /* Note: the '[' and ']' characters are removed from the host */
 1347|  1.06k|        pj_scan_get_char(scanner);
 1348|  1.06k|        pj_scan_get_until_ch(scanner, ']', host);
 1349|  1.06k|        pj_scan_get_char(scanner);
 1350|       |        /* Empty IPv6 address (e.g. "sip:[]") is invalid */
 1351|  1.06k|        if (host->slen == 0)
  ------------------
  |  Branch (1351:13): [True: 413, False: 651]
  ------------------
 1352|    413|            on_syntax_error(scanner);
 1353|  11.6k|    } else {
 1354|  11.6k|        pj_scan_get( scanner, &pconst.pjsip_HOST_SPEC, host);
 1355|  11.6k|    }
 1356|  12.7k|}
sip_parser.c:int_parse_uri_param:
 1303|  8.69k|{
 1304|       |    /* Get ';' character */
 1305|  8.69k|    pj_scan_get_char(scanner);
 1306|       |
 1307|       |    /* Get pname and optionally pvalue */
 1308|  8.69k|    pjsip_parse_uri_param_imp(scanner, pool, pname, pvalue, 
 1309|  8.69k|                              option);
 1310|  8.69k|}
sip_parser.c:int_parse_hparam:
 1316|  1.51k|{
 1317|       |    /* Get '?' or '&' character. */
 1318|  1.51k|    pj_scan_get_char(scanner);
 1319|       |
 1320|       |    /* hname */
 1321|  1.51k|    parser_get_and_unescape(scanner, pool, &pconst.pjsip_HDR_CHAR_SPEC, 
 1322|  1.51k|                            &pconst.pjsip_HDR_CHAR_SPEC_ESC, hname);
 1323|       |
 1324|       |    /* Init hvalue */
 1325|  1.51k|    hvalue->ptr = NULL;
 1326|  1.51k|    hvalue->slen = 0;
 1327|       |
 1328|       |    /* pvalue, if any */
 1329|  1.51k|    if (*scanner->curptr == '=') {
  ------------------
  |  Branch (1329:9): [True: 536, False: 975]
  ------------------
 1330|    536|        pj_scan_get_char(scanner);
 1331|    536|        if (!pj_scan_is_eof(scanner) && 
  ------------------
  |  Branch (1331:13): [True: 529, False: 7]
  ------------------
 1332|    529|            pj_cis_match(&pconst.pjsip_HDR_CHAR_SPEC, *scanner->curptr))
  ------------------
  |  Branch (1332:13): [True: 255, False: 274]
  ------------------
 1333|    255|        {
 1334|    255|            parser_get_and_unescape(scanner, pool, &pconst.pjsip_HDR_CHAR_SPEC,
 1335|    255|                                    &pconst.pjsip_HDR_CHAR_SPEC_ESC, hvalue);
 1336|    255|        }
 1337|    536|    }
 1338|  1.51k|}
sip_parser.c:parse_hdr_call_id:
 1889|    664|{
 1890|    664|    pjsip_cid_hdr *hdr = pjsip_cid_hdr_create(ctx->pool);
 1891|    664|    pj_scan_get( ctx->scanner, &pconst.pjsip_NOT_NEWLINE, &hdr->id);
 1892|    664|    parse_hdr_end(ctx->scanner);
 1893|       |
 1894|    664|    if (ctx->rdata)
  ------------------
  |  Branch (1894:9): [True: 0, False: 664]
  ------------------
 1895|      0|        ctx->rdata->msg_info.cid = hdr;
 1896|       |
 1897|    664|    return (pjsip_hdr*)hdr;
 1898|    664|}
sip_parser.c:parse_hdr_contact:
 1958|  6.51k|{
 1959|  6.51k|    pjsip_contact_hdr *first = NULL;
 1960|  6.51k|    pj_scanner *scanner = ctx->scanner;
 1961|       |    
 1962|  8.61k|    do {
 1963|  8.61k|        pjsip_contact_hdr *hdr = pjsip_contact_hdr_create(ctx->pool);
 1964|  8.61k|        if (first == NULL)
  ------------------
  |  Branch (1964:13): [True: 6.51k, False: 2.10k]
  ------------------
 1965|  6.51k|            first = hdr;
 1966|  2.10k|        else
 1967|  2.10k|            pj_list_insert_before(first, hdr);
 1968|       |
 1969|  8.61k|        if (*scanner->curptr == '*') {
  ------------------
  |  Branch (1969:13): [True: 1.50k, False: 7.11k]
  ------------------
 1970|  1.50k|            pj_scan_get_char(scanner);
 1971|  1.50k|            hdr->star = 1;
 1972|       |
 1973|  7.11k|        } else {
 1974|  7.11k|            hdr->star = 0;
 1975|  7.11k|            hdr->uri = int_parse_uri_or_name_addr(scanner, ctx->pool, 
 1976|  7.11k|                                                  PJSIP_PARSE_URI_AS_NAMEADDR |
 1977|  7.11k|                                                  PJSIP_PARSE_URI_IN_FROM_TO_HDR);
 1978|       |
 1979|  7.11k|            int_parse_contact_param(hdr, scanner, ctx->pool);
 1980|  7.11k|        }
 1981|       |
 1982|  8.61k|        if (*scanner->curptr != ',')
  ------------------
  |  Branch (1982:13): [True: 1.80k, False: 6.80k]
  ------------------
 1983|  1.80k|            break;
 1984|       |
 1985|  6.80k|        pj_scan_get_char(scanner);
 1986|       |
 1987|  6.80k|    } while (1);
  ------------------
  |  Branch (1987:14): [True: 2.10k, Folded]
  ------------------
 1988|       |
 1989|  6.51k|    parse_hdr_end(scanner);
 1990|       |
 1991|  6.51k|    return (pjsip_hdr*)first;
 1992|  6.51k|}
sip_parser.c:int_parse_contact_param:
 1904|  4.05k|{
 1905|  9.22k|    while ( *scanner->curptr == ';' ) {
  ------------------
  |  Branch (1905:13): [True: 5.36k, False: 3.86k]
  ------------------
 1906|  5.36k|        pj_str_t pname, pvalue;
 1907|       |
 1908|  5.36k|        int_parse_param( scanner, pool, &pname, &pvalue, 0);
 1909|  5.36k|        if (!parser_stricmp(pname, pconst.pjsip_Q_STR) && pvalue.slen) {
  ------------------
  |  |  207|  10.7k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|  4.19k|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 1.17k, False: 4.19k]
  |  |  |  Branch (207:54): [True: 680, False: 3.51k]
  |  |  ------------------
  ------------------
  |  Branch (1909:59): [True: 3.14k, False: 363]
  ------------------
 1910|  3.14k|            char *dot_pos = (char*) pj_memchr(pvalue.ptr, '.', pvalue.slen);
 1911|  3.14k|            if (!dot_pos) {
  ------------------
  |  Branch (1911:17): [True: 1.70k, False: 1.43k]
  ------------------
 1912|  1.70k|                strtoi_validate(&pvalue, PJSIP_MIN_Q1000, PJSIP_MAX_Q1000,
  ------------------
  |  |   51|  1.70k|#define PJSIP_MIN_Q1000             0           /**< For limit checks */
  ------------------
                              strtoi_validate(&pvalue, PJSIP_MIN_Q1000, PJSIP_MAX_Q1000,
  ------------------
  |  |   52|  1.70k|#define PJSIP_MAX_Q1000             PJ_MAXINT32 / 1000/**< For limit checks */
  |  |  ------------------
  |  |  |  |   30|  1.70k|#define PJ_MAXINT32     0x7fffffff
  |  |  ------------------
  ------------------
 1913|  1.70k|                                &hdr->q1000);
 1914|  1.70k|                hdr->q1000 *= 1000;
 1915|  1.70k|            } else {
 1916|  1.43k|                pj_str_t tmp = pvalue;
 1917|  1.43k|                unsigned long qval_frac;
 1918|       |
 1919|  1.43k|                tmp.slen = dot_pos - pvalue.ptr;
 1920|  1.43k|                strtoi_validate(&tmp, PJSIP_MIN_Q1000, PJSIP_MAX_Q1000,
  ------------------
  |  |   51|  1.43k|#define PJSIP_MIN_Q1000             0           /**< For limit checks */
  ------------------
                              strtoi_validate(&tmp, PJSIP_MIN_Q1000, PJSIP_MAX_Q1000,
  ------------------
  |  |   52|  1.43k|#define PJSIP_MAX_Q1000             PJ_MAXINT32 / 1000/**< For limit checks */
  |  |  ------------------
  |  |  |  |   30|  1.43k|#define PJ_MAXINT32     0x7fffffff
  |  |  ------------------
  ------------------
 1921|  1.43k|                                &hdr->q1000);
 1922|  1.43k|                hdr->q1000 *= 1000;
 1923|       |
 1924|  1.43k|                pvalue.slen = (pvalue.ptr+pvalue.slen) - (dot_pos+1);
 1925|  1.43k|                pvalue.ptr = dot_pos + 1;
 1926|  1.43k|                if (pvalue.slen > 3) {
  ------------------
  |  Branch (1926:21): [True: 247, False: 1.19k]
  ------------------
 1927|    247|                    pvalue.slen = 3;
 1928|    247|                }
 1929|  1.43k|                qval_frac = pj_strtoul_mindigit(&pvalue, 3);
 1930|  1.43k|                if ((unsigned)hdr->q1000 > (PJ_MAXINT32 - qval_frac)) {
  ------------------
  |  |   30|  1.43k|#define PJ_MAXINT32     0x7fffffff
  ------------------
  |  Branch (1930:21): [True: 194, False: 1.24k]
  ------------------
 1931|    194|                    PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|    194|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1932|    194|                }
 1933|  1.24k|                hdr->q1000 += qval_frac;
 1934|  1.24k|            }    
 1935|  3.14k|        } else if (!parser_stricmp(pname, pconst.pjsip_EXPIRES_STR) && 
  ------------------
  |  |  207|  4.43k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    866|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 1.34k, False: 866]
  |  |  |  Branch (207:54): [True: 213, False: 653]
  |  |  ------------------
  ------------------
 1936|    653|                   pvalue.slen) 
  ------------------
  |  Branch (1936:20): [True: 459, False: 194]
  ------------------
 1937|    459|        {
 1938|    459|            hdr->expires = pj_strtoul(&pvalue);
 1939|    459|            if (hdr->expires == PJSIP_EXPIRES_NOT_SPECIFIED)
  ------------------
  |  | 1427|    459|#define PJSIP_EXPIRES_NOT_SPECIFIED     ((pj_uint32_t)0xFFFFFFFFUL)
  ------------------
  |  Branch (1939:17): [True: 194, False: 265]
  ------------------
 1940|    194|                hdr->expires--;
 1941|       |            //if (hdr->expires > PJSIP_MAX_EXPIRES)
 1942|       |            //    hdr->expires = PJSIP_MAX_EXPIRES;
 1943|       |#if PJSIP_MIN_EXPIRES > 0
 1944|       |            if (hdr->expires < PJSIP_MIN_EXPIRES)
 1945|       |                hdr->expires = PJSIP_MIN_EXPIRES;
 1946|       |#endif
 1947|  1.75k|        } else {
 1948|  1.75k|            pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  569|  1.75k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1949|  1.75k|            p->name = pname;
 1950|  1.75k|            p->value = pvalue;
 1951|  1.75k|            pj_list_insert_before(&hdr->other_param, p);
 1952|  1.75k|        }
 1953|  5.36k|    }
 1954|  4.05k|}
sip_parser.c:int_parse_param:
 1291|  8.43k|{
 1292|       |    /* Get ';' character */
 1293|  8.43k|    pj_scan_get_char(scanner);
 1294|       |
 1295|       |    /* Get pname and optionally pvalue */
 1296|  8.43k|    pjsip_parse_param_imp(scanner, pool, pname, pvalue, option);
 1297|  8.43k|}
sip_parser.c:pj_strtoul_mindigit:
  192|  1.24k|{
  193|  1.24k|    unsigned long value;
  194|  1.24k|    unsigned i;
  195|       |
  196|  1.24k|    value = 0;
  197|  3.29k|    for (i=0; i<(unsigned)str->slen; ++i) {
  ------------------
  |  Branch (197:15): [True: 2.05k, False: 1.24k]
  ------------------
  198|  2.05k|        value = value * 10 + (str->ptr[i] - '0');
  199|  2.05k|    }
  200|  2.90k|    for (; i<mindig; ++i) {
  ------------------
  |  Branch (200:12): [True: 1.66k, False: 1.24k]
  ------------------
  201|  1.66k|        value = value * 10;
  202|  1.66k|    }
  203|  1.24k|    return value;
  204|  1.24k|}
sip_parser.c:parse_hdr_content_len:
 1996|    629|{
 1997|    629|    pj_str_t digit;
 1998|    629|    pjsip_clen_hdr *hdr;
 1999|       |
 2000|    629|    hdr = pjsip_clen_hdr_create(ctx->pool);
 2001|    629|    pj_scan_get(ctx->scanner, &pconst.pjsip_DIGIT_SPEC, &digit);
 2002|    629|    strtoi_validate(&digit, PJSIP_MIN_CONTENT_LENGTH,
  ------------------
  |  |   43|    629|#define PJSIP_MIN_CONTENT_LENGTH    0           /**< For limit checks */
  ------------------
 2003|    629|                    PJSIP_MAX_CONTENT_LENGTH, &hdr->len);
  ------------------
  |  |   44|    629|#define PJSIP_MAX_CONTENT_LENGTH    PJ_MAXINT32 /**< For limit checks */
  |  |  ------------------
  |  |  |  |   30|    629|#define PJ_MAXINT32     0x7fffffff
  |  |  ------------------
  ------------------
 2004|    629|    parse_hdr_end(ctx->scanner);
 2005|       |
 2006|    629|    if (ctx->rdata)
  ------------------
  |  Branch (2006:9): [True: 0, False: 629]
  ------------------
 2007|      0|        ctx->rdata->msg_info.clen = hdr;
 2008|       |
 2009|    629|    return (pjsip_hdr*)hdr;
 2010|    629|}
sip_parser.c:parse_hdr_content_type:
 2014|  2.63k|{
 2015|  2.63k|    pjsip_ctype_hdr *hdr;
 2016|  2.63k|    pj_scanner *scanner = ctx->scanner;
 2017|       |
 2018|  2.63k|    hdr = pjsip_ctype_hdr_create(ctx->pool);
 2019|       |    
 2020|       |    /* Parse media type and subtype. */
 2021|  2.63k|    pj_scan_get(scanner, &pconst.pjsip_TOKEN_SPEC, &hdr->media.type);
 2022|  2.63k|    pj_scan_get_char(scanner);
 2023|  2.63k|    pj_scan_get(scanner, &pconst.pjsip_TOKEN_SPEC, &hdr->media.subtype);
 2024|       |
 2025|       |    /* Parse media parameters */
 2026|  3.89k|    while (*scanner->curptr == ';') {
  ------------------
  |  Branch (2026:12): [True: 1.25k, False: 2.63k]
  ------------------
 2027|  1.25k|        pjsip_param *param = PJ_POOL_ALLOC_T(ctx->pool, pjsip_param);
  ------------------
  |  |  569|  1.25k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 2028|  1.25k|        int_parse_param(scanner, ctx->pool, &param->name, &param->value, 0);
 2029|  1.25k|        pj_list_push_back(&hdr->media.param, param);
 2030|  1.25k|    }
 2031|       |
 2032|  2.63k|    parse_hdr_end(ctx->scanner);
 2033|       |
 2034|  2.63k|    if (ctx->rdata)
  ------------------
  |  Branch (2034:9): [True: 0, False: 2.63k]
  ------------------
 2035|      0|        ctx->rdata->msg_info.ctype = hdr;
 2036|       |
 2037|  2.63k|    return (pjsip_hdr*)hdr;
 2038|  2.63k|}
sip_parser.c:parse_hdr_cseq:
 2042|  1.96k|{
 2043|  1.96k|    pj_str_t cseq, method;
 2044|  1.96k|    pjsip_cseq_hdr *hdr = NULL;
 2045|  1.96k|    int cseq_val = 0;
 2046|       |
 2047|  1.96k|    pj_scan_get( ctx->scanner, &pconst.pjsip_DIGIT_SPEC, &cseq);
 2048|  1.96k|    strtoi_validate(&cseq, PJSIP_MIN_CSEQ, PJSIP_MAX_CSEQ, &cseq_val);
  ------------------
  |  |   55|  1.96k|#define PJSIP_MIN_CSEQ              0           /**< For limit checks */
  ------------------
                  strtoi_validate(&cseq, PJSIP_MIN_CSEQ, PJSIP_MAX_CSEQ, &cseq_val);
  ------------------
  |  |   56|  1.96k|#define PJSIP_MAX_CSEQ              PJ_MAXINT32 /**< For limit checks */
  |  |  ------------------
  |  |  |  |   30|  1.96k|#define PJ_MAXINT32     0x7fffffff
  |  |  ------------------
  ------------------
 2049|       |
 2050|  1.96k|    hdr = pjsip_cseq_hdr_create(ctx->pool);
 2051|  1.96k|    hdr->cseq = cseq_val;
 2052|       |
 2053|  1.96k|    pj_scan_get( ctx->scanner, &pconst.pjsip_TOKEN_SPEC, &method);
 2054|  1.96k|    parse_hdr_end( ctx->scanner );
 2055|       |
 2056|  1.96k|    pjsip_method_init_np(&hdr->method, &method);
 2057|  1.96k|    if (ctx->rdata) {
  ------------------
  |  Branch (2057:9): [True: 0, False: 1.96k]
  ------------------
 2058|      0|        ctx->rdata->msg_info.cseq = hdr;
 2059|      0|    }
 2060|       |
 2061|  1.96k|    return (pjsip_hdr*)hdr;
 2062|  1.96k|}
sip_parser.c:parse_hdr_expires:
 2066|    462|{
 2067|    462|    pjsip_expires_hdr *hdr = pjsip_expires_hdr_create(ctx->pool, 0);
 2068|    462|    parse_generic_int_hdr(hdr, ctx->scanner);
 2069|    462|    return (pjsip_hdr*)hdr;
 2070|    462|}
sip_parser.c:parse_generic_int_hdr:
 1863|  1.56k|{
 1864|  1.56k|    pj_str_t tmp;
 1865|  1.56k|    pj_scan_get( scanner, &pconst.pjsip_DIGIT_SPEC, &tmp);
 1866|  1.56k|    hdr->ivalue = pj_strtoul(&tmp);
 1867|  1.56k|    parse_hdr_end(scanner);
 1868|  1.56k|}
sip_parser.c:parse_hdr_from:
 2102|  1.55k|{
 2103|  1.55k|    pjsip_from_hdr *hdr = pjsip_from_hdr_create(ctx->pool);
 2104|  1.55k|    parse_hdr_fromto(ctx->scanner, ctx->pool, hdr);
 2105|  1.55k|    if (ctx->rdata)
  ------------------
  |  Branch (2105:9): [True: 0, False: 1.55k]
  ------------------
 2106|      0|        ctx->rdata->msg_info.from = hdr;
 2107|       |
 2108|  1.55k|    return (pjsip_hdr*)hdr;
 2109|  1.55k|}
sip_parser.c:parse_hdr_fromto:
 2076|  4.28k|{
 2077|  4.28k|    hdr->uri = int_parse_uri_or_name_addr(scanner, pool, 
 2078|  4.28k|                                          PJSIP_PARSE_URI_AS_NAMEADDR |
 2079|  4.28k|                                          PJSIP_PARSE_URI_IN_FROM_TO_HDR);
 2080|       |
 2081|  5.17k|    while ( *scanner->curptr == ';' ) {
  ------------------
  |  Branch (2081:13): [True: 890, False: 4.28k]
  ------------------
 2082|    890|        pj_str_t pname, pvalue;
 2083|       |
 2084|    890|        int_parse_param( scanner, pool, &pname, &pvalue, 0);
 2085|       |
 2086|    890|        if (!parser_stricmp(pname, pconst.pjsip_TAG_STR)) {
  ------------------
  |  |  207|    890|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    391|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 499, False: 391]
  |  |  |  Branch (207:54): [True: 196, False: 195]
  |  |  ------------------
  ------------------
 2087|    195|            hdr->tag = pvalue;
 2088|       |            
 2089|    695|        } else {
 2090|    695|            pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  569|    695|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 2091|    695|            p->name = pname;
 2092|    695|            p->value = pvalue;
 2093|    695|            pj_list_insert_before(&hdr->other_param, p);
 2094|    695|        }
 2095|    890|    }
 2096|       |
 2097|  4.28k|    parse_hdr_end(scanner);
 2098|  4.28k|}
sip_parser.c:parse_hdr_max_forwards:
 2260|    633|{
 2261|    633|    pjsip_max_fwd_hdr *hdr;
 2262|    633|    hdr = pjsip_max_fwd_hdr_create(ctx->pool, 0);
 2263|    633|    parse_generic_int_hdr(hdr, ctx->scanner);
 2264|       |
 2265|    633|    if (ctx->rdata)
  ------------------
  |  Branch (2265:9): [True: 0, False: 633]
  ------------------
 2266|      0|        ctx->rdata->msg_info.max_fwd = hdr;
 2267|       |
 2268|    633|    return (pjsip_hdr*)hdr;
 2269|    633|}
sip_parser.c:parse_hdr_min_expires:
 2273|    465|{
 2274|    465|    pjsip_min_expires_hdr *hdr;
 2275|    465|    hdr = pjsip_min_expires_hdr_create(ctx->pool, 0);
 2276|    465|    parse_generic_int_hdr(hdr, ctx->scanner);
 2277|    465|    return (pjsip_hdr*)hdr;
 2278|    465|}
sip_parser.c:parse_hdr_rr:
 2298|    698|{
 2299|    698|    pjsip_rr_hdr *first = NULL;
 2300|    698|    pj_scanner *scanner = ctx->scanner;
 2301|       |
 2302|  1.43k|    do {
 2303|  1.43k|        pjsip_rr_hdr *hdr = pjsip_rr_hdr_create(ctx->pool);
 2304|  1.43k|        if (!first) {
  ------------------
  |  Branch (2304:13): [True: 698, False: 739]
  ------------------
 2305|    698|            first = hdr;
 2306|    739|        } else {
 2307|    739|            pj_list_insert_before(first, hdr);
 2308|    739|        }
 2309|  1.43k|        parse_hdr_rr_route(scanner, ctx->pool, hdr);
 2310|  1.43k|        if (*scanner->curptr == ',') {
  ------------------
  |  Branch (2310:13): [True: 739, False: 698]
  ------------------
 2311|    739|            pj_scan_get_char(scanner);
 2312|    739|        } else {
 2313|    698|            break;
 2314|    698|        }
 2315|  1.43k|    } while (1);
  ------------------
  |  Branch (2315:14): [True: 739, Folded]
  ------------------
 2316|    698|    parse_hdr_end(scanner);
 2317|       |
 2318|    698|    if (ctx->rdata && ctx->rdata->msg_info.record_route==NULL)
  ------------------
  |  Branch (2318:9): [True: 0, False: 698]
  |  Branch (2318:23): [True: 0, False: 0]
  ------------------
 2319|      0|        ctx->rdata->msg_info.record_route = first;
 2320|       |
 2321|    698|    return (pjsip_hdr*)first;
 2322|    698|}
sip_parser.c:parse_hdr_rr_route:
 2284|  6.70k|{
 2285|  6.70k|    pjsip_name_addr *temp=int_parse_name_addr(scanner, pool);
 2286|       |
 2287|  6.70k|    pj_memcpy(&hdr->name_addr, temp, sizeof(*temp));
 2288|       |
 2289|  7.62k|    while (*scanner->curptr == ';') {
  ------------------
  |  Branch (2289:12): [True: 925, False: 6.70k]
  ------------------
 2290|    925|        pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  569|    925|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 2291|    925|        int_parse_param(scanner, pool, &p->name, &p->value, 0);
 2292|    925|        pj_list_insert_before(&hdr->other_param, p);
 2293|    925|    }
 2294|  6.70k|}
sip_parser.c:int_parse_name_addr:
 1605|  16.4k|{
 1606|  16.4k|    int has_bracket;
 1607|  16.4k|    pjsip_name_addr *name_addr;
 1608|       |
 1609|  16.4k|    name_addr = pjsip_name_addr_create(pool);
 1610|       |
 1611|  16.4k|    if (*scanner->curptr == '"') {
  ------------------
  |  Branch (1611:9): [True: 920, False: 15.5k]
  ------------------
 1612|    920|        pj_scan_get_quote( scanner, '"', '"', &name_addr->display);
 1613|       |        /* Trim the leading and ending quote */
 1614|    920|        name_addr->display.ptr++;
 1615|    920|        name_addr->display.slen -= 2;
 1616|       |
 1617|  15.5k|    } else if (*scanner->curptr != '<') {
  ------------------
  |  Branch (1617:16): [True: 11.0k, False: 4.54k]
  ------------------
 1618|  11.0k|        int next;
 1619|  11.0k|        pj_str_t dummy;
 1620|       |
 1621|       |        /* This can be either the start of display name,
 1622|       |         * the start of URL ("sip:", "sips:", "tel:", etc.), or '<' char.
 1623|       |         * We're only interested in display name, because SIP URL
 1624|       |         * will be parser later.
 1625|       |         */
 1626|  11.0k|        next = pj_scan_peek(scanner, &pconst.pjsip_DISPLAY_SPEC, &dummy);
 1627|  11.0k|        if (next == '<') {
  ------------------
  |  Branch (1627:13): [True: 892, False: 10.1k]
  ------------------
 1628|       |            /* Ok, this is what we're looking for, a display name. */
 1629|    892|            pj_scan_get_until_ch( scanner, '<', &name_addr->display);
 1630|    892|            pj_strtrim(&name_addr->display);
 1631|    892|        }
 1632|  11.0k|    }
 1633|       |
 1634|       |    /* Manually skip whitespace. */
 1635|  16.4k|    pj_scan_skip_whitespace(scanner);
 1636|       |
 1637|       |    /* Get the SIP-URL */
 1638|  16.4k|    has_bracket = (*scanner->curptr == '<');
 1639|  16.4k|    if (has_bracket) {
  ------------------
  |  Branch (1639:9): [True: 5.43k, False: 11.0k]
  ------------------
 1640|  5.43k|        pj_scan_get_char(scanner);
 1641|  11.0k|    } else if (name_addr->display.slen) {
  ------------------
  |  Branch (1641:16): [True: 251, False: 10.7k]
  ------------------
 1642|       |        /* Must have bracket now (2012-10-26).
 1643|       |         * Allowing (invalid) name-addr to pass URI verification will
 1644|       |         * cause us to send invalid URI to the wire.
 1645|       |         */
 1646|    251|        PJ_THROW( PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|    251|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1647|    251|    }
 1648|  16.2k|    name_addr->uri = int_parse_uri( scanner, pool, PJ_TRUE );
 1649|  16.2k|    if (has_bracket) {
  ------------------
  |  Branch (1649:9): [True: 4.44k, False: 11.7k]
  ------------------
 1650|  4.44k|        if (pj_scan_get_char(scanner) != '>')
  ------------------
  |  Branch (1650:13): [True: 721, False: 3.72k]
  ------------------
 1651|    721|            PJ_THROW( PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|    721|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1652|  4.44k|    }
 1653|       |
 1654|  15.5k|    return name_addr;
 1655|  16.2k|}
sip_parser.c:int_parse_uri:
 1468|  17.6k|{
 1469|       |    /* Bug:
 1470|       |     * This function should not call back int_parse_name_addr() because
 1471|       |     * it is called by that function. This would cause stack overflow
 1472|       |     * with PROTOS test #1223.
 1473|       |    if (*scanner->curptr=='"' || *scanner->curptr=='<') {
 1474|       |        return (pjsip_uri*)int_parse_name_addr( scanner, pool );
 1475|       |    } else {
 1476|       |    */
 1477|  17.6k|        pj_str_t scheme;
 1478|  17.6k|        int colon;
 1479|  17.6k|        pjsip_parse_uri_func *func;
 1480|       |
 1481|       |        /* Get scheme. */
 1482|  17.6k|        colon = pj_scan_peek(scanner, &pconst.pjsip_TOKEN_SPEC, &scheme);
 1483|  17.6k|        if (colon != ':') {
  ------------------
  |  Branch (1483:13): [True: 6.09k, False: 11.5k]
  ------------------
 1484|  6.09k|            PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|  6.09k|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1485|  6.09k|        }
 1486|       |
 1487|  11.5k|        func = find_uri_handler(&scheme);
 1488|  11.5k|        if (func)  {
  ------------------
  |  Branch (1488:13): [True: 11.4k, False: 78]
  ------------------
 1489|  11.4k|            return (pjsip_uri*)(*func)(scanner, pool, parse_params);
 1490|       |
 1491|  11.4k|        } else {
 1492|       |            /* Unsupported URI scheme */
 1493|     78|            PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|     78|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1494|     78|            UNREACHED({ return NULL; /* Not reached. */ })
 1495|     78|        }
 1496|       |
 1497|       |    /*
 1498|       |    }
 1499|       |    */
 1500|  11.5k|}
sip_parser.c:find_uri_handler:
  771|  20.9k|{
  772|  20.9k|    unsigned i;
  773|  49.9k|    for (i=0; i<uri_handler_count; ++i) {
  ------------------
  |  Branch (773:15): [True: 41.5k, False: 8.43k]
  ------------------
  774|  41.5k|        if (parser_stricmp(uri_handler[i].scheme, (*scheme))==0)
  ------------------
  |  |  207|  41.5k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|  14.5k|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 26.9k, False: 14.5k]
  |  |  |  Branch (207:54): [True: 2.11k, False: 12.4k]
  |  |  ------------------
  ------------------
  |  Branch (774:13): [True: 12.4k, False: 29.0k]
  ------------------
  775|  12.4k|            return uri_handler[i].parse;
  776|  41.5k|    }
  777|  8.43k|    return &int_parse_other_uri;
  778|  20.9k|}
sip_parser.c:int_parse_other_uri:
 1662|  8.43k|{
 1663|  8.43k|    pjsip_other_uri *uri = 0;
 1664|  8.43k|    const pjsip_parser_const_t *pc = pjsip_parser_const();
 1665|  8.43k|    int skip_ws = scanner->skip_ws;
 1666|       |
 1667|  8.43k|    PJ_UNUSED_ARG(parse_params);
  ------------------
  |  | 1537|  8.43k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1668|       |
 1669|  8.43k|    scanner->skip_ws = 0;
 1670|       |    
 1671|  8.43k|    uri = pjsip_other_uri_create(pool); 
 1672|       |    
 1673|  8.43k|    pj_scan_get(scanner, &pc->pjsip_TOKEN_SPEC, &uri->scheme);
 1674|  8.43k|    if (pj_scan_get_char(scanner) != ':') {
  ------------------
  |  Branch (1674:9): [True: 497, False: 7.93k]
  ------------------
 1675|    497|        PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|    497|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1676|    497|    }
 1677|       |    
 1678|  7.93k|    pj_scan_get(scanner, &pc->pjsip_OTHER_URI_CONTENT, &uri->content);
 1679|  7.93k|    scanner->skip_ws = skip_ws;
 1680|       |    
 1681|  7.93k|    return uri;
 1682|  8.43k|}
sip_parser.c:parse_hdr_route:
 2326|  1.22k|{
 2327|  1.22k|    pjsip_route_hdr *first = NULL;
 2328|  1.22k|    pj_scanner *scanner = ctx->scanner;
 2329|       |
 2330|  5.26k|    do {
 2331|  5.26k|        pjsip_route_hdr *hdr = pjsip_route_hdr_create(ctx->pool);
 2332|  5.26k|        if (!first) {
  ------------------
  |  Branch (2332:13): [True: 1.22k, False: 4.04k]
  ------------------
 2333|  1.22k|            first = hdr;
 2334|  4.04k|        } else {
 2335|  4.04k|            pj_list_insert_before(first, hdr);
 2336|  4.04k|        }
 2337|  5.26k|        parse_hdr_rr_route(scanner, ctx->pool, hdr);
 2338|  5.26k|        if (*scanner->curptr == ',') {
  ------------------
  |  Branch (2338:13): [True: 4.04k, False: 1.22k]
  ------------------
 2339|  4.04k|            pj_scan_get_char(scanner);
 2340|  4.04k|        } else {
 2341|  1.22k|            break;
 2342|  1.22k|        }
 2343|  5.26k|    } while (1);
  ------------------
  |  Branch (2343:14): [True: 4.04k, Folded]
  ------------------
 2344|  1.22k|    parse_hdr_end(scanner);
 2345|       |
 2346|  1.22k|    if (ctx->rdata && ctx->rdata->msg_info.route==NULL)
  ------------------
  |  Branch (2346:9): [True: 0, False: 1.22k]
  |  Branch (2346:23): [True: 0, False: 0]
  ------------------
 2347|      0|        ctx->rdata->msg_info.route = first;
 2348|       |
 2349|  1.22k|    return (pjsip_hdr*)first;
 2350|  1.22k|}
sip_parser.c:parse_hdr_require:
 2113|    195|{
 2114|    195|    pjsip_require_hdr *hdr;
 2115|    195|    pj_bool_t new_hdr = (ctx->rdata==NULL ||
  ------------------
  |  Branch (2115:26): [True: 195, False: 0]
  ------------------
 2116|      0|                         ctx->rdata->msg_info.require == NULL);
  ------------------
  |  Branch (2116:26): [True: 0, False: 0]
  ------------------
 2117|       |    
 2118|    195|    if (ctx->rdata && ctx->rdata->msg_info.require) {
  ------------------
  |  Branch (2118:9): [True: 0, False: 195]
  |  Branch (2118:23): [True: 0, False: 0]
  ------------------
 2119|      0|        hdr = ctx->rdata->msg_info.require;
 2120|    195|    } else {
 2121|    195|        hdr = pjsip_require_hdr_create(ctx->pool);
 2122|    195|        if (ctx->rdata)
  ------------------
  |  Branch (2122:13): [True: 0, False: 195]
  ------------------
 2123|      0|            ctx->rdata->msg_info.require = hdr;
 2124|    195|    }
 2125|       |
 2126|    195|    parse_generic_array_hdr(hdr, ctx->scanner);
 2127|       |
 2128|    195|    return new_hdr ? (pjsip_hdr*)hdr : NULL;
  ------------------
  |  Branch (2128:12): [True: 195, False: 0]
  ------------------
 2129|    195|}
sip_parser.c:parse_hdr_supported:
 2167|  4.43k|{
 2168|  4.43k|    pjsip_supported_hdr *hdr;
 2169|  4.43k|    pj_bool_t new_hdr = (ctx->rdata==NULL || 
  ------------------
  |  Branch (2169:26): [True: 4.43k, False: 0]
  ------------------
 2170|      0|                         ctx->rdata->msg_info.supported == NULL);
  ------------------
  |  Branch (2170:26): [True: 0, False: 0]
  ------------------
 2171|       |
 2172|  4.43k|    if (ctx->rdata && ctx->rdata->msg_info.supported) {
  ------------------
  |  Branch (2172:9): [True: 0, False: 4.43k]
  |  Branch (2172:23): [True: 0, False: 0]
  ------------------
 2173|      0|        hdr = ctx->rdata->msg_info.supported;
 2174|  4.43k|    } else {
 2175|  4.43k|        hdr = pjsip_supported_hdr_create(ctx->pool);
 2176|  4.43k|        if (ctx->rdata)
  ------------------
  |  Branch (2176:13): [True: 0, False: 4.43k]
  ------------------
 2177|      0|            ctx->rdata->msg_info.supported = hdr;
 2178|  4.43k|    }
 2179|       |
 2180|  4.43k|    parse_generic_array_hdr(hdr, ctx->scanner);
 2181|  4.43k|    return new_hdr ? (pjsip_hdr*)hdr : NULL;
  ------------------
  |  Branch (2181:12): [True: 4.30k, False: 126]
  ------------------
 2182|  4.43k|}
sip_parser.c:parse_hdr_to:
 2186|  2.72k|{
 2187|  2.72k|    pjsip_to_hdr *hdr = pjsip_to_hdr_create(ctx->pool);
 2188|  2.72k|    parse_hdr_fromto(ctx->scanner, ctx->pool, hdr);
 2189|       |
 2190|  2.72k|    if (ctx->rdata)
  ------------------
  |  Branch (2190:9): [True: 0, False: 2.72k]
  ------------------
 2191|      0|        ctx->rdata->msg_info.to = hdr;
 2192|       |
 2193|  2.72k|    return (pjsip_hdr*)hdr;
 2194|  2.72k|}
sip_parser.c:parse_hdr_unsupported:
 2198|    195|{
 2199|    195|    pjsip_unsupported_hdr *hdr = pjsip_unsupported_hdr_create(ctx->pool);
 2200|    195|    parse_generic_array_hdr(hdr, ctx->scanner);
 2201|    195|    return (pjsip_hdr*)hdr;
 2202|    195|}
sip_parser.c:parse_hdr_via:
 2354|  4.23k|{
 2355|  4.23k|    pjsip_via_hdr *first = NULL;
 2356|  4.23k|    pj_scanner *scanner = ctx->scanner;
 2357|       |
 2358|  4.95k|    do {
 2359|  4.95k|        pjsip_via_hdr *hdr = pjsip_via_hdr_create(ctx->pool);
 2360|  4.95k|        if (!first)
  ------------------
  |  Branch (2360:13): [True: 4.23k, False: 721]
  ------------------
 2361|  4.23k|            first = hdr;
 2362|    721|        else
 2363|    721|            pj_list_insert_before(first, hdr);
 2364|       |
 2365|  4.95k|        parse_sip_version(scanner);
 2366|  4.95k|        if (pj_scan_get_char(scanner) != '/')
  ------------------
  |  Branch (2366:13): [True: 398, False: 4.55k]
  ------------------
 2367|    398|            on_syntax_error(scanner);
 2368|       |
 2369|  4.95k|        pj_scan_get( scanner, &pconst.pjsip_TOKEN_SPEC, &hdr->transport);
 2370|  4.95k|        int_parse_host(scanner, &hdr->sent_by.host);
 2371|       |
 2372|  4.95k|        if (*scanner->curptr==':') {
  ------------------
  |  Branch (2372:13): [True: 205, False: 4.75k]
  ------------------
 2373|    205|            pj_str_t digit;
 2374|    205|            pj_scan_get_char(scanner);
 2375|    205|            pj_scan_get(scanner, &pconst.pjsip_DIGIT_SPEC, &digit);
 2376|    205|            strtoi_validate(&digit, PJSIP_MIN_PORT, PJSIP_MAX_PORT,
  ------------------
  |  |   45|    205|#define PJSIP_MIN_PORT              0           /**< For limit checks */
  ------------------
                          strtoi_validate(&digit, PJSIP_MIN_PORT, PJSIP_MAX_PORT,
  ------------------
  |  |   46|    205|#define PJSIP_MAX_PORT              PJ_MAXUINT16/**< For limit checks */
  |  |  ------------------
  |  |  |  |   36|    205|#define PJ_MAXUINT16    0xffff
  |  |  ------------------
  ------------------
 2377|    205|                            &hdr->sent_by.port);
 2378|    205|        }
 2379|       |        
 2380|  4.95k|        int_parse_via_param(hdr, scanner, ctx->pool);
 2381|       |
 2382|  4.95k|        if (*scanner->curptr == '(') {
  ------------------
  |  Branch (2382:13): [True: 300, False: 4.65k]
  ------------------
 2383|    300|            pj_scan_get_char(scanner);
 2384|    300|            pj_scan_get_until_ch( scanner, ')', &hdr->comment);
 2385|    300|            pj_scan_get_char( scanner );
 2386|    300|        }
 2387|       |
 2388|  4.95k|        if (*scanner->curptr != ',')
  ------------------
  |  Branch (2388:13): [True: 1.01k, False: 3.93k]
  ------------------
 2389|  1.01k|            break;
 2390|       |
 2391|  3.93k|        pj_scan_get_char(scanner);
 2392|       |
 2393|  3.93k|    } while (1);
  ------------------
  |  Branch (2393:14): [True: 721, Folded]
  ------------------
 2394|       |
 2395|  4.23k|    parse_hdr_end(scanner);
 2396|       |
 2397|  4.23k|    if (ctx->rdata && ctx->rdata->msg_info.via == NULL)
  ------------------
  |  Branch (2397:9): [True: 0, False: 4.23k]
  |  Branch (2397:23): [True: 0, False: 0]
  ------------------
 2398|      0|        ctx->rdata->msg_info.via = first;
 2399|       |
 2400|  4.23k|    return (pjsip_hdr*)first;
 2401|  4.23k|}
sip_parser.c:parse_sip_version:
  990|  9.36k|{
  991|  9.36k|    pj_str_t SIP = { "SIP", 3 };
  992|  9.36k|    pj_str_t V2 = { "2.0", 3 };
  993|  9.36k|    pj_str_t sip, version;
  994|       |
  995|  9.36k|    pj_scan_get( scanner, &pconst.pjsip_ALPHA_SPEC, &sip);
  996|  9.36k|    if (pj_scan_get_char(scanner) != '/')
  ------------------
  |  Branch (996:9): [True: 277, False: 9.09k]
  ------------------
  997|    277|        on_syntax_error(scanner);
  998|  9.36k|    pj_scan_get_n( scanner, 3, &version);
  999|  9.36k|    if (pj_stricmp(&sip, &SIP) || pj_stricmp(&version, &V2))
  ------------------
  |  Branch (999:9): [True: 2.22k, False: 7.14k]
  |  Branch (999:35): [True: 268, False: 6.87k]
  ------------------
 1000|  1.34k|        on_syntax_error(scanner);
 1001|  9.36k|}
sip_parser.c:int_parse_via_param:
 2207|  1.76k|{
 2208|  5.72k|    while ( *scanner->curptr == ';' ) {
  ------------------
  |  Branch (2208:13): [True: 3.95k, False: 1.76k]
  ------------------
 2209|  3.95k|        pj_str_t pname, pvalue;
 2210|       |
 2211|       |        //Parse with PARAM_CHAR instead, to allow IPv6
 2212|       |        //No, back to using int_parse_param() for the "`" character!
 2213|       |        //int_parse_param( scanner, pool, &pname, &pvalue, 0);
 2214|       |        //parse_param_imp(scanner, pool, &pname, &pvalue, 
 2215|       |        //              &pconst.pjsip_TOKEN_SPEC,
 2216|       |        //              &pconst.pjsip_TOKEN_SPEC_ESC, 0);
 2217|       |        //int_parse_param(scanner, pool, &pname, &pvalue, 0);
 2218|       |        // This should be the correct one:
 2219|       |        //  added special spec for Via parameter, basically token plus
 2220|       |        //  ":" to allow IPv6 address in the received param.
 2221|  3.95k|        pj_scan_get_char(scanner);
 2222|  3.95k|        parse_param_imp(scanner, pool, &pname, &pvalue,
 2223|  3.95k|                        &pconst.pjsip_VIA_PARAM_SPEC,
 2224|       |                        // Token does not need to be unescaped.
 2225|       |                        // Refer to PR #2933.
 2226|       |                        // &pconst.pjsip_VIA_PARAM_SPEC_ESC,
 2227|  3.95k|                        NULL,
 2228|  3.95k|                        0);
 2229|       |
 2230|  3.95k|        if (!parser_stricmp(pname, pconst.pjsip_BRANCH_STR) && pvalue.slen) {
  ------------------
  |  |  207|  7.91k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    603|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 3.35k, False: 603]
  |  |  |  Branch (207:54): [True: 208, False: 395]
  |  |  ------------------
  ------------------
  |  Branch (2230:64): [True: 200, False: 195]
  ------------------
 2231|    200|            hdr->branch_param = pvalue;
 2232|       |
 2233|  3.75k|        } else if (!parser_stricmp(pname, pconst.pjsip_TTL_STR) && pvalue.slen) {
  ------------------
  |  |  207|  7.51k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    685|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 3.07k, False: 685]
  |  |  |  Branch (207:54): [True: 241, False: 444]
  |  |  ------------------
  ------------------
  |  Branch (2233:68): [True: 247, False: 197]
  ------------------
 2234|    247|            strtoi_validate(&pvalue, PJSIP_MIN_TTL, PJSIP_MAX_TTL,
  ------------------
  |  |   47|    247|#define PJSIP_MIN_TTL               0           /**< For limit checks */
  ------------------
                          strtoi_validate(&pvalue, PJSIP_MIN_TTL, PJSIP_MAX_TTL,
  ------------------
  |  |   48|    247|#define PJSIP_MAX_TTL               PJ_MAXUINT8 /**< For limit checks */
  |  |  ------------------
  |  |  |  |   39|    247|#define PJ_MAXUINT8     0xff
  |  |  ------------------
  ------------------
 2235|    247|                            &hdr->ttl_param);
 2236|       |            
 2237|  3.51k|        } else if (!parser_stricmp(pname, pconst.pjsip_MADDR_STR) && pvalue.slen) {
  ------------------
  |  |  207|  7.02k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    829|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 2.68k, False: 829]
  |  |  |  Branch (207:54): [True: 431, False: 398]
  |  |  ------------------
  ------------------
  |  Branch (2237:70): [True: 204, False: 194]
  ------------------
 2238|    204|            hdr->maddr_param = pvalue;
 2239|       |
 2240|  3.30k|        } else if (!parser_stricmp(pname, pconst.pjsip_RECEIVED_STR) && pvalue.slen) {
  ------------------
  |  |  207|  6.61k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    605|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 2.70k, False: 605]
  |  |  |  Branch (207:54): [True: 204, False: 401]
  |  |  ------------------
  ------------------
  |  Branch (2240:73): [True: 207, False: 194]
  ------------------
 2241|    207|            hdr->recvd_param = pvalue;
 2242|       |
 2243|  3.09k|        } else if (!parser_stricmp(pname, pconst.pjsip_RPORT_STR)) {
  ------------------
  |  |  207|  3.09k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    625|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 2.47k, False: 625]
  |  |  |  Branch (207:54): [True: 221, False: 404]
  |  |  ------------------
  ------------------
 2244|    404|            if (pvalue.slen) {
  ------------------
  |  Branch (2244:17): [True: 206, False: 198]
  ------------------
 2245|    206|                strtoi_validate(&pvalue, PJSIP_MIN_PORT, PJSIP_MAX_PORT,
  ------------------
  |  |   45|    206|#define PJSIP_MIN_PORT              0           /**< For limit checks */
  ------------------
                              strtoi_validate(&pvalue, PJSIP_MIN_PORT, PJSIP_MAX_PORT,
  ------------------
  |  |   46|    206|#define PJSIP_MAX_PORT              PJ_MAXUINT16/**< For limit checks */
  |  |  ------------------
  |  |  |  |   36|    206|#define PJ_MAXUINT16    0xffff
  |  |  ------------------
  ------------------
 2246|    206|                                &hdr->rport_param);
 2247|    206|            } else
 2248|    198|                hdr->rport_param = 0;
 2249|  2.69k|        } else {
 2250|  2.69k|            pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  569|  2.69k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 2251|  2.69k|            p->name = pname;
 2252|  2.69k|            p->value = pvalue;
 2253|  2.69k|            pj_list_insert_before(&hdr->other_param, p);
 2254|  2.69k|        }
 2255|  3.95k|    }
 2256|  1.76k|}
sip_parser.c:int_register_parser:
  610|     54|{
  611|     54|    unsigned    pos;
  612|     54|    handler_rec rec;
  613|       |
  614|     54|    if (handler_count >= PJ_ARRAY_SIZE(handler)) {
  ------------------
  |  |  315|     54|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (614:9): [True: 0, False: 54]
  ------------------
  615|      0|        pj_assert(!"Too many handlers!");
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (615:9): [Folded, False: 0]
  |  Branch (615:9): [Folded, False: 0]
  ------------------
  616|      0|        return PJ_ETOOMANY;
  ------------------
  |  |  423|      0|#define PJ_ETOOMANY         (PJ_ERRNO_START_STATUS + 10)/* 70010 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  617|      0|    }
  618|       |
  619|       |    /* Initialize temporary handler. */
  620|     54|    rec.handler = fptr;
  621|     54|    rec.hname_len = strlen(name);
  622|     54|    if (rec.hname_len >= sizeof(rec.hname)) {
  ------------------
  |  Branch (622:9): [True: 0, False: 54]
  ------------------
  623|      0|        pj_assert(!"Header name is too long!");
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (623:9): [Folded, False: 0]
  |  Branch (623:9): [Folded, False: 0]
  ------------------
  624|      0|        return PJ_ENAMETOOLONG;
  ------------------
  |  |  398|      0|#define PJ_ENAMETOOLONG     (PJ_ERRNO_START_STATUS + 5) /* 70005 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  625|      0|    }
  626|       |    /* Copy name. */
  627|     54|    pj_memcpy(rec.hname, name, rec.hname_len);
  628|     54|    rec.hname[rec.hname_len] = '\0';
  629|       |
  630|       |    /* Calculate hash value. */
  631|     54|    rec.hname_hash = pj_hash_calc(0, rec.hname, (unsigned)rec.hname_len);
  632|       |
  633|       |    /* Get the pos to insert the new handler. */
  634|    773|    for (pos=0; pos < handler_count; ++pos) {
  ------------------
  |  Branch (634:17): [True: 770, False: 3]
  ------------------
  635|    770|        int d;
  636|    770|        d = compare_handler(&handler[pos], rec.hname, rec.hname_len, 
  637|    770|                            rec.hname_hash);
  638|    770|        if (d == 0) {
  ------------------
  |  Branch (638:13): [True: 0, False: 770]
  ------------------
  639|      0|            pj_assert(0);
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (639:13): [Folded, False: 0]
  |  Branch (639:13): [Folded, False: 0]
  ------------------
  640|      0|            return PJ_EEXISTS;
  ------------------
  |  |  448|      0|#define PJ_EEXISTS          (PJ_ERRNO_START_STATUS + 15)/* 70015 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  641|      0|        }
  642|    770|        if (d > 0) {
  ------------------
  |  Branch (642:13): [True: 51, False: 719]
  ------------------
  643|     51|            break;
  644|     51|        }
  645|    770|    }
  646|       |
  647|       |    /* Shift handlers. */
  648|     54|    if (pos != handler_count) {
  ------------------
  |  Branch (648:9): [True: 51, False: 3]
  ------------------
  649|     51|        pj_memmove( &handler[pos+1], &handler[pos], 
  650|     51|                    (handler_count-pos)*sizeof(handler_rec));
  651|     51|    }
  652|       |    /* Add new handler. */
  653|     54|    pj_memcpy( &handler[pos], &rec, sizeof(handler_rec));
  654|     54|    ++handler_count;
  655|       |
  656|     54|    return PJ_SUCCESS;
  657|     54|}
sip_parser.c:compare_handler:
  588|   307k|{
  589|   307k|    PJ_UNUSED_ARG(name_len);
  ------------------
  |  | 1537|   307k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  590|       |
  591|       |    /* Compare hashed value. */
  592|   307k|    if (r1->hname_hash < hash)
  ------------------
  |  Branch (592:9): [True: 54.5k, False: 252k]
  ------------------
  593|  54.5k|        return -1;
  594|   252k|    if (r1->hname_hash > hash)
  ------------------
  |  Branch (594:9): [True: 216k, False: 36.3k]
  ------------------
  595|   216k|        return 1;
  596|       |
  597|       |    /* Compare length. */
  598|  36.3k|    if (r1->hname_len < name_len)
  ------------------
  |  Branch (598:9): [True: 398, False: 35.9k]
  ------------------
  599|    398|        return -1;
  600|  35.9k|    if (r1->hname_len > name_len)
  ------------------
  |  Branch (600:9): [True: 388, False: 35.5k]
  ------------------
  601|    388|        return 1;
  602|       |
  603|       |    /* Equal length and equal hash. compare the strings. */
  604|  35.5k|    return pj_memcmp(r1->hname, name, name_len);
  605|  35.9k|}
sip_parser.c:on_syntax_error:
  228|  13.9k|{
  229|  13.9k|    PJ_UNUSED_ARG(scanner);
  ------------------
  |  | 1537|  13.9k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  230|  13.9k|    PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|  13.9k|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
  231|  13.9k|}
sip_parser.c:strtoi_validate:
  264|  10.7k|{ 
  265|  10.7k|    long retval;
  266|  10.7k|    pj_status_t status;
  267|       |
  268|  10.7k|    if (!str || !value) {
  ------------------
  |  Branch (268:9): [True: 0, False: 10.7k]
  |  Branch (268:17): [True: 0, False: 10.7k]
  ------------------
  269|      0|        on_str_parse_error(str, PJ_EINVAL);
  ------------------
  |  |  393|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  270|      0|        return;
  271|      0|    }
  272|  10.7k|    status = pj_strtol2(str, &retval);
  273|  10.7k|    if (status != PJ_EINVAL) {
  ------------------
  |  |  393|  10.7k|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|  10.7k|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|  10.7k|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|  10.7k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (273:9): [True: 9.84k, False: 869]
  ------------------
  274|  9.84k|        if (min_val > retval) {
  ------------------
  |  Branch (274:13): [True: 750, False: 9.09k]
  ------------------
  275|    750|            *value = min_val;
  276|    750|            status = PJ_ETOOSMALL;
  ------------------
  |  |  469|    750|#define PJ_ETOOSMALL        (PJ_ERRNO_START_STATUS + 19)/* 70019 */
  |  |  ------------------
  |  |  |  |  521|    750|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|    750|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|    750|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  277|  9.09k|        } else if (retval > max_val) {
  ------------------
  |  Branch (277:20): [True: 1.07k, False: 8.01k]
  ------------------
  278|  1.07k|            *value = max_val;
  279|  1.07k|            status = PJ_ETOOBIG;
  ------------------
  |  |  458|  1.07k|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  521|  1.07k|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|  1.07k|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|  1.07k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  280|  1.07k|        } else
  281|  8.01k|            *value = (int)retval;
  282|  9.84k|    }
  283|       |
  284|  10.7k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (284:9): [True: 2.69k, False: 8.01k]
  ------------------
  285|  2.69k|        on_str_parse_error(str, status);
  286|  10.7k|}
sip_parser.c:on_str_parse_error:
  235|  2.69k|{
  236|  2.69k|    char *s;
  237|       |
  238|  2.69k|    switch(rc) {
  239|    869|    case PJ_EINVAL:
  ------------------
  |  |  393|    869|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  521|    869|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|    869|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|    869|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (239:5): [True: 869, False: 1.82k]
  ------------------
  240|    869|        s = "NULL input string, invalid input string, or NULL return "\
  241|    869|            "value pointer";
  242|    869|        break;
  243|    750|    case PJ_ETOOSMALL:
  ------------------
  |  |  469|    750|#define PJ_ETOOSMALL        (PJ_ERRNO_START_STATUS + 19)/* 70019 */
  |  |  ------------------
  |  |  |  |  521|    750|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|    750|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|    750|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (243:5): [True: 750, False: 1.94k]
  ------------------
  244|    750|        s = "String value was less than the minimum allowed value.";
  245|    750|        break;
  246|  1.07k|    case PJ_ETOOBIG:
  ------------------
  |  |  458|  1.07k|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  521|  1.07k|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|  1.07k|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|  1.07k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (246:5): [True: 1.07k, False: 1.61k]
  ------------------
  247|  1.07k|        s = "String value was greater than the maximum allowed value.";
  248|  1.07k|        break;
  249|      0|    default:
  ------------------
  |  Branch (249:5): [True: 0, False: 2.69k]
  ------------------
  250|      0|        s = "Unknown error";
  251|  2.69k|    }
  252|       |
  253|  2.69k|    if (str) {
  ------------------
  |  Branch (253:9): [True: 2.69k, False: 0]
  ------------------
  254|  2.69k|        PJ_LOG(1, (THIS_FILE, "Error parsing '%.*s': %s",
  ------------------
  |  |  106|  2.69k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  2.69k|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|  5.39k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 2.69k, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 2.69k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  432|      0|    #define pj_log_wrapper_1(arg)       pj_log_1 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|  2.69k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 2.69k]
  |  |  ------------------
  ------------------
  255|  2.69k|                   (int)str->slen, str->ptr, s));
  256|  2.69k|    } else {
  257|      0|        PJ_LOG(1, (THIS_FILE, "Can't parse input string: %s", s));
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  432|      0|    #define pj_log_wrapper_1(arg)       pj_log_1 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  258|      0|    }
  259|  2.69k|    PJ_THROW(PJSIP_EINVAL_ERR_EXCEPTION);
  ------------------
  |  |  402|  2.69k|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
  260|  2.69k|}
sip_parser.c:int_parse_msg:
 1021|  6.10k|{
 1022|       |    /* These variables require "volatile" so their values get
 1023|       |     * preserved when re-entering the PJ_TRY block after an error.
 1024|       |     */
 1025|  6.10k|    volatile pj_bool_t parsing_headers;
 1026|  6.10k|    pjsip_msg *volatile msg = NULL;
 1027|  6.10k|    pjsip_ctype_hdr *volatile ctype_hdr = NULL;
 1028|       |
 1029|  6.10k|    pj_str_t hname;
 1030|  6.10k|    pj_scanner *scanner = ctx->scanner;
 1031|  6.10k|    pj_pool_t *pool = ctx->pool;
 1032|  6.10k|    PJ_USE_EXCEPTION;
  ------------------
  |  |  367|  6.10k|#define PJ_USE_EXCEPTION    struct pj_exception_state_t pj_x_except__; int pj_x_code__
  ------------------
 1033|       |
 1034|  6.10k|    parsing_headers = PJ_FALSE;
 1035|       |
 1036|  23.7k|retry_parse:
 1037|  23.7k|    PJ_TRY 
  ------------------
  |  |  373|  23.7k|#define PJ_TRY              if (1) { \
  |  |  ------------------
  |  |  |  Branch (373:33): [True: 23.7k, Folded]
  |  |  ------------------
  |  |  374|  23.7k|                                pj_push_exception_handler_(&pj_x_except__); \
  |  |  375|  23.7k|                                pj_x_code__ = pj_setjmp(pj_x_except__.state); \
  |  |  ------------------
  |  |  |  |   31|  23.7k|#    define pj_setjmp(buf)      setjmp(buf)
  |  |  ------------------
  |  |  376|  23.7k|                                if (pj_x_code__ == 0)
  |  |  ------------------
  |  |  |  Branch (376:37): [True: 23.7k, False: 0]
  |  |  ------------------
  ------------------
 1038|  23.7k|    {
 1039|  23.7k|        if (parsing_headers)
  ------------------
  |  Branch (1039:13): [True: 17.6k, False: 6.10k]
  ------------------
 1040|  17.6k|            goto parse_headers;
 1041|       |
 1042|       |        /* Skip leading newlines. */
 1043|  7.14k|        while (IS_NEWLINE(*scanner->curptr)) {
  ------------------
  |  |   62|  7.14k|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 407, False: 6.73k]
  |  |  |  Branch (62:39): [True: 636, False: 6.10k]
  |  |  ------------------
  ------------------
 1044|  1.04k|            pj_scan_get_newline(scanner);
 1045|  1.04k|        }
 1046|       |
 1047|       |        /* Check if we still have valid packet.
 1048|       |         * Sometimes endpoints just send blank (CRLF) packets just to keep
 1049|       |         * NAT bindings open.
 1050|       |         */
 1051|  6.10k|        if (pj_scan_is_eof(scanner))
  ------------------
  |  Branch (1051:13): [True: 23, False: 6.07k]
  ------------------
 1052|     23|            return NULL;
 1053|       |
 1054|       |        /* Parse request or status line */
 1055|  6.07k|        if (is_next_sip_version(scanner)) {
  ------------------
  |  Branch (1055:13): [True: 4.12k, False: 1.94k]
  ------------------
 1056|  4.12k|            msg = pjsip_msg_create(pool, PJSIP_RESPONSE_MSG);
 1057|  4.12k|            int_parse_status_line( scanner, &msg->line.status );
 1058|  4.12k|        } else {
 1059|  1.94k|            msg = pjsip_msg_create(pool, PJSIP_REQUEST_MSG);
 1060|  1.94k|            int_parse_req_line(scanner, pool, &msg->line.req );
 1061|  1.94k|        }
 1062|       |
 1063|  6.07k|        parsing_headers = PJ_TRUE;
 1064|       |
 1065|  21.7k|parse_headers:
 1066|       |        /* Parse headers. */
 1067|  37.9k|        do {
 1068|  37.9k|            pjsip_parse_hdr_func * func;
 1069|  37.9k|            pjsip_hdr *hdr = NULL;
 1070|       |
 1071|       |            /* Init hname just in case parsing fails.
 1072|       |             * Ref: PROTOS #2412
 1073|       |             */
 1074|  37.9k|            hname.slen = 0;
 1075|       |            
 1076|       |            /* Get hname. */
 1077|  37.9k|            pj_scan_get( scanner, &pconst.pjsip_TOKEN_SPEC, &hname);
 1078|  37.9k|            if (pj_scan_get_char( scanner ) != ':') {
  ------------------
  |  Branch (1078:17): [True: 1.86k, False: 36.0k]
  ------------------
 1079|  1.86k|                PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|  1.86k|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1080|  1.86k|            }
 1081|       |            
 1082|       |            /* Find handler. */
 1083|  36.0k|            func = find_handler(&hname);
 1084|       |            
 1085|       |            /* Call the handler if found.
 1086|       |             * If no handler is found, then treat the header as generic
 1087|       |             * hname/hvalue pair.
 1088|       |             */
 1089|  36.0k|            if (func) {
  ------------------
  |  Branch (1089:17): [True: 31.4k, False: 4.63k]
  ------------------
 1090|  31.4k|                hdr = (*func)(ctx);
 1091|       |
 1092|       |                /* Note:
 1093|       |                 *  hdr MAY BE NULL, if parsing does not yield a new header
 1094|       |                 *  instance, e.g. the values have been added to existing
 1095|       |                 *  header. See https://github.com/pjsip/pjproject/issues/940
 1096|       |                 */
 1097|       |
 1098|       |                /* Check if we've just parsed a Content-Type header. 
 1099|       |                 * We will check for a message body if we've got Content-Type 
 1100|       |                 * header.
 1101|       |                 */
 1102|  31.4k|                if (hdr && hdr->type == PJSIP_H_CONTENT_TYPE) {
  ------------------
  |  Branch (1102:21): [True: 16.8k, False: 14.6k]
  |  Branch (1102:28): [True: 1.45k, False: 15.3k]
  ------------------
 1103|  1.45k|                    ctype_hdr = (pjsip_ctype_hdr*)hdr;
 1104|  1.45k|                }
 1105|       |
 1106|  31.4k|            } else {
 1107|  4.63k|                hdr = parse_hdr_generic_string(ctx);
 1108|  4.63k|                hdr->name = hdr->sname = hname;
 1109|  4.63k|            }
 1110|       |            
 1111|       |            /* Single parse of header line can produce multiple headers.
 1112|       |             * For example, if one Contact: header contains Contact list
 1113|       |             * separated by comma, then these Contacts will be split into
 1114|       |             * different Contact headers.
 1115|       |             * So here we must insert list instead of just insert one header.
 1116|       |             */
 1117|  36.0k|            if (hdr)
  ------------------
  |  Branch (1117:17): [True: 19.1k, False: 16.9k]
  ------------------
 1118|  19.1k|                pj_list_insert_nodes_before(&msg->hdr, hdr);
 1119|       |            
 1120|       |            /* Parse until EOF or an empty line is found. */
 1121|  36.0k|        } while (!pj_scan_is_eof(scanner) && !IS_NEWLINE(*scanner->curptr));
  ------------------
  |  |   62|  17.0k|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 104, False: 16.9k]
  |  |  |  Branch (62:39): [True: 767, False: 16.1k]
  |  |  ------------------
  ------------------
  |  Branch (1121:18): [True: 17.0k, False: 19.0k]
  ------------------
 1122|       |        
 1123|  19.9k|        parsing_headers = PJ_FALSE;
 1124|       |
 1125|       |        /* If empty line is found, eat it. */
 1126|  19.9k|        if (!pj_scan_is_eof(scanner)) {
  ------------------
  |  Branch (1126:13): [True: 871, False: 19.0k]
  ------------------
 1127|    871|            if (IS_NEWLINE(*scanner->curptr)) {
  ------------------
  |  |   62|    871|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 104, False: 767]
  |  |  |  Branch (62:39): [True: 767, False: 0]
  |  |  ------------------
  ------------------
 1128|    871|                pj_scan_get_newline(scanner);
 1129|    871|            }
 1130|    871|        }
 1131|       |
 1132|       |        /* If we have Content-Type header, treat the rest of the message 
 1133|       |         * as body.
 1134|       |         */
 1135|  19.9k|        if (ctype_hdr && scanner->curptr!=scanner->end) {
  ------------------
  |  Branch (1135:13): [True: 838, False: 19.0k]
  |  Branch (1135:26): [True: 789, False: 49]
  ------------------
 1136|       |            /* New: if Content-Type indicates that this is a multipart
 1137|       |             * message body, parse it.
 1138|       |             */
 1139|    789|            const pj_str_t STR_MULTIPART = { "multipart", 9 };
 1140|    789|            pjsip_msg_body *body;
 1141|       |
 1142|    789|            if (pj_stricmp(&ctype_hdr->media.type, &STR_MULTIPART)==0) {
  ------------------
  |  Branch (1142:17): [True: 677, False: 112]
  ------------------
 1143|    677|                body = pjsip_multipart_parse(pool, scanner->curptr,
 1144|    677|                                             scanner->end - scanner->curptr,
 1145|    677|                                             &ctype_hdr->media, 0);
 1146|    677|            } else {
 1147|    112|                body = PJ_POOL_ALLOC_T(pool, pjsip_msg_body);
  ------------------
  |  |  569|    112|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1148|    112|                pjsip_media_type_cp(pool, &body->content_type,
 1149|    112|                                    &ctype_hdr->media);
 1150|       |
 1151|    112|                body->data = scanner->curptr;
 1152|    112|                body->len = (unsigned)(scanner->end - scanner->curptr);
 1153|    112|                body->print_body = &pjsip_print_text_body;
 1154|    112|                body->clone_data = &pjsip_clone_text_data;
 1155|    112|            }
 1156|       |
 1157|    789|            msg->body = body;
 1158|    789|        }
 1159|  19.9k|    }
 1160|      0|    PJ_CATCH_ANY 
 1161|      0|    {
 1162|       |        /* Exception was thrown during parsing. 
 1163|       |         * Skip until newline, and parse next header. 
 1164|       |         */
 1165|  20.7k|        if (err_list) {
  ------------------
  |  Branch (1165:13): [True: 20.7k, False: 18.4E]
  ------------------
 1166|  20.7k|            pjsip_parser_err_report *err_info;
 1167|       |            
 1168|  20.7k|            err_info = PJ_POOL_ALLOC_T(pool, pjsip_parser_err_report);
  ------------------
  |  |  569|  20.7k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1169|  20.7k|            err_info->except_code = PJ_GET_EXCEPTION();
  ------------------
  |  |  409|  20.7k|#define PJ_GET_EXCEPTION()      (pj_x_code__)
  ------------------
 1170|  20.7k|            err_info->line = scanner->line;
 1171|       |            /* Scanner's column is zero based, so add 1 */
 1172|  20.7k|            err_info->col = pj_scan_get_col(scanner) + 1;
 1173|  20.7k|            if (parsing_headers)
  ------------------
  |  Branch (1173:17): [True: 18.8k, False: 1.92k]
  ------------------
 1174|  18.8k|                err_info->hname = hname;
 1175|  1.92k|            else if (msg && msg->type == PJSIP_REQUEST_MSG)
  ------------------
  |  Branch (1175:22): [True: 1.92k, False: 0]
  |  Branch (1175:29): [True: 1.76k, False: 164]
  ------------------
 1176|  1.76k|                err_info->hname = pj_str("Request Line");
 1177|    164|            else if (msg && msg->type == PJSIP_RESPONSE_MSG)
  ------------------
  |  Branch (1177:22): [True: 164, False: 0]
  |  Branch (1177:29): [True: 164, False: 0]
  ------------------
 1178|    164|                err_info->hname = pj_str("Status Line");
 1179|      0|            else
 1180|      0|                err_info->hname.slen = 0;
 1181|       |            
 1182|  20.7k|            pj_list_insert_before(err_list, err_info);
 1183|  20.7k|        }
 1184|       |        
 1185|  18.8k|        if (parsing_headers) {
  ------------------
  |  Branch (1185:13): [True: 18.8k, False: 18.4E]
  ------------------
 1186|  18.8k|            if (!pj_scan_is_eof(scanner)) {
  ------------------
  |  Branch (1186:17): [True: 18.2k, False: 576]
  ------------------
 1187|       |                /* Skip until next line.
 1188|       |                 * Watch for header continuation.
 1189|       |                 */
 1190|  18.4k|                do {
 1191|  18.4k|                    pj_scan_skip_line(scanner);
 1192|  18.4k|                } while (IS_SPACE(*scanner->curptr));
  ------------------
  |  |   63|  18.4k|#define IS_SPACE(c)     ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (63:26): [True: 216, False: 18.2k]
  |  |  |  Branch (63:38): [True: 8, False: 18.2k]
  |  |  ------------------
  ------------------
 1193|  18.2k|            }
 1194|       |
 1195|       |            /* Restore flag. Flag may be set in int_parse_sip_url() */
 1196|  18.8k|            scanner->skip_ws = PJ_SCAN_AUTOSKIP_WS_HEADER;
 1197|       |
 1198|       |            /* Continue parse next header, if any. */
 1199|  18.8k|            if (!pj_scan_is_eof(scanner) && !IS_NEWLINE(*scanner->curptr)) {
  ------------------
  |  |   62|  17.6k|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 4, False: 17.6k]
  |  |  |  Branch (62:39): [True: 9, False: 17.6k]
  |  |  ------------------
  ------------------
  |  Branch (1199:17): [True: 17.6k, False: 1.15k]
  ------------------
 1200|  17.6k|                goto retry_parse;
 1201|  17.6k|            }
 1202|  18.8k|        }
 1203|       |
 1204|  18.4E|        msg = NULL;
 1205|  18.4E|    }
 1206|  2.28k|    PJ_END;
  ------------------
  |  |  394|  2.28k|#define PJ_END                  pj_pop_exception_handler_(&pj_x_except__); \
  |  |  395|  2.28k|                            } else {}
  ------------------
 1207|       |
 1208|  2.28k|    return msg;
 1209|  23.7k|}
sip_parser.c:is_next_sip_version:
 1004|  6.07k|{
 1005|  6.07k|    pj_str_t SIP = { "SIP", 3 };
 1006|  6.07k|    pj_str_t sip;
 1007|  6.07k|    int c;
 1008|       |
 1009|  6.07k|    c = pj_scan_peek(scanner, &pconst.pjsip_ALPHA_SPEC, &sip);
 1010|       |    /* return TRUE if it is "SIP" followed by "/" or space.
 1011|       |     * we include space since the "/" may be separated by space,
 1012|       |     * although this would mean it would return TRUE if it is a
 1013|       |     * request and the method is "SIP"!
 1014|       |     */
 1015|  6.07k|    return c && (c=='/' || c==' ' || c=='\t') && pj_stricmp(&sip, &SIP)==0;
  ------------------
  |  Branch (1015:12): [True: 6.06k, False: 13]
  |  Branch (1015:18): [True: 4.12k, False: 1.94k]
  |  Branch (1015:28): [True: 293, False: 1.64k]
  |  Branch (1015:38): [True: 17, False: 1.63k]
  |  Branch (1015:50): [True: 4.12k, False: 306]
  ------------------
 1016|  6.07k|}
sip_parser.c:int_parse_req_line:
 1688|  1.94k|{
 1689|  1.94k|    pj_str_t token;
 1690|       |
 1691|  1.94k|    pj_scan_get( scanner, &pconst.pjsip_TOKEN_SPEC, &token);
 1692|  1.94k|    pjsip_method_init_np( &req_line->method, &token);
 1693|       |
 1694|  1.94k|    req_line->uri = int_parse_uri(scanner, pool, PJ_TRUE);
 1695|  1.94k|    parse_sip_version(scanner);
 1696|  1.94k|    pj_scan_get_newline( scanner );
 1697|  1.94k|}
sip_parser.c:parse_param_imp:
 1217|  47.3k|{
 1218|       |    /* pname */
 1219|  47.3k|    if (!esc_spec) {
  ------------------
  |  Branch (1219:9): [True: 38.6k, False: 8.69k]
  ------------------
 1220|  38.6k|        pj_scan_get(scanner, spec, pname);
 1221|  38.6k|    } else {
 1222|  8.69k|        parser_get_and_unescape(scanner, pool, spec, esc_spec, pname);
 1223|  8.69k|    }
 1224|       |
 1225|       |    /* init pvalue */
 1226|  47.3k|    pvalue->ptr = NULL;
 1227|  47.3k|    pvalue->slen = 0;
 1228|       |
 1229|       |    /* pvalue, if any */
 1230|  47.3k|    if (*scanner->curptr == '=') {
  ------------------
  |  Branch (1230:9): [True: 27.0k, False: 20.3k]
  ------------------
 1231|  27.0k|        pj_scan_get_char(scanner);
 1232|  27.0k|        if (!pj_scan_is_eof(scanner)) {
  ------------------
  |  Branch (1232:13): [True: 26.9k, False: 19]
  ------------------
 1233|       |            /* pvalue can be a quoted string. */
 1234|  26.9k|            if (*scanner->curptr == '"') {
  ------------------
  |  Branch (1234:17): [True: 6.58k, False: 20.4k]
  ------------------
 1235|  6.58k|                pj_scan_get_quote( scanner, '"', '"', pvalue);
 1236|  6.58k|                if (option & PJSIP_PARSE_REMOVE_QUOTE) {
  ------------------
  |  Branch (1236:21): [True: 194, False: 6.39k]
  ------------------
 1237|    194|                    pvalue->ptr++;
 1238|    194|                    pvalue->slen -= 2;
 1239|    194|                }
 1240|       |            // } else if (*scanner->curptr == '[') {
 1241|       |                /* pvalue can be a quoted IPv6; in this case, the
 1242|       |                 * '[' and ']' quote characters are to be removed
 1243|       |                 * from the pvalue.
 1244|       |                 *
 1245|       |                 * Update: this seems to be unnecessary and may cause
 1246|       |                 * parsing error for cases such as IPv6 reference with
 1247|       |                 * port number.
 1248|       |                 */
 1249|       |                // pj_scan_get_char(scanner);
 1250|       |                // pj_scan_get_until_ch(scanner, ']', pvalue);
 1251|       |                // pj_scan_get_char(scanner);
 1252|  20.4k|            } else if(pj_cis_match(spec, *scanner->curptr)) {
  ------------------
  |  Branch (1252:23): [True: 19.5k, False: 891]
  ------------------
 1253|  19.5k|                if (!esc_spec) {
  ------------------
  |  Branch (1253:21): [True: 17.7k, False: 1.71k]
  ------------------
 1254|  17.7k|                    pj_scan_get(scanner, spec, pvalue);
 1255|  17.7k|                } else {
 1256|  1.71k|                    parser_get_and_unescape(scanner, pool, spec, esc_spec,
 1257|  1.71k|                                            pvalue);
 1258|  1.71k|                }
 1259|  19.5k|            }
 1260|  26.9k|        }
 1261|  27.0k|    }
 1262|  47.3k|}
sip_parser.c:int_parse_uri_or_name_addr:
 1415|  19.2k|{
 1416|  19.2k|    pjsip_uri *uri;
 1417|  19.2k|    int is_name_addr = 0;
 1418|       |
 1419|       |    /* Exhaust any whitespaces. */
 1420|  19.2k|    pj_scan_skip_whitespace(scanner);
 1421|       |
 1422|  19.2k|    if (*scanner->curptr=='"' || *scanner->curptr=='<') {
  ------------------
  |  Branch (1422:9): [True: 920, False: 18.3k]
  |  Branch (1422:34): [True: 3.15k, False: 15.1k]
  ------------------
 1423|  4.07k|        uri = (pjsip_uri*)int_parse_name_addr( scanner, pool );
 1424|  4.07k|        is_name_addr = 1;
 1425|  15.1k|    } else {
 1426|  15.1k|        pj_str_t scheme;
 1427|  15.1k|        int next_ch;
 1428|       |
 1429|  15.1k|        next_ch = pj_scan_peek( scanner, &pconst.pjsip_DISPLAY_SPEC, &scheme);
 1430|       |
 1431|  15.1k|        if (next_ch==':') {
  ------------------
  |  Branch (1431:13): [True: 9.44k, False: 5.75k]
  ------------------
 1432|  9.44k|            pjsip_parse_uri_func *func = find_uri_handler(&scheme);
 1433|       |
 1434|  9.44k|            if (func == NULL) {
  ------------------
  |  Branch (1434:17): [True: 0, False: 9.44k]
  ------------------
 1435|       |                /* Unsupported URI scheme */
 1436|      0|                PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|      0|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1437|      0|            }
 1438|       |
 1439|  9.44k|            uri = (pjsip_uri*)
 1440|  9.44k|                  (*func)(scanner, pool, 
 1441|  9.44k|                          (opt & PJSIP_PARSE_URI_IN_FROM_TO_HDR)==0);
 1442|       |
 1443|       |
 1444|  9.44k|        } else {
 1445|  5.75k|            uri = (pjsip_uri*)int_parse_name_addr( scanner, pool );
 1446|  5.75k|            is_name_addr = 1;
 1447|  5.75k|        }
 1448|  15.1k|    }
 1449|       |
 1450|       |    /* Should we return the URI object as name address? */
 1451|  19.2k|    if (opt & PJSIP_PARSE_URI_AS_NAMEADDR) {
  ------------------
  |  Branch (1451:9): [True: 6.58k, False: 12.6k]
  ------------------
 1452|  6.58k|        if (is_name_addr == 0) {
  ------------------
  |  Branch (1452:13): [True: 4.50k, False: 2.07k]
  ------------------
 1453|  4.50k|            pjsip_name_addr *name_addr;
 1454|       |
 1455|  4.50k|            name_addr = pjsip_name_addr_create(pool);
 1456|  4.50k|            name_addr->uri = uri;
 1457|       |
 1458|  4.50k|            uri = (pjsip_uri*)name_addr;
 1459|  4.50k|        }
 1460|  6.58k|    }
 1461|       |
 1462|  19.2k|    return uri;
 1463|  19.2k|}
sip_parser.c:int_parse_status_line:
 1702|  4.12k|{
 1703|  4.12k|    pj_str_t token;
 1704|       |
 1705|  4.12k|    parse_sip_version(scanner);
 1706|  4.12k|    pj_scan_get( scanner, &pconst.pjsip_DIGIT_SPEC, &token);
 1707|  4.12k|    strtoi_validate(&token, PJSIP_MIN_STATUS_CODE, PJSIP_MAX_STATUS_CODE,
  ------------------
  |  |   49|  4.12k|#define PJSIP_MIN_STATUS_CODE       100         /**< For limit checks */
  ------------------
                  strtoi_validate(&token, PJSIP_MIN_STATUS_CODE, PJSIP_MAX_STATUS_CODE,
  ------------------
  |  |   50|  4.12k|#define PJSIP_MAX_STATUS_CODE       999         /**< For limit checks */
  ------------------
 1708|  4.12k|                    &status_line->code);
 1709|  4.12k|    if (*scanner->curptr != '\r' && *scanner->curptr != '\n')
  ------------------
  |  Branch (1709:9): [True: 3.66k, False: 464]
  |  Branch (1709:37): [True: 694, False: 2.97k]
  ------------------
 1710|    694|        pj_scan_get( scanner, &pconst.pjsip_NOT_NEWLINE, &status_line->reason);
 1711|  3.43k|    else
 1712|  3.43k|        status_line->reason.slen=0, status_line->reason.ptr=NULL;
 1713|  4.12k|    pj_scan_get_newline( scanner );
 1714|  4.12k|}
sip_parser.c:parse_hdr_end:
 1749|  24.0k|{
 1750|  24.0k|    if (pj_scan_is_eof(scanner)) {
  ------------------
  |  Branch (1750:9): [True: 2.51k, False: 21.4k]
  ------------------
 1751|  2.51k|        ;   /* Do nothing. */
 1752|  21.4k|    } else if (*scanner->curptr == '&') {
  ------------------
  |  Branch (1752:16): [True: 3.14k, False: 18.3k]
  ------------------
 1753|  3.14k|        pj_scan_get_char(scanner);
 1754|  18.3k|    } else {
 1755|  18.3k|        pj_scan_get_newline(scanner);
 1756|  18.3k|    }
 1757|  24.0k|}
sip_parser.c:parse_generic_array_hdr:
 1768|  4.82k|{
 1769|  4.82k|    pj_str_t elem;
 1770|       |
 1771|       |    /* Some header fields allow empty elements in the value:
 1772|       |     *   Accept, Allow, Supported
 1773|       |     */
 1774|  4.82k|    if (pj_scan_is_eof(scanner) || 
  ------------------
  |  Branch (1774:9): [True: 40, False: 4.78k]
  ------------------
 1775|  4.78k|        *scanner->curptr == '\r' || *scanner->curptr == '\n') 
  ------------------
  |  Branch (1775:9): [True: 958, False: 3.82k]
  |  Branch (1775:37): [True: 2.75k, False: 1.06k]
  ------------------
 1776|  3.75k|    {
 1777|  3.75k|        goto end;
 1778|  3.75k|    }
 1779|       |
 1780|  1.06k|    if (hdr->count >= PJ_ARRAY_SIZE(hdr->values)) {
  ------------------
  |  |  315|  1.06k|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (1780:9): [True: 0, False: 1.06k]
  ------------------
 1781|       |        /* Too many elements */
 1782|      0|        on_syntax_error(scanner);
 1783|      0|        return;
 1784|      0|    }
 1785|       |
 1786|       |    /* Parse array elements, skipping any empty elements (for buggy clients).
 1787|       |     * Scanner is configured with PJ_SCAN_AUTOSKIP_WS_HEADER, so whitespace
 1788|       |     * is automatically skipped after getting comma or element.
 1789|       |     */
 1790|  4.84k|    while (hdr->count < PJ_ARRAY_SIZE(hdr->values))
  ------------------
  |  |  315|  4.84k|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (1790:12): [True: 4.73k, False: 112]
  ------------------
 1791|  4.73k|    {
 1792|       |        /* Skip any leading/consecutive commas */
 1793|  8.91k|        while (*scanner->curptr == ',') {
  ------------------
  |  Branch (1793:16): [True: 4.18k, False: 4.73k]
  ------------------
 1794|  4.18k|            pj_scan_get_char(scanner);
 1795|  4.18k|        }
 1796|       |        
 1797|       |        /* Check for end of header */
 1798|  4.73k|        if (pj_scan_is_eof(scanner) || 
  ------------------
  |  Branch (1798:13): [True: 26, False: 4.70k]
  ------------------
 1799|  4.70k|            *scanner->curptr == '\r' || *scanner->curptr == '\n') 
  ------------------
  |  Branch (1799:13): [True: 13, False: 4.69k]
  |  Branch (1799:41): [True: 194, False: 4.49k]
  ------------------
 1800|    233|        {
 1801|    233|            break;
 1802|    233|        }
 1803|       |        
 1804|       |        /* Get element */
 1805|  4.49k|        pj_scan_get( scanner, &pconst.pjsip_NOT_COMMA_OR_NEWLINE, &elem);
 1806|  4.49k|        if (elem.slen > 0) {
  ------------------
  |  Branch (1806:13): [True: 4.49k, False: 7]
  ------------------
 1807|  4.49k|            hdr->values[hdr->count++] = elem;
 1808|  4.49k|        }
 1809|       |        
 1810|       |        /* If not followed by comma, we're done */
 1811|  4.49k|        if (*scanner->curptr != ',') {
  ------------------
  |  Branch (1811:13): [True: 720, False: 3.77k]
  ------------------
 1812|    720|            break;
 1813|    720|        }
 1814|  4.49k|    }
 1815|       |
 1816|  4.81k|end:
 1817|  4.81k|    parse_hdr_end(scanner);
 1818|  4.81k|}
sip_parser.c:find_handler:
  741|  39.5k|{
  742|  39.5k|    pj_uint32_t hash;
  743|  39.5k|    char hname_copy[PJSIP_MAX_HNAME_LEN];
  744|  39.5k|    pj_str_t tmp;
  745|  39.5k|    pjsip_parse_hdr_func *func;
  746|       |
  747|  39.5k|    if (hname->slen >= PJSIP_MAX_HNAME_LEN) {
  ------------------
  |  | 1145|  39.5k|#define PJSIP_MAX_HNAME_LEN             64
  ------------------
  |  Branch (747:9): [True: 71, False: 39.4k]
  ------------------
  748|       |        /* Guaranteed not to be able to find handler. */
  749|     71|        return NULL;
  750|     71|    }
  751|       |
  752|       |    /* First, common case, try to find handler with exact name */
  753|  39.4k|    hash = pj_hash_calc(0, hname->ptr, (unsigned)hname->slen);
  754|  39.4k|    func = find_handler_imp(hash, hname);
  755|  39.4k|    if (func)
  ------------------
  |  Branch (755:9): [True: 20.6k, False: 18.8k]
  ------------------
  756|  20.6k|        return func;
  757|       |
  758|       |
  759|       |    /* If not found, try converting the header name to lowercase and
  760|       |     * search again.
  761|       |     */
  762|  18.8k|    hash = pj_hash_calc_tolower(0, hname_copy, hname);
  763|  18.8k|    tmp.ptr = hname_copy;
  764|  18.8k|    tmp.slen = hname->slen;
  765|  18.8k|    return find_handler_imp(hash, &tmp);
  766|  39.4k|}
sip_parser.c:find_handler_imp:
  710|  58.2k|{
  711|  58.2k|    handler_rec *first;
  712|  58.2k|    int          comp;
  713|  58.2k|    unsigned     n;
  714|       |
  715|       |    /* Binary search for the handler. */
  716|  58.2k|    comp = -1;
  717|  58.2k|    first = &handler[0];
  718|  58.2k|    n = handler_count;
  719|   328k|    for (; n > 0; ) {
  ------------------
  |  Branch (719:12): [True: 306k, False: 22.7k]
  ------------------
  720|   306k|        unsigned half = n / 2;
  721|   306k|        handler_rec *mid = first + half;
  722|       |
  723|   306k|        comp = compare_handler(mid, hname->ptr, hname->slen, hash);
  724|   306k|        if (comp < 0) {
  ------------------
  |  Branch (724:13): [True: 54.2k, False: 252k]
  ------------------
  725|  54.2k|            first = ++mid;
  726|  54.2k|            n -= half + 1;
  727|   252k|        } else if (comp==0) {
  ------------------
  |  Branch (727:20): [True: 35.5k, False: 216k]
  ------------------
  728|  35.5k|            first = mid;
  729|  35.5k|            break;
  730|   216k|        } else {
  731|   216k|            n = half;
  732|   216k|        }
  733|   306k|    }
  734|       |
  735|  58.2k|    return comp==0 ? first->handler : NULL;
  ------------------
  |  Branch (735:12): [True: 35.5k, False: 22.7k]
  ------------------
  736|  58.2k|}
sip_parser.c:parse_hdr_generic_string:
 2405|  3.96k|{
 2406|  3.96k|    pjsip_generic_string_hdr *hdr;
 2407|       |
 2408|  3.96k|    hdr = pjsip_generic_string_hdr_create(ctx->pool, NULL, NULL);
 2409|  3.96k|    parse_generic_string_hdr(hdr, ctx);
 2410|  3.96k|    return (pjsip_hdr*)hdr;
 2411|       |
 2412|  3.96k|}
sip_parser.c:parse_generic_string_hdr:
 1831|  3.96k|{
 1832|  3.96k|    pj_scanner *scanner = ctx->scanner;
 1833|       |
 1834|  3.96k|    hdr->hvalue.slen = 0;
 1835|       |
 1836|       |    /* header may be mangled hence the loop */
 1837|  4.59k|    while (pj_cis_match(&pconst.pjsip_NOT_NEWLINE, *scanner->curptr)) {
  ------------------
  |  Branch (1837:12): [True: 1.73k, False: 2.86k]
  ------------------
 1838|  1.73k|        pj_str_t next, tmp;
 1839|       |
 1840|  1.73k|        pj_scan_get( scanner, &pconst.pjsip_NOT_NEWLINE, &hdr->hvalue);
 1841|  1.73k|        if (pj_scan_is_eof(scanner) || IS_NEWLINE(*scanner->curptr))
  ------------------
  |  |   62|  1.57k|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 219, False: 1.35k]
  |  |  |  Branch (62:39): [True: 727, False: 630]
  |  |  ------------------
  ------------------
  |  Branch (1841:13): [True: 157, False: 1.57k]
  ------------------
 1842|  1.10k|            break;
 1843|       |        /* mangled, get next fraction */
 1844|    630|        pj_scan_get( scanner, &pconst.pjsip_NOT_NEWLINE, &next);
 1845|       |        /* concatenate */
 1846|    630|        tmp.ptr = (char*)pj_pool_alloc(ctx->pool, 
 1847|    630|                                       hdr->hvalue.slen + next.slen + 2);
 1848|    630|        tmp.slen = 0;
 1849|    630|        pj_strcpy(&tmp, &hdr->hvalue);
 1850|    630|        pj_strcat2(&tmp, " ");
 1851|    630|        pj_strcat(&tmp, &next);
 1852|    630|        tmp.ptr[tmp.slen] = '\0';
 1853|       |
 1854|    630|        hdr->hvalue = tmp;
 1855|    630|    }
 1856|       |
 1857|  3.96k|    parse_hdr_end(scanner);
 1858|  3.96k|}

pjsip_resolver_create:
   96|      1|{
   97|      1|    pjsip_resolver_t *resolver;
   98|      1|    pj_status_t status;
   99|       |
  100|      1|    PJ_ASSERT_RETURN(pool && p_res, PJ_EINVAL);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      2|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (100:5): [True: 0, False: 0]
  |  Branch (100:5): [True: 0, False: 0]
  |  Branch (100:5): [True: 0, False: 0]
  |  Branch (100:5): [True: 0, False: 0]
  ------------------
  101|      1|    resolver = PJ_POOL_ZALLOC_T(pool, pjsip_resolver_t);
  ------------------
  |  |  583|      1|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  102|       |
  103|       |    /* Create group lock */
  104|      1|    status = pj_grp_lock_create(pool, NULL, &resolver->grp_lock);
  105|      1|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (105:9): [True: 0, False: 1]
  ------------------
  106|      0|        return status;
  107|       |
  108|      1|    pj_grp_lock_add_ref(resolver->grp_lock);
  109|       |
  110|      1|    *p_res = resolver;
  111|       |
  112|      1|    return PJ_SUCCESS;
  113|      1|}

pjsip_tel_uri_create:
   97|  2.57k|{
   98|  2.57k|    pjsip_tel_uri *uri = PJ_POOL_ZALLOC_T(pool, pjsip_tel_uri);
  ------------------
  |  |  583|  2.57k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
   99|  2.57k|    uri->vptr = &tel_uri_vptr;
  100|  2.57k|    pj_list_init(&uri->other_param);
  101|  2.57k|    return uri;
  102|  2.57k|}
pjsip_tel_uri_subsys_init:
  118|      1|{
  119|      1|    pj_status_t status;
  120|       |
  121|      1|    pj_cis_buf_init(&cis_buf);
  122|       |
  123|      1|    status = pj_cis_init(&cis_buf, &pjsip_TEL_EXT_VALUE_SPEC);
  124|      1|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (124:5): [True: 0, False: 0]
  |  Branch (124:5): [True: 0, False: 0]
  ------------------
  125|      1|    pj_cis_add_str(&pjsip_TEL_EXT_VALUE_SPEC, PHONE_DIGITS);
  ------------------
  |  |   36|      1|#define PHONE_DIGITS        DIGITS VISUAL_SEP
  |  |  ------------------
  |  |  |  |   32|      1|#define DIGITS              "0123456789"
  |  |  ------------------
  |  |               #define PHONE_DIGITS        DIGITS VISUAL_SEP
  |  |  ------------------
  |  |  |  |   35|      1|#define VISUAL_SEP          "-.()"
  |  |  ------------------
  ------------------
  126|       |
  127|      1|    status = pj_cis_init(&cis_buf, &pjsip_TEL_NUMBER_SPEC);
  128|      1|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (128:5): [True: 0, False: 0]
  |  Branch (128:5): [True: 0, False: 0]
  ------------------
  129|      1|    pj_cis_add_str(&pjsip_TEL_NUMBER_SPEC, NUMBER_SPEC);
  ------------------
  |  |   39|      1|#define NUMBER_SPEC         LOCAL_DIGITS GLOBAL_DIGITS
  |  |  ------------------
  |  |  |  |   38|      1|#define LOCAL_DIGITS        HEX_DIGITS "*#" VISUAL_SEP
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|      1|#define HEX_DIGITS          DIGITS HEX
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      1|#define DIGITS              "0123456789"
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define NUMBER_SPEC         LOCAL_DIGITS GLOBAL_DIGITS
  |  |  ------------------
  |  |  |  |   37|      1|#define GLOBAL_DIGITS       "+" PHONE_DIGITS
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      1|#define PHONE_DIGITS        DIGITS VISUAL_SEP
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   35|      1|#define VISUAL_SEP          "-.()"
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  130|       |
  131|      1|    status = pj_cis_init(&cis_buf, &pjsip_TEL_VISUAL_SEP_SPEC);
  132|      1|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (132:5): [True: 0, False: 0]
  |  Branch (132:5): [True: 0, False: 0]
  ------------------
  133|      1|    pj_cis_add_str(&pjsip_TEL_VISUAL_SEP_SPEC, VISUAL_SEP);
  ------------------
  |  |   35|      1|#define VISUAL_SEP          "-.()"
  ------------------
  134|       |
  135|      1|    status = pj_cis_init(&cis_buf, &pjsip_TEL_PHONE_CONTEXT_SPEC);
  136|      1|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (136:5): [True: 0, False: 0]
  |  Branch (136:5): [True: 0, False: 0]
  ------------------
  137|      1|    pj_cis_add_alpha(&pjsip_TEL_PHONE_CONTEXT_SPEC);
  138|      1|    pj_cis_add_num(&pjsip_TEL_PHONE_CONTEXT_SPEC);
  139|      1|    pj_cis_add_str(&pjsip_TEL_PHONE_CONTEXT_SPEC, PHONE_CONTEXT);
  ------------------
  |  |   40|      1|#define PHONE_CONTEXT       ALPHA GLOBAL_DIGITS
  |  |  ------------------
  |  |  |  |   37|      1|#define GLOBAL_DIGITS       "+" PHONE_DIGITS
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      1|#define PHONE_DIGITS        DIGITS VISUAL_SEP
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   35|      1|#define VISUAL_SEP          "-.()"
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  140|       |
  141|      1|    status = pj_cis_init(&cis_buf, &pjsip_TEL_URIC_SPEC);
  142|      1|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (142:5): [True: 0, False: 0]
  |  Branch (142:5): [True: 0, False: 0]
  ------------------
  143|      1|    pj_cis_add_alpha(&pjsip_TEL_URIC_SPEC);
  144|      1|    pj_cis_add_num(&pjsip_TEL_URIC_SPEC);
  145|      1|    pj_cis_add_str(&pjsip_TEL_URIC_SPEC, URIC);
  ------------------
  |  |   46|      1|#define URIC                RESERVED UNRESERVED ESCAPED "[]+"
  |  |  ------------------
  |  |  |  |   42|      1|#define RESERVED            "/:@&$,+"
  |  |  ------------------
  ------------------
  146|       |
  147|      1|    status = pj_cis_init(&cis_buf, &pjsip_TEL_PNAME_SPEC);
  148|      1|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (148:5): [True: 0, False: 0]
  |  Branch (148:5): [True: 0, False: 0]
  ------------------
  149|      1|    pj_cis_add_alpha(&pjsip_TEL_PNAME_SPEC);
  150|      1|    pj_cis_add_num(&pjsip_TEL_PNAME_SPEC);
  151|      1|    pj_cis_add_str(&pjsip_TEL_PNAME_SPEC, "-");
  152|       |
  153|      1|    status = pj_cis_init(&cis_buf, &pjsip_TEL_PVALUE_SPEC);
  154|      1|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (154:5): [True: 0, False: 0]
  |  Branch (154:5): [True: 0, False: 0]
  ------------------
  155|      1|    pj_cis_add_alpha(&pjsip_TEL_PVALUE_SPEC);
  156|      1|    pj_cis_add_num(&pjsip_TEL_PVALUE_SPEC);
  157|      1|    pj_cis_add_str(&pjsip_TEL_PVALUE_SPEC, PARAM_CHAR);
  ------------------
  |  |   48|      1|#define PARAM_CHAR          PARAM_UNRESERVED UNRESERVED ESCAPED
  |  |  ------------------
  |  |  |  |   47|      1|#define PARAM_UNRESERVED    "[]/:&+$"
  |  |  ------------------
  |  |               #define PARAM_CHAR          PARAM_UNRESERVED UNRESERVED ESCAPED
  |  |  ------------------
  |  |  |  |   45|      1|#define ESCAPED             "%"
  |  |  ------------------
  ------------------
  158|       |
  159|      1|    status = pj_cis_dup(&pjsip_TEL_PVALUE_SPEC_ESC, &pjsip_TEL_PVALUE_SPEC);
  160|      1|    pj_cis_del_str(&pjsip_TEL_PVALUE_SPEC_ESC, "%");
  161|       |
  162|      1|    status = pj_cis_dup(&pjsip_TEL_PARSING_PVALUE_SPEC, &pjsip_TEL_URIC_SPEC);
  163|      1|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (163:5): [True: 0, False: 0]
  |  Branch (163:5): [True: 0, False: 0]
  ------------------
  164|      1|    pj_cis_add_cis(&pjsip_TEL_PARSING_PVALUE_SPEC, &pjsip_TEL_PVALUE_SPEC);
  165|      1|    pj_cis_add_str(&pjsip_TEL_PARSING_PVALUE_SPEC, "=");
  166|       |
  167|      1|    status = pj_cis_dup(&pjsip_TEL_PARSING_PVALUE_SPEC_ESC, 
  168|      1|                        &pjsip_TEL_PARSING_PVALUE_SPEC);
  169|      1|    pj_cis_del_str(&pjsip_TEL_PARSING_PVALUE_SPEC_ESC, "%");
  170|       |
  171|      1|    status = pjsip_register_uri_parser("tel", &tel_uri_parse);
  172|      1|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (172:5): [True: 0, False: 0]
  |  Branch (172:5): [True: 0, False: 0]
  ------------------
  173|       |
  174|      1|    return PJ_SUCCESS;
  175|      1|}
pjsip_tel_nb_cmp:
  230|    266|{
  231|    266|    const char *s1 = number1->ptr,
  232|    266|               *e1 = number1->ptr + number1->slen,
  233|    266|               *s2 = number2->ptr,
  234|    266|               *e2 = number2->ptr + number2->slen;
  235|       |
  236|       |    /* Compare each number, ignoreing visual separators. */
  237|  1.75k|    while (s1!=e1 && s2!=e2) {
  ------------------
  |  Branch (237:12): [True: 1.53k, False: 214]
  |  Branch (237:22): [True: 1.51k, False: 22]
  ------------------
  238|  1.51k|        int diff;
  239|       |
  240|  1.51k|        if (pj_cis_match(&pjsip_TEL_VISUAL_SEP_SPEC, *s1)) {
  ------------------
  |  Branch (240:13): [True: 314, False: 1.20k]
  ------------------
  241|    314|            ++s1;
  242|    314|            continue;
  243|    314|        }
  244|  1.20k|        if (pj_cis_match(&pjsip_TEL_VISUAL_SEP_SPEC, *s2)) {
  ------------------
  |  Branch (244:13): [True: 294, False: 906]
  ------------------
  245|    294|            ++s2;
  246|    294|            continue;
  247|    294|        }
  248|       |
  249|    906|        diff = pj_tolower(*s1) - pj_tolower(*s2);
  250|    906|        if (!diff) {
  ------------------
  |  Branch (250:13): [True: 876, False: 30]
  ------------------
  251|    876|            ++s1, ++s2;
  252|    876|            continue;
  253|    876|        } else
  254|     30|            return diff;
  255|    906|    }
  256|       |
  257|       |    /* Exhaust remaining visual separators. */
  258|    250|    while (s1!=e1 && pj_cis_match(&pjsip_TEL_VISUAL_SEP_SPEC, *s1))
  ------------------
  |  Branch (258:12): [True: 34, False: 216]
  |  Branch (258:22): [True: 14, False: 20]
  ------------------
  259|     14|        ++s1;
  260|    432|    while (s2!=e2 && pj_cis_match(&pjsip_TEL_VISUAL_SEP_SPEC, *s2))
  ------------------
  |  Branch (260:12): [True: 198, False: 234]
  |  Branch (260:22): [True: 196, False: 2]
  ------------------
  261|    196|        ++s2;
  262|       |
  263|    236|    if (s1==e1 && s2==e2)
  ------------------
  |  Branch (263:9): [True: 216, False: 20]
  |  Branch (263:19): [True: 214, False: 2]
  ------------------
  264|    214|        return 0;
  265|     22|    else if (s1==e1)
  ------------------
  |  Branch (265:14): [True: 2, False: 20]
  ------------------
  266|      2|        return -1;
  267|     20|    else
  268|     20|        return 1;
  269|    236|}
sip_tel_uri.c:tel_uri_cmp:
  274|    252|{
  275|    252|    int result;
  276|       |
  277|    252|    PJ_UNUSED_ARG(context);
  ------------------
  |  | 1537|    252|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  278|       |
  279|       |    /* Scheme must match. */
  280|    252|    if (url1->vptr != url2->vptr)
  ------------------
  |  Branch (280:9): [True: 2, False: 250]
  ------------------
  281|      2|        return -1;
  282|       |
  283|       |    /* Compare number. */
  284|    250|    result = pjsip_tel_nb_cmp(&url1->number, &url2->number);
  285|    250|    if (result != 0)
  ------------------
  |  Branch (285:9): [True: 50, False: 200]
  ------------------
  286|     50|        return result;
  287|       |
  288|       |    /* Compare phone-context as hostname or as as global nb. */
  289|    200|    if (url1->context.slen) {
  ------------------
  |  Branch (289:9): [True: 34, False: 166]
  ------------------
  290|     34|        if (*url1->context.ptr != '+')
  ------------------
  |  Branch (290:13): [True: 32, False: 2]
  ------------------
  291|     32|            result = pj_stricmp(&url1->context, &url2->context);
  292|      2|        else
  293|      2|            result = pjsip_tel_nb_cmp(&url1->context, &url2->context);
  294|       |
  295|     34|        if (result != 0)
  ------------------
  |  Branch (295:13): [True: 0, False: 34]
  ------------------
  296|      0|            return result;
  297|       |
  298|    166|    } else if (url2->context.slen)
  ------------------
  |  Branch (298:16): [True: 14, False: 152]
  ------------------
  299|     14|        return -1;
  300|       |
  301|       |    /* Compare extension. */
  302|    186|    if (url1->ext_param.slen) {
  ------------------
  |  Branch (302:9): [True: 14, False: 172]
  ------------------
  303|     14|        result = pjsip_tel_nb_cmp(&url1->ext_param, &url2->ext_param);
  304|     14|        if (result != 0)
  ------------------
  |  Branch (304:13): [True: 2, False: 12]
  ------------------
  305|      2|            return result;
  306|     14|    }
  307|       |
  308|       |    /* Compare isub bytes by bytes. */
  309|    184|    if (url1->isub_param.slen) {
  ------------------
  |  Branch (309:9): [True: 2, False: 182]
  ------------------
  310|      2|        result = pj_stricmp(&url1->isub_param, &url2->isub_param);
  311|      2|        if (result != 0)
  ------------------
  |  Branch (311:13): [True: 0, False: 2]
  ------------------
  312|      0|            return result;
  313|      2|    }
  314|       |
  315|       |    /* Other parameters are compared regardless of the order.
  316|       |     * If one URI has parameter not found in the other URI, the URIs are
  317|       |     * not equal.
  318|       |     */
  319|    184|    if (url1->other_param.next != &url1->other_param) {
  ------------------
  |  Branch (319:9): [True: 152, False: 32]
  ------------------
  320|    152|        const pjsip_param *p1, *p2;
  321|    152|        int cnt1 = 0, cnt2 = 0;
  322|       |
  323|    152|        p1 = url1->other_param.next;
  324|    856|        while (p1 != &url1->other_param) {
  ------------------
  |  Branch (324:16): [True: 806, False: 50]
  ------------------
  325|    806|            p2 = pjsip_param_cfind(&url2->other_param, &p1->name);
  326|    806|            if (!p2 )
  ------------------
  |  Branch (326:17): [True: 60, False: 746]
  ------------------
  327|     60|                return 1;
  328|       |
  329|    746|            result = pj_stricmp(&p1->value, &p2->value);
  330|    746|            if (result != 0)
  ------------------
  |  Branch (330:17): [True: 42, False: 704]
  ------------------
  331|     42|                return result;
  332|       |
  333|    704|            p1 = p1->next;
  334|    704|            ++cnt1;
  335|    704|        }
  336|       |
  337|     50|        p2 = url2->other_param.next;
  338|    690|        while (p2 != &url2->other_param)
  ------------------
  |  Branch (338:16): [True: 640, False: 50]
  ------------------
  339|    640|            ++cnt2, p2 = p2->next;
  340|       |
  341|     50|        if (cnt1 < cnt2)
  ------------------
  |  Branch (341:13): [True: 2, False: 48]
  ------------------
  342|      2|            return -1;
  343|     48|        else if (cnt1 > cnt2)
  ------------------
  |  Branch (343:18): [True: 14, False: 34]
  ------------------
  344|     14|            return 1;
  345|       |
  346|     50|    } else if (url2->other_param.next != &url2->other_param)
  ------------------
  |  Branch (346:16): [True: 2, False: 30]
  ------------------
  347|      2|        return -1;
  348|       |
  349|       |    /* Equal. */
  350|     64|    return 0;
  351|    184|}
sip_tel_uri.c:tel_uri_clone:
  355|    814|{
  356|    814|    pjsip_tel_uri *uri = pjsip_tel_uri_create(pool);
  357|       |
  358|    814|    pj_strdup(pool, &uri->number, &rhs->number);
  359|    814|    pj_strdup(pool, &uri->context, &rhs->context);
  360|    814|    pj_strdup(pool, &uri->ext_param, &rhs->ext_param);
  361|    814|    pj_strdup(pool, &uri->isub_param, &rhs->isub_param);
  362|    814|    pjsip_param_clone(pool, &uri->other_param, &rhs->other_param);
  363|       |
  364|    814|    return uri;
  365|    814|}
sip_tel_uri.c:tel_uri_parse:
  372|  1.76k|{
  373|  1.76k|    pjsip_tel_uri *uri;
  374|  1.76k|    pj_str_t token;
  375|  1.76k|    int skip_ws = scanner->skip_ws;
  376|  1.76k|    const pjsip_parser_const_t *pc = pjsip_parser_const();
  377|       |
  378|  1.76k|    scanner->skip_ws = 0;
  379|       |
  380|       |    /* Parse scheme. */
  381|  1.76k|    pj_scan_get(scanner, &pc->pjsip_TOKEN_SPEC, &token);
  382|  1.76k|    if (pj_scan_get_char(scanner) != ':')
  ------------------
  |  Branch (382:9): [True: 0, False: 1.76k]
  ------------------
  383|      0|        PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|      0|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
  384|  1.76k|    if (pj_stricmp_alnum(&token, &pc->pjsip_TEL_STR) != 0)
  ------------------
  |  |  408|  1.76k|#define pj_stricmp_alnum    pj_stricmp
  ------------------
  |  Branch (384:9): [True: 0, False: 1.76k]
  ------------------
  385|      0|        PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|      0|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
  386|       |
  387|       |    /* Create URI */
  388|  1.76k|    uri = pjsip_tel_uri_create(pool);
  389|       |
  390|       |    /* Get the phone number. */
  391|       |#if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0
  392|       |    pj_scan_get_unescape(scanner, &pjsip_TEL_NUMBER_SPEC, &uri->number);
  393|       |#else
  394|  1.76k|    pj_scan_get(scanner, &pjsip_TEL_NUMBER_SPEC, &uri->number);
  395|  1.76k|    uri->number = pj_str_unescape(pool, &uri->number);
  396|  1.76k|#endif
  397|       |
  398|       |    /* Get all parameters. */
  399|  1.76k|    if (parse_params && *scanner->curptr==';') {
  ------------------
  |  Branch (399:9): [True: 1.42k, False: 339]
  |  Branch (399:25): [True: 501, False: 921]
  ------------------
  400|    501|        pj_str_t pname, pvalue;
  401|       |
  402|  2.15k|        do {
  403|       |            /* Eat the ';' separator. */
  404|  2.15k|            pj_scan_get_char(scanner);
  405|       |
  406|       |            /* Get pname. */
  407|  2.15k|            pj_scan_get(scanner, &pc->pjsip_PARAM_CHAR_SPEC, &pname);
  408|       |
  409|  2.15k|            if (*scanner->curptr == '=') {
  ------------------
  |  Branch (409:17): [True: 338, False: 1.81k]
  ------------------
  410|    338|                pj_scan_get_char(scanner);
  411|       |
  412|       |#               if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0
  413|       |                    pj_scan_get_unescape(scanner, 
  414|       |                                         &pjsip_TEL_PARSING_PVALUE_SPEC_ESC,
  415|       |                                         &pvalue);
  416|       |#               else
  417|    338|                    pj_scan_get(scanner, &pjsip_TEL_PARSING_PVALUE_SPEC, 
  418|    338|                                &pvalue);
  419|    338|                    pvalue = pj_str_unescape(pool, &pvalue);
  420|    338|#               endif
  421|       |
  422|  1.81k|            } else {
  423|  1.81k|                pvalue.slen = 0;
  424|  1.81k|                pvalue.ptr = NULL;
  425|  1.81k|            }
  426|       |
  427|       |            /* Save the parameters. */
  428|  2.15k|            if (pj_stricmp_alnum(&pname, &pjsip_ISUB_STR)==0) {
  ------------------
  |  |  408|  2.15k|#define pj_stricmp_alnum    pj_stricmp
  ------------------
  |  Branch (428:17): [True: 197, False: 1.95k]
  ------------------
  429|    197|                uri->isub_param = pvalue;
  430|  1.95k|            } else if (pj_stricmp_alnum(&pname, &pjsip_EXT_STR)==0) {
  ------------------
  |  |  408|  1.95k|#define pj_stricmp_alnum    pj_stricmp
  ------------------
  |  Branch (430:24): [True: 207, False: 1.74k]
  ------------------
  431|    207|                uri->ext_param = pvalue;
  432|  1.74k|            } else if (pj_stricmp_alnum(&pname, &pjsip_PH_CTX_STR)==0) {
  ------------------
  |  |  408|  1.74k|#define pj_stricmp_alnum    pj_stricmp
  ------------------
  |  Branch (432:24): [True: 235, False: 1.51k]
  ------------------
  433|    235|                uri->context = pvalue;
  434|  1.51k|            } else {
  435|  1.51k|                pjsip_param *param = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  569|  1.51k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  436|  1.51k|                param->name = pname;
  437|  1.51k|                param->value = pvalue;
  438|  1.51k|                pj_list_insert_before(&uri->other_param, param);
  439|  1.51k|            }
  440|       |
  441|  2.15k|        } while (*scanner->curptr==';');
  ------------------
  |  Branch (441:18): [True: 1.64k, False: 501]
  ------------------
  442|    501|    }
  443|       |
  444|  1.76k|    scanner->skip_ws = skip_ws;
  445|  1.76k|    pj_scan_skip_whitespace(scanner);
  446|  1.76k|    return uri;
  447|  1.76k|}

pjsip_tsx_initialize_timer_values:
  473|      1|{
  474|      1|    t1_timer_val.sec  = pjsip_cfg()->tsx.t1 / 1000;
  475|      1|    t1_timer_val.msec = pjsip_cfg()->tsx.t1 % 1000;
  476|      1|    t2_timer_val.sec  = pjsip_cfg()->tsx.t2 / 1000;
  477|      1|    t2_timer_val.msec = pjsip_cfg()->tsx.t2 % 1000;
  478|      1|    t4_timer_val.sec  = pjsip_cfg()->tsx.t4 / 1000;
  479|      1|    t4_timer_val.msec = pjsip_cfg()->tsx.t4 % 1000;
  480|      1|    td_timer_val.sec  = pjsip_cfg()->tsx.td / 1000;
  481|      1|    td_timer_val.msec = pjsip_cfg()->tsx.td % 1000;
  482|      1|    timeout_timer_val = td_timer_val;
  483|      1|}
pjsip_tsx_layer_init_module:
  502|      1|{
  503|      1|    pj_pool_t *pool;
  504|      1|    pj_status_t status;
  505|       |
  506|       |
  507|      1|    PJ_ASSERT_RETURN(mod_tsx_layer.endpt==NULL, PJ_EINVALIDOP);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (507:5): [True: 0, False: 0]
  |  Branch (507:5): [True: 0, False: 0]
  ------------------
  508|       |
  509|       |    /* Initialize timer values */
  510|      1|    pjsip_tsx_initialize_timer_values();
  511|       |
  512|       |    /* Reset max retrans count (for library restart scenario) */
  513|      1|    max_retrans_count = -1;
  514|       |
  515|       |    /*
  516|       |     * Initialize transaction layer structure.
  517|       |     */
  518|       |
  519|       |    /* Create pool for the module. */
  520|      1|    pool = pjsip_endpt_create_pool(endpt, "tsxlayer", 
  521|      1|                                   PJSIP_POOL_TSX_LAYER_LEN,
  ------------------
  |  | 1081|      1|#   define PJSIP_POOL_TSX_LAYER_LEN     512
  ------------------
  522|      1|                                   PJSIP_POOL_TSX_LAYER_INC );
  ------------------
  |  | 1091|      1|#   define PJSIP_POOL_TSX_LAYER_INC     512
  ------------------
  523|      1|    if (!pool)
  ------------------
  |  Branch (523:9): [True: 0, False: 1]
  ------------------
  524|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  525|       |
  526|       |    
  527|       |    /* Initialize some attributes. */
  528|      1|    mod_tsx_layer.pool = pool;
  529|      1|    mod_tsx_layer.endpt = endpt;
  530|       |
  531|       |
  532|       |    /* Create hash table. */
  533|      1|    mod_tsx_layer.htable = pj_hash_create( pool, pjsip_cfg()->tsx.max_count );
  534|      1|    mod_tsx_layer.htable2 = pj_hash_create(pool, pjsip_cfg()->tsx.max_count);
  535|      1|    if (!mod_tsx_layer.htable || !mod_tsx_layer.htable2) {
  ------------------
  |  Branch (535:9): [True: 0, False: 1]
  |  Branch (535:34): [True: 0, False: 1]
  ------------------
  536|      0|        pjsip_endpt_release_pool(endpt, pool);
  537|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  538|      0|    }
  539|       |
  540|       |    /* Create group lock. */
  541|      1|    status = pj_mutex_create_recursive(pool, "tsxlayer", &mod_tsx_layer.mutex);
  542|      1|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (542:9): [True: 0, False: 1]
  ------------------
  543|      0|        pjsip_endpt_release_pool(endpt, pool);
  544|      0|        return status;
  545|      0|    }
  546|       |
  547|       |    /*
  548|       |     * Register transaction layer module to endpoint.
  549|       |     */
  550|      1|    status = pjsip_endpt_register_module( endpt, &mod_tsx_layer.mod );
  551|      1|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (551:9): [True: 0, False: 1]
  ------------------
  552|      0|        pj_mutex_destroy(mod_tsx_layer.mutex);
  553|      0|        pjsip_endpt_release_pool(endpt, pool);
  554|      0|        return status;
  555|      0|    }
  556|       |
  557|       |    /* Register mod_stateful_util module (sip_util_statefull.c) */
  558|      1|    status = pjsip_endpt_register_module(endpt, &mod_stateful_util);
  559|      1|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (559:9): [True: 0, False: 1]
  ------------------
  560|      0|        return status;
  561|      0|    }
  562|       |
  563|      1|    return PJ_SUCCESS;
  564|      1|}
sip_transaction.c:mod_tsx_layer_load:
  785|      1|{
  786|      1|    PJ_UNUSED_ARG(endpt);
  ------------------
  |  | 1537|      1|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  787|      1|    return PJ_SUCCESS;
  788|      1|}
sip_transaction.c:mod_tsx_layer_start:
  795|      1|{
  796|      1|    return PJ_SUCCESS;
  797|      1|}

pjsip_transport_get_flag_from_type:
  414|  2.98k|{
  415|       |    /* Return transport flag. */
  416|  2.98k|    return get_tpname(type)->flag;
  417|  2.98k|}
pjsip_transport_get_default_port_for_type:
  423|      1|{
  424|       |    /* Return the port. */
  425|      1|    return get_tpname(type)->port;
  426|      1|}
pjsip_tpselector_dec_ref:
  470|    605|{
  471|    605|    if (sel->type == PJSIP_TPSELECTOR_TRANSPORT && sel->u.transport != NULL)
  ------------------
  |  Branch (471:9): [True: 0, False: 605]
  |  Branch (471:52): [True: 0, False: 0]
  ------------------
  472|      0|        pjsip_transport_dec_ref(sel->u.transport);
  473|    605|    else if (sel->type == PJSIP_TPSELECTOR_LISTENER && sel->u.listener != NULL) {
  ------------------
  |  Branch (473:14): [True: 0, False: 605]
  |  Branch (473:56): [True: 0, False: 0]
  ------------------
  474|      0|        ; /* Hmm.. looks like we don't have reference counter for listener */
  475|      0|    }
  476|    605|}
pjsip_tx_data_create:
  490|    605|{
  491|    605|    pj_pool_t *pool;
  492|    605|    pjsip_tx_data *tdata;
  493|    605|    pj_status_t status;
  494|       |
  495|    605|    PJ_ASSERT_RETURN(mgr && p_tdata, PJ_EINVAL);
  ------------------
  |  |   97|    605|            do { \
  |  |   98|  1.21k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 605, False: 0]
  |  |  |  Branch (98:23): [True: 605, False: 0]
  |  |  ------------------
  |  |   99|    605|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 605]
  |  |  ------------------
  ------------------
  |  Branch (495:5): [True: 0, False: 0]
  |  Branch (495:5): [True: 0, False: 0]
  |  Branch (495:5): [True: 0, False: 0]
  |  Branch (495:5): [True: 0, False: 0]
  ------------------
  496|       |
  497|    605|    pool = pjsip_endpt_create_pool( mgr->endpt, "tdta%p",
  498|    605|                                    PJSIP_POOL_LEN_TDATA,
  ------------------
  |  | 1019|    605|#   define PJSIP_POOL_LEN_TDATA         4000
  ------------------
  499|    605|                                    PJSIP_POOL_INC_TDATA );
  ------------------
  |  | 1026|    605|#   define PJSIP_POOL_INC_TDATA         4000
  ------------------
  500|    605|    if (!pool)
  ------------------
  |  Branch (500:9): [True: 0, False: 605]
  ------------------
  501|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  502|       |
  503|    605|    tdata = PJ_POOL_ZALLOC_T(pool, pjsip_tx_data);
  ------------------
  |  |  583|    605|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  504|    605|    tdata->pool = pool;
  505|    605|    tdata->mgr = mgr;
  506|    605|    pj_ansi_snprintf(tdata->obj_name, sizeof(tdata->obj_name), "tdta%p", tdata);
  ------------------
  |  |  114|    605|#define pj_ansi_snprintf        snprintf
  ------------------
  507|    605|    pj_memcpy(pool->obj_name, tdata->obj_name, sizeof(pool->obj_name));
  508|       |
  509|    605|    status = pj_atomic_create(tdata->pool, 0, &tdata->ref_cnt);
  510|    605|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (510:9): [True: 0, False: 605]
  ------------------
  511|      0|        pjsip_endpt_release_pool( mgr->endpt, tdata->pool );
  512|      0|        return status;
  513|      0|    }
  514|       |    
  515|       |    //status = pj_lock_create_simple_mutex(pool, "tdta%p", &tdata->lock);
  516|    605|    status = pj_lock_create_null_mutex(pool, "tdta%p", &tdata->lock);
  517|    605|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (517:9): [True: 0, False: 605]
  ------------------
  518|      0|        pjsip_endpt_release_pool( mgr->endpt, tdata->pool );
  519|      0|        return status;
  520|      0|    }
  521|       |
  522|    605|    pj_ioqueue_op_key_init(&tdata->op_key.key, sizeof(tdata->op_key.key));
  523|    605|    pj_list_init(tdata);
  524|       |
  525|       |#if defined(PJSIP_HAS_TX_DATA_LIST) && PJSIP_HAS_TX_DATA_LIST!=0
  526|       |    /* Append this just created tdata to transmit buffer list */
  527|       |    pj_lock_acquire(mgr->lock);
  528|       |    pj_list_push_back(&mgr->tdata_list, tdata);
  529|       |    pj_lock_release(mgr->lock);
  530|       |#endif
  531|       |
  532|    605|#if defined(PJ_DEBUG) && PJ_DEBUG!=0
  533|    605|    pj_atomic_inc( tdata->mgr->tdata_counter );
  534|    605|#endif
  535|       |
  536|    605|    *p_tdata = tdata;
  537|    605|    return PJ_SUCCESS;
  538|    605|}
pjsip_tx_data_add_ref:
  545|    887|{
  546|    887|    pj_atomic_inc(tdata->ref_cnt);
  547|    887|}
pjsip_tx_data_dec_ref:
  575|    887|{
  576|    887|    pj_atomic_value_t ref_cnt;
  577|       |    
  578|    887|    PJ_ASSERT_RETURN(tdata && tdata->ref_cnt, PJ_EINVAL);
  ------------------
  |  |   97|    887|            do { \
  |  |   98|  1.77k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 887, False: 0]
  |  |  |  Branch (98:23): [True: 887, False: 0]
  |  |  ------------------
  |  |   99|    887|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 887]
  |  |  ------------------
  ------------------
  |  Branch (578:5): [True: 0, False: 0]
  |  Branch (578:5): [True: 0, False: 0]
  |  Branch (578:5): [True: 0, False: 0]
  |  Branch (578:5): [True: 0, False: 0]
  ------------------
  579|       |
  580|    887|    ref_cnt = pj_atomic_dec_and_get(tdata->ref_cnt);
  581|    887|    pj_assert( ref_cnt >= 0);
  ------------------
  |  |   65|    887|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (581:5): [True: 0, False: 887]
  |  Branch (581:5): [True: 887, False: 0]
  ------------------
  582|    887|    if (ref_cnt == 0) {
  ------------------
  |  Branch (582:9): [True: 605, False: 282]
  ------------------
  583|    605|        tx_data_destroy(tdata);
  584|    605|        return PJSIP_EBUFDESTROYED;
  ------------------
  |  |  221|    605|#define PJSIP_EBUFDESTROYED     (PJSIP_ERRNO_START_PJSIP + 63)  /* 171063 */
  |  |  ------------------
  |  |  |  |   73|    605|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    605|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|    605|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|    605|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|    605|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|    605|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|    605|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|    605|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|    605|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  585|    605|    } else {
  586|    282|        return PJ_SUCCESS;
  587|    282|    }
  588|    887|}
pjsip_tx_data_invalidate_msg:
  595|    282|{
  596|    282|    tdata->buf.cur = tdata->buf.start;
  597|       |    tdata->info = NULL;
  598|    282|}
pjsip_transport_register:
 1329|      1|{
 1330|      1|    int key_len;
 1331|      1|    pj_uint32_t hval;
 1332|      1|    transport *tp_ref = NULL;
 1333|      1|    transport *tp_add = NULL;
 1334|       |
 1335|       |    /* Init. */
 1336|      1|    tp->tpmgr = mgr;
 1337|      1|    pj_bzero(&tp->idle_timer, sizeof(tp->idle_timer));
 1338|      1|    tp->idle_timer.user_data = tp;
 1339|      1|    tp->idle_timer.cb = &transport_idle_callback;
 1340|       |
 1341|       |    /*
 1342|       |     * Register to hash table (see Trac ticket #42).
 1343|       |     */
 1344|      1|    key_len = sizeof(tp->key.type) + tp->addr_len;
 1345|      1|    pj_lock_acquire(mgr->lock);
 1346|       |
 1347|      1|    hval = 0;
 1348|      1|    tp_ref = (transport *)pj_hash_get(mgr->table, &tp->key, key_len, &hval);
 1349|       |
 1350|       |    /* Get an empty entry from the freelist. */
 1351|      1|    if (pj_list_empty(&mgr->tp_entry_freelist)) {
  ------------------
  |  Branch (1351:9): [True: 0, False: 1]
  ------------------
 1352|      0|        unsigned i = 0;
 1353|       |
 1354|      0|        TRACE_((THIS_FILE, "Transport list is full, allocate new entry"));
 1355|       |        /* Allocate new entry for the freelist. */
 1356|      0|        for (; i < PJSIP_TRANSPORT_ENTRY_ALLOC_CNT; ++i) {
  ------------------
  |  |  100|      0|#   define PJSIP_TRANSPORT_ENTRY_ALLOC_CNT  16
  ------------------
  |  Branch (1356:16): [True: 0, False: 0]
  ------------------
 1357|      0|            tp_add = PJ_POOL_ZALLOC_T(mgr->pool, transport);
  ------------------
  |  |  583|      0|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
 1358|      0|            if (!tp_add){
  ------------------
  |  Branch (1358:17): [True: 0, False: 0]
  ------------------
 1359|      0|                pj_lock_release(mgr->lock);
 1360|      0|                return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1361|      0|            }  
 1362|      0|            pj_list_init(tp_add);
 1363|      0|            pj_list_push_back(&mgr->tp_entry_freelist, tp_add);
 1364|      0|        }
 1365|      0|    }
 1366|      1|    tp_add = mgr->tp_entry_freelist.next;
 1367|      1|    tp_add->tp = tp;
 1368|      1|    pj_list_erase(tp_add);
 1369|       |
 1370|      1|    if (tp_ref) {
  ------------------
  |  Branch (1370:9): [True: 0, False: 1]
  ------------------
 1371|       |        /* There'a already a transport list from the hash table. Add the 
 1372|       |         * new transport to the list.
 1373|       |         */
 1374|      0|        pj_list_push_back(tp_ref, tp_add);
 1375|      0|        TRACE_((THIS_FILE, "Remote address already registered, "
 1376|      0|                           "appended the transport to the list"));
 1377|      1|    } else {
 1378|       |        /* Transport list not found, add it to the hash table. */
 1379|      1|        pj_hash_set_np(mgr->table, &tp->key, key_len, hval, tp_add->tp_buf,
 1380|      1|                       tp_add);
 1381|      1|        TRACE_((THIS_FILE, "Remote address not registered, "
 1382|      1|                           "added the transport to the hash"));
 1383|      1|    }
 1384|       |
 1385|       |    /* Add ref transport group lock, if any */
 1386|      1|    if (tp->grp_lock)
  ------------------
  |  Branch (1386:9): [True: 0, False: 1]
  ------------------
 1387|      0|        pj_grp_lock_add_ref(tp->grp_lock);
 1388|       |
 1389|      1|    pj_lock_release(mgr->lock);
 1390|       |
 1391|      1|    TRACE_((THIS_FILE, "Transport %s registered: type=%s, remote=%s:%d",
 1392|      1|            tp->obj_name,
 1393|      1|            pjsip_transport_get_type_name(tp->key.type),
 1394|      1|            pj_sockaddr_has_addr(&tp->key.rem_addr)?
 1395|      1|                                addr_string(&tp->key.rem_addr):"",
 1396|      1|            pj_sockaddr_has_addr(&tp->key.rem_addr)?
 1397|      1|                                pj_sockaddr_get_port(&tp->key.rem_addr):0));
 1398|       |
 1399|      1|    return PJ_SUCCESS;
 1400|      1|}
pjsip_tpmgr_create:
 1674|      1|{
 1675|      1|    pjsip_tpmgr *mgr;
 1676|      1|    pj_status_t status;
 1677|      1|    unsigned i = 0;
 1678|      1|    pj_pool_t *mgr_pool;
 1679|       |
 1680|      1|    PJ_ASSERT_RETURN(pool && endpt && rx_cb && p_mgr, PJ_EINVAL);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      6|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  |  Branch (98:23): [True: 1, False: 0]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (1680:5): [True: 0, False: 0]
  |  Branch (1680:5): [True: 0, False: 0]
  |  Branch (1680:5): [True: 0, False: 0]
  |  Branch (1680:5): [True: 0, False: 0]
  |  Branch (1680:5): [True: 0, False: 0]
  |  Branch (1680:5): [True: 0, False: 0]
  |  Branch (1680:5): [True: 0, False: 0]
  |  Branch (1680:5): [True: 0, False: 0]
  ------------------
 1681|       |
 1682|       |    /* Register mod_msg_print module. */
 1683|      1|    status = pjsip_endpt_register_module(endpt, &mod_msg_print);
 1684|      1|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (1684:9): [True: 0, False: 1]
  ------------------
 1685|      0|        return status;
 1686|       |
 1687|       |    /* Create and initialize transport manager. */
 1688|      1|    mgr_pool = pjsip_endpt_create_pool(endpt, "tpmgr",
 1689|      1|                                       TPMGR_POOL_INIT_SIZE,
  ------------------
  |  |   86|      1|#   define TPMGR_POOL_INIT_SIZE 1000
  ------------------
 1690|      1|                                       TPMGR_POOL_INC_SIZE);
  ------------------
  |  |   91|      1|    #define TPMGR_POOL_INC_SIZE 1000
  ------------------
 1691|      1|    mgr = PJ_POOL_ZALLOC_T(mgr_pool, pjsip_tpmgr);
  ------------------
  |  |  583|      1|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
 1692|      1|    mgr->endpt = endpt;
 1693|      1|    mgr->on_rx_msg = rx_cb;
 1694|      1|    mgr->on_tx_msg = tx_cb;
 1695|      1|    mgr->pool = mgr_pool;
 1696|       |
 1697|      1|    if (!mgr->pool)
  ------------------
  |  Branch (1697:9): [True: 0, False: 1]
  ------------------
 1698|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1699|       |
 1700|      1|    pj_list_init(&mgr->factory_list);
 1701|      1|    pj_list_init(&mgr->tdata_list);
 1702|      1|    pj_list_init(&mgr->tp_entry_freelist);
 1703|       |
 1704|      1|    mgr->table = pj_hash_create(mgr->pool, PJSIP_TPMGR_HTABLE_SIZE);
  ------------------
  |  |  346|      1|#   define PJSIP_TPMGR_HTABLE_SIZE      31
  ------------------
 1705|      1|    if (!mgr->table)
  ------------------
  |  Branch (1705:9): [True: 0, False: 1]
  ------------------
 1706|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1707|       |
 1708|      1|    status = pj_lock_create_recursive_mutex(mgr->pool, "tmgr%p", &mgr->lock);
 1709|      1|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (1709:9): [True: 0, False: 1]
  ------------------
 1710|      0|        return status;
 1711|       |
 1712|     17|    for (; i < PJSIP_TRANSPORT_ENTRY_ALLOC_CNT; ++i) {
  ------------------
  |  |  100|     17|#   define PJSIP_TRANSPORT_ENTRY_ALLOC_CNT  16
  ------------------
  |  Branch (1712:12): [True: 16, False: 1]
  ------------------
 1713|     16|        transport *tp_add = NULL;
 1714|       |
 1715|     16|        tp_add = PJ_POOL_ZALLOC_T(mgr->pool, transport);
  ------------------
  |  |  583|     16|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
 1716|     16|        if (!tp_add)
  ------------------
  |  Branch (1716:13): [True: 0, False: 16]
  ------------------
 1717|      0|            return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1718|     16|        pj_list_init(tp_add);
 1719|     16|        pj_list_push_back(&mgr->tp_entry_freelist, tp_add);
 1720|     16|    }
 1721|       |
 1722|      1|#if defined(PJ_DEBUG) && PJ_DEBUG!=0
 1723|      1|    status = pj_atomic_create(mgr->pool, 0, &mgr->tdata_counter);
 1724|      1|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (1724:9): [True: 0, False: 1]
  ------------------
 1725|      0|        pj_lock_destroy(mgr->lock);
 1726|      0|        return status;
 1727|      0|    }
 1728|      1|#endif
 1729|       |
 1730|       |    /* Set transport state callback */
 1731|      1|    pjsip_tpmgr_set_state_cb(mgr, &tp_state_callback);
 1732|       |
 1733|      1|    PJ_LOG(5, (THIS_FILE, "Transport manager created."));
  ------------------
  |  |  106|      1|#define PJ_LOG(level,arg)       do { \
  |  |  107|      1|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      2|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 1, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 1]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  496|      0|    #define pj_log_wrapper_5(arg)       pj_log_5 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      1|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1734|       |
 1735|      1|    *p_mgr = mgr;
 1736|      1|    return PJ_SUCCESS;
 1737|      1|}
pjsip_tpmgr_acquire_transport:
 2492|  2.98k|{
 2493|  2.98k|    return pjsip_tpmgr_acquire_transport2(mgr, type, remote, addr_len, sel,
 2494|       |                                          NULL, tp);
 2495|  2.98k|}
pjsip_tpmgr_acquire_transport2:
 2511|  2.98k|{
 2512|  2.98k|    pjsip_tpfactory *factory;
 2513|  2.98k|    pj_status_t status;
 2514|       |
 2515|  2.98k|    TRACE_((THIS_FILE, "Acquiring transport type=%s, sel=%s remote=%s:%d "
 2516|  2.98k|                       "(%.*s)",
 2517|  2.98k|                       pjsip_transport_get_type_name(type),
 2518|  2.98k|                       print_tpsel_info(sel),
 2519|  2.98k|                       addr_string(remote),
 2520|  2.98k|                       pj_sockaddr_get_port(remote),
 2521|  2.98k|                       tdata? tdata->dest_info.name.slen : 10,
 2522|  2.98k|                       tdata? tdata->dest_info.name.ptr  : "-no tdata-"));
 2523|       |
 2524|  2.98k|    pj_lock_acquire(mgr->lock);
 2525|       |
 2526|  2.98k|    TRACE_((THIS_FILE, "Acquiring transport got the lock"));
 2527|       |
 2528|       |    /* If transport is specified, then just use it if it is suitable
 2529|       |     * for the destination.
 2530|       |     */
 2531|  2.98k|    if (sel && sel->type == PJSIP_TPSELECTOR_TRANSPORT &&
  ------------------
  |  Branch (2531:9): [True: 0, False: 2.98k]
  |  Branch (2531:16): [True: 0, False: 0]
  ------------------
 2532|      0|        sel->u.transport) 
  ------------------
  |  Branch (2532:9): [True: 0, False: 0]
  ------------------
 2533|      0|    {
 2534|      0|        pjsip_transport *seltp = sel->u.transport;
 2535|       |
 2536|       |        /* See if the transport is (not) suitable */
 2537|      0|        if (seltp->key.type != type) {
  ------------------
  |  Branch (2537:13): [True: 0, False: 0]
  ------------------
 2538|      0|            pj_lock_release(mgr->lock);
 2539|      0|            TRACE_((THIS_FILE, "Transport type in tpsel not matched"));
 2540|      0|            return PJSIP_ETPNOTSUITABLE;
  ------------------
  |  |  229|      0|#define PJSIP_ETPNOTSUITABLE    (PJSIP_ERRNO_START_PJSIP + 64)  /* 171064 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2541|      0|        }
 2542|       |
 2543|       |        /* Make sure the transport is not being destroyed */
 2544|      0|        if (seltp->is_destroying) {
  ------------------
  |  Branch (2544:13): [True: 0, False: 0]
  ------------------
 2545|      0|            pj_lock_release(mgr->lock);
 2546|      0|            TRACE_((THIS_FILE,"Transport to be acquired is being destroyed"));
 2547|      0|            return PJ_ENOTFOUND;
  ------------------
  |  |  403|      0|#define PJ_ENOTFOUND        (PJ_ERRNO_START_STATUS + 6) /* 70006 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2548|      0|        }
 2549|       |
 2550|       |        /* We could also verify that the destination address is reachable
 2551|       |         * from this transport (i.e. both are equal), but if application
 2552|       |         * has requested a specific transport to be used, assume that
 2553|       |         * it knows what to do.
 2554|       |         *
 2555|       |         * In other words, I don't think destination verification is a good
 2556|       |         * idea for now.
 2557|       |         */
 2558|       |
 2559|       |        /* Transport looks to be suitable to use, so just use it. */
 2560|      0|        pjsip_transport_add_ref(seltp);
 2561|      0|        pj_lock_release(mgr->lock);
 2562|      0|        *tp = seltp;
 2563|       |
 2564|      0|        TRACE_((THIS_FILE, "Transport %s acquired", seltp->obj_name));
 2565|      0|        return PJ_SUCCESS;
 2566|       |
 2567|  2.98k|    } else {
 2568|       |
 2569|       |        /*
 2570|       |         * This is the "normal" flow, where application doesn't specify
 2571|       |         * specific transport to be used to send message to.
 2572|       |         * In this case, lookup the transport from the hash table.
 2573|       |         */
 2574|  2.98k|        pjsip_transport_key key;
 2575|  2.98k|        int key_len;
 2576|  2.98k|        pjsip_transport *tp_ref = NULL;
 2577|  2.98k|        transport *tp_entry = NULL;
 2578|  2.98k|        unsigned flag = pjsip_transport_get_flag_from_type(type);
 2579|       |
 2580|       |        /* If listener is specified, verify that the listener type matches
 2581|       |         * the destination type.
 2582|       |         */
 2583|  2.98k|        if (sel && sel->type == PJSIP_TPSELECTOR_LISTENER && sel->u.listener)
  ------------------
  |  Branch (2583:13): [True: 0, False: 2.98k]
  |  Branch (2583:20): [True: 0, False: 0]
  |  Branch (2583:62): [True: 0, False: 0]
  ------------------
 2584|      0|        {
 2585|      0|            if (sel->u.listener->type != type) {
  ------------------
  |  Branch (2585:17): [True: 0, False: 0]
  ------------------
 2586|      0|                pj_lock_release(mgr->lock);
 2587|      0|                TRACE_((THIS_FILE, "Listener type in tpsel not matched"));
 2588|      0|                return PJSIP_ETPNOTSUITABLE;
  ------------------
  |  |  229|      0|#define PJSIP_ETPNOTSUITABLE    (PJSIP_ERRNO_START_PJSIP + 64)  /* 171064 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2589|      0|            }
 2590|  2.98k|        } else if (sel && sel->type == PJSIP_TPSELECTOR_IP_VER) {
  ------------------
  |  Branch (2590:20): [True: 0, False: 2.98k]
  |  Branch (2590:27): [True: 0, False: 0]
  ------------------
 2591|      0|            if ((sel->u.ip_ver == PJSIP_TPSELECTOR_USE_IPV4_ONLY &&
  ------------------
  |  Branch (2591:18): [True: 0, False: 0]
  ------------------
 2592|      0|                 pjsip_transport_type_get_af(type) != pj_AF_INET()) ||
  ------------------
  |  |  113|      0|#   define pj_AF_INET()     PJ_AF_INET
  ------------------
  |  Branch (2592:18): [True: 0, False: 0]
  ------------------
 2593|      0|                (sel->u.ip_ver == PJSIP_TPSELECTOR_USE_IPV6_ONLY &&
  ------------------
  |  Branch (2593:18): [True: 0, False: 0]
  ------------------
 2594|      0|                 pjsip_transport_type_get_af(type) != pj_AF_INET6()))
  ------------------
  |  |  115|      0|#   define pj_AF_INET6()    PJ_AF_INET6
  ------------------
  |  Branch (2594:18): [True: 0, False: 0]
  ------------------
 2595|      0|            {
 2596|      0|                pj_lock_release(mgr->lock);
 2597|      0|                TRACE_((THIS_FILE, "Address type in tpsel not matched"));
 2598|      0|                return PJSIP_ETPNOTSUITABLE;
  ------------------
  |  |  229|      0|#define PJSIP_ETPNOTSUITABLE    (PJSIP_ERRNO_START_PJSIP + 64)  /* 171064 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2599|      0|            }
 2600|      0|        }
 2601|       |
 2602|  2.98k|        if (!sel || sel->disable_connection_reuse == PJ_FALSE) {
  ------------------
  |  Branch (2602:13): [True: 2.98k, False: 0]
  |  Branch (2602:21): [True: 0, False: 0]
  ------------------
 2603|  2.98k|            pj_bzero(&key, sizeof(key));
 2604|  2.98k|            key_len = sizeof(key.type) + addr_len;
 2605|       |
 2606|  2.98k|            TRACE_((THIS_FILE, "Search transport by remote address"));
 2607|       |
 2608|       |            /* First try to get exact destination. */
 2609|  2.98k|            key.type = type;
 2610|  2.98k|            pj_memcpy(&key.rem_addr, remote, addr_len);
 2611|       |
 2612|  2.98k|            tp_entry = (transport *)pj_hash_get(mgr->table, &key, key_len,
 2613|  2.98k|                                                NULL);
 2614|  2.98k|            if (tp_entry) {
  ------------------
  |  Branch (2614:17): [True: 0, False: 2.98k]
  ------------------
 2615|      0|                transport *tp_iter = tp_entry;
 2616|       |
 2617|      0|                TRACE_((THIS_FILE, "Found one, checking further (e.g: "
 2618|      0|                                   "destroying, verify hostname, etc).."));
 2619|       |
 2620|      0|                do {
 2621|       |                    /* Don't use transport being shutdown/destroyed */
 2622|      0|                    if (!tp_iter->tp->is_shutdown &&
  ------------------
  |  Branch (2622:25): [True: 0, False: 0]
  ------------------
 2623|      0|                        !tp_iter->tp->is_destroying)
  ------------------
  |  Branch (2623:25): [True: 0, False: 0]
  ------------------
 2624|      0|                    {
 2625|      0|                        if ((flag & PJSIP_TRANSPORT_SECURE) && tdata) {
  ------------------
  |  Branch (2625:29): [True: 0, False: 0]
  |  Branch (2625:64): [True: 0, False: 0]
  ------------------
 2626|       |                            /* For secure transport, make sure tdata's
 2627|       |                             * destination host matches the transport's
 2628|       |                             * remote host.
 2629|       |                             */
 2630|      0|                            if (pj_stricmp(&tdata->dest_info.name,
  ------------------
  |  Branch (2630:33): [True: 0, False: 0]
  ------------------
 2631|      0|                                           &tp_iter->tp->remote_name.host))
 2632|      0|                            {
 2633|      0|                                TRACE_((THIS_FILE, "Skipping secure transport "
 2634|      0|                                                   "with different hostname"));
 2635|      0|                                tp_iter = tp_iter->next;
 2636|      0|                                continue;
 2637|      0|                            }
 2638|      0|                        }
 2639|       |
 2640|      0|                        if (sel && sel->type == PJSIP_TPSELECTOR_LISTENER &&
  ------------------
  |  Branch (2640:29): [True: 0, False: 0]
  |  Branch (2640:36): [True: 0, False: 0]
  ------------------
 2641|      0|                            sel->u.listener)
  ------------------
  |  Branch (2641:29): [True: 0, False: 0]
  ------------------
 2642|      0|                        {
 2643|       |                            /* Match listener if selector is set */
 2644|      0|                            if (tp_iter->tp->factory == sel->u.listener) {
  ------------------
  |  Branch (2644:33): [True: 0, False: 0]
  ------------------
 2645|      0|                                tp_ref = tp_iter->tp;
 2646|      0|                                break;
 2647|      0|                            }
 2648|      0|                            TRACE_((THIS_FILE, "Skipping transport "
 2649|      0|                                               "with different listener"));
 2650|      0|                        } else {
 2651|      0|                            tp_ref = tp_iter->tp;
 2652|      0|                            break;
 2653|      0|                        }
 2654|      0|                    }
 2655|      0|                    tp_iter = tp_iter->next;
 2656|      0|                } while (tp_iter != tp_entry);
  ------------------
  |  Branch (2656:26): [True: 0, False: 0]
  ------------------
 2657|       |
 2658|      0|                TRACE_((THIS_FILE, "Search by remote address found %s",
 2659|      0|                                   tp_ref? "one" : "none"));
 2660|      0|            }
 2661|  2.98k|        }
 2662|       |
 2663|  2.98k|        if (tp_ref == NULL &&
  ------------------
  |  Branch (2663:13): [True: 2.98k, False: 0]
  ------------------
 2664|  2.98k|            (!sel || sel->disable_connection_reuse == PJ_FALSE))
  ------------------
  |  Branch (2664:14): [True: 2.98k, False: 0]
  |  Branch (2664:22): [True: 0, False: 0]
  ------------------
 2665|  2.98k|        {
 2666|  2.98k|            const pj_sockaddr *remote_addr = (const pj_sockaddr*)remote;
 2667|       |
 2668|  2.98k|            TRACE_((THIS_FILE, "Search loop & datagram transports "
 2669|  2.98k|                               "with address zero"));
 2670|       |
 2671|       |            /* Ignore address for loop transports. */
 2672|  2.98k|            if (type == PJSIP_TRANSPORT_LOOP ||
  ------------------
  |  Branch (2672:17): [True: 0, False: 2.98k]
  ------------------
 2673|  2.98k|                type == PJSIP_TRANSPORT_LOOP_DGRAM)
  ------------------
  |  Branch (2673:17): [True: 0, False: 2.98k]
  ------------------
 2674|      0|            {
 2675|      0|                pj_sockaddr *addr = &key.rem_addr;
 2676|       |
 2677|      0|                pj_bzero(addr, addr_len);
 2678|      0|                key_len = sizeof(key.type) + addr_len;
 2679|      0|                tp_entry = (transport *) pj_hash_get(mgr->table, &key,
 2680|      0|                                                     key_len, NULL);
 2681|      0|                if (tp_entry) {
  ------------------
  |  Branch (2681:21): [True: 0, False: 0]
  ------------------
 2682|      0|                    tp_ref = tp_entry->tp;
 2683|      0|                }
 2684|      0|            }
 2685|       |            /* For datagram transports, try lookup with zero address.
 2686|       |             */
 2687|  2.98k|            else if (flag & PJSIP_TRANSPORT_DATAGRAM)
  ------------------
  |  Branch (2687:22): [True: 2.98k, False: 0]
  ------------------
 2688|  2.98k|            {
 2689|  2.98k|                pj_sockaddr *addr = &key.rem_addr;
 2690|       |
 2691|  2.98k|                pj_bzero(addr, addr_len);
 2692|  2.98k|                addr->addr.sa_family = remote_addr->addr.sa_family;
 2693|       |
 2694|  2.98k|                key_len = sizeof(key.type) + addr_len;
 2695|  2.98k|                tp_entry = (transport *) pj_hash_get(mgr->table, &key,
 2696|  2.98k|                                                     key_len, NULL);
 2697|  2.98k|                if (tp_entry) {
  ------------------
  |  Branch (2697:21): [True: 0, False: 2.98k]
  ------------------
 2698|      0|                    transport *tp_iter = tp_entry;
 2699|      0|                    do {
 2700|      0|                        tp_ref = tp_iter->tp;
 2701|      0|                        if (!tp_ref->is_shutdown && !tp_ref->is_destroying)
  ------------------
  |  Branch (2701:29): [True: 0, False: 0]
  |  Branch (2701:53): [True: 0, False: 0]
  ------------------
 2702|      0|                            break;
 2703|      0|                        tp_iter = tp_iter->next;
 2704|      0|                    } while (tp_iter != tp_entry);
  ------------------
  |  Branch (2704:30): [True: 0, False: 0]
  ------------------
 2705|      0|                }
 2706|  2.98k|            }
 2707|       |
 2708|  2.98k|            TRACE_((THIS_FILE, "Search loop & datagram transports found %s",
 2709|  2.98k|                               tp_ref? "one" : "none"));
 2710|  2.98k|        }
 2711|       |
 2712|       |        /* If transport is found and listener is specified, verify listener */
 2713|      0|        else if (sel && sel->type == PJSIP_TPSELECTOR_LISTENER &&
  ------------------
  |  Branch (2713:18): [True: 0, False: 0]
  |  Branch (2713:25): [True: 0, False: 0]
  ------------------
 2714|      0|                 sel->u.listener && tp_ref && tp_ref->factory != sel->u.listener)
  ------------------
  |  Branch (2714:18): [True: 0, False: 0]
  |  Branch (2714:37): [True: 0, False: 0]
  |  Branch (2714:47): [True: 0, False: 0]
  ------------------
 2715|      0|        {
 2716|      0|            tp_ref = NULL;
 2717|       |            /* This will cause a new transport to be created which will be a
 2718|       |             * 'duplicate' of the existing transport (same type & remote addr,
 2719|       |             * but different factory).
 2720|       |             */
 2721|      0|            TRACE_((THIS_FILE, "Transport found but from different listener"));
 2722|      0|        }
 2723|       |
 2724|  2.98k|        if (tp_ref!=NULL && !tp_ref->is_shutdown && !tp_ref->is_destroying) {
  ------------------
  |  Branch (2724:13): [True: 0, False: 2.98k]
  |  Branch (2724:29): [True: 0, False: 0]
  |  Branch (2724:53): [True: 0, False: 0]
  ------------------
 2725|       |            /*
 2726|       |             * Transport found!
 2727|       |             */
 2728|      0|            pjsip_transport_add_ref(tp_ref);
 2729|      0|            pj_lock_release(mgr->lock);
 2730|      0|            *tp = tp_ref;
 2731|       |
 2732|      0|            TRACE_((THIS_FILE, "Transport %s acquired", tp_ref->obj_name));
 2733|      0|            return PJ_SUCCESS;
 2734|      0|        }
 2735|       |
 2736|       |
 2737|       |        /*
 2738|       |         * Either transport not found, or we don't want to use the existing
 2739|       |         * transport (such as in the case of different factory or
 2740|       |         * if connection reuse is disabled). So we need to create one,
 2741|       |         * find factory that can create such transport.
 2742|       |         *
 2743|       |         * If there's an existing transport, its place in the hash table
 2744|       |         * will be replaced by this new one. And eventually the existing
 2745|       |         * transport will still be freed (by application or #1774).
 2746|       |         */
 2747|  2.98k|        if (sel && sel->type == PJSIP_TPSELECTOR_LISTENER && sel->u.listener)
  ------------------
  |  Branch (2747:13): [True: 0, False: 2.98k]
  |  Branch (2747:20): [True: 0, False: 0]
  |  Branch (2747:62): [True: 0, False: 0]
  ------------------
 2748|      0|        {
 2749|       |            /* Application has requested that a specific listener is to
 2750|       |             * be used.
 2751|       |             */
 2752|       |
 2753|       |            /* Verify that the listener type matches the destination type */
 2754|       |            /* Already checked above. */
 2755|       |            /*
 2756|       |            if (sel->u.listener->type != type) {
 2757|       |                pj_lock_release(mgr->lock);
 2758|       |                return PJSIP_ETPNOTSUITABLE;
 2759|       |            }
 2760|       |            */
 2761|       |
 2762|       |            /* We'll use this listener to create transport */
 2763|      0|            factory = sel->u.listener;
 2764|       |
 2765|       |            /* Verify if listener is still valid */
 2766|      0|            if (!pjsip_tpmgr_is_tpfactory_valid(mgr, factory)) {
  ------------------
  |  Branch (2766:17): [True: 0, False: 0]
  ------------------
 2767|      0|                pj_lock_release(mgr->lock);
 2768|      0|                PJ_LOG(3,(THIS_FILE, "Specified factory for creating "
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|      0|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  464|      0|    #define pj_log_wrapper_3(arg)       pj_log_3 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2769|      0|                                     "transport is not found"));
 2770|      0|                return PJ_ENOTFOUND;
  ------------------
  |  |  403|      0|#define PJ_ENOTFOUND        (PJ_ERRNO_START_STATUS + 6) /* 70006 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2771|      0|            }
 2772|       |
 2773|  2.98k|        } else {
 2774|       |
 2775|       |            /* Find factory with type matches the destination type */
 2776|  2.98k|            factory = mgr->factory_list.next;
 2777|  2.98k|            while (factory != &mgr->factory_list) {
  ------------------
  |  Branch (2777:20): [True: 0, False: 2.98k]
  ------------------
 2778|      0|                if (factory->type == type)
  ------------------
  |  Branch (2778:21): [True: 0, False: 0]
  ------------------
 2779|      0|                    break;
 2780|      0|                factory = factory->next;
 2781|      0|            }
 2782|       |
 2783|  2.98k|            if (factory == &mgr->factory_list) {
  ------------------
  |  Branch (2783:17): [True: 2.98k, False: 0]
  ------------------
 2784|       |                /* No factory can create the transport! */
 2785|  2.98k|                pj_lock_release(mgr->lock);
 2786|  2.98k|                TRACE_((THIS_FILE, "No suitable factory was found either"));
 2787|  2.98k|                return PJSIP_EUNSUPTRANSPORT;
  ------------------
  |  |  205|  2.98k|#define PJSIP_EUNSUPTRANSPORT   (PJSIP_ERRNO_START_PJSIP + 60)  /* 171060 */
  |  |  ------------------
  |  |  |  |   73|  2.98k|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  2.98k|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  2.98k|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|  2.98k|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|  2.98k|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|  2.98k|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|  2.98k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|  2.98k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|  2.98k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2788|  2.98k|            }
 2789|  2.98k|        }
 2790|  2.98k|    }
 2791|       |
 2792|      0|    TRACE_((THIS_FILE, "Creating new transport from factory"));
 2793|       |
 2794|       |    /* Request factory to create transport. */
 2795|      0|    if (factory->create_transport2) {
  ------------------
  |  Branch (2795:9): [True: 0, False: 0]
  ------------------
 2796|      0|        status = factory->create_transport2(factory, mgr, mgr->endpt,
 2797|      0|                                            (const pj_sockaddr*) remote,
 2798|      0|                                            addr_len, tdata, tp);
 2799|      0|    } else {
 2800|      0|        status = factory->create_transport(factory, mgr, mgr->endpt,
 2801|      0|                                           (const pj_sockaddr*) remote,
 2802|      0|                                           addr_len, tp);
 2803|      0|    }
 2804|      0|    if (status == PJ_SUCCESS) {
  ------------------
  |  Branch (2804:9): [True: 0, False: 0]
  ------------------
 2805|      0|        PJ_ASSERT_ON_FAIL(tp!=NULL,
  ------------------
  |  |  111|      0|            { \
  |  |  112|      0|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  113|      0|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (113:21): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            }
  ------------------
  |  Branch (2805:9): [True: 0, False: 0]
  |  Branch (2805:9): [True: 0, False: 0]
  ------------------
 2806|      0|            {pj_lock_release(mgr->lock); return PJ_EBUG;});
 2807|      0|        pjsip_transport_add_ref(*tp);
 2808|      0|        (*tp)->factory = factory;
 2809|      0|    }
 2810|      0|    pj_lock_release(mgr->lock);
 2811|      0|    return status;
 2812|      0|}
pjsip_tpmgr_set_state_cb:
 2882|      1|{
 2883|      1|    PJ_ASSERT_RETURN(mgr, PJ_EINVAL);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (2883:5): [True: 0, False: 0]
  |  Branch (2883:5): [True: 0, False: 0]
  ------------------
 2884|       |
 2885|      1|    mgr->tp_state_cb = cb;
 2886|       |
 2887|      1|    return PJ_SUCCESS;
 2888|      1|}
sip_transport.c:get_tpname:
  301|  2.99k|{
  302|  2.99k|    unsigned i;
  303|  5.98k|    for (i=0; i<PJ_ARRAY_SIZE(transport_names); ++i) {
  ------------------
  |  |  315|  5.98k|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (303:15): [True: 5.98k, False: 0]
  ------------------
  304|  5.98k|        if (transport_names[i].type == type)
  ------------------
  |  Branch (304:13): [True: 2.99k, False: 2.99k]
  ------------------
  305|  2.99k|            return &transport_names[i];
  306|  5.98k|    }
  307|      0|    pj_assert(!"Invalid transport type!");
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (307:5): [Folded, False: 0]
  |  Branch (307:5): [Folded, False: 0]
  ------------------
  308|      0|    return NULL;
  309|      0|}
sip_transport.c:tx_data_destroy:
  550|    605|{
  551|    605|    PJ_LOG(5,(tdata->obj_name, "Destroying txdata %s",
  ------------------
  |  |  106|    605|#define PJ_LOG(level,arg)       do { \
  |  |  107|    605|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|  1.21k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 605, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 605]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  496|      0|    #define pj_log_wrapper_5(arg)       pj_log_5 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|    605|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 605]
  |  |  ------------------
  ------------------
  552|    605|              pjsip_tx_data_get_info(tdata)));
  553|    605|    pjsip_tpselector_dec_ref(&tdata->tp_sel);
  554|    605|#if defined(PJ_DEBUG) && PJ_DEBUG!=0
  555|    605|    pj_atomic_dec( tdata->mgr->tdata_counter );
  556|    605|#endif
  557|       |
  558|       |#if defined(PJSIP_HAS_TX_DATA_LIST) && PJSIP_HAS_TX_DATA_LIST!=0
  559|       |    /* Remove this tdata from transmit buffer list */
  560|       |    pj_lock_acquire(tdata->mgr->lock);
  561|       |    pj_list_erase(tdata);
  562|       |    pj_lock_release(tdata->mgr->lock);
  563|       |#endif
  564|       |
  565|    605|    pj_atomic_destroy( tdata->ref_cnt );
  566|    605|    pj_lock_destroy( tdata->lock );
  567|    605|    pjsip_endpt_release_pool( tdata->mgr->endpt, tdata->pool );
  568|    605|}

pjsip_loop_start:
  356|      1|{
  357|      1|    pj_pool_t *pool;
  358|      1|    struct loop_transport *loop;
  359|      1|    pj_status_t status;
  360|       |
  361|       |    /* Create pool. */
  362|      1|    pool = pjsip_endpt_create_pool(endpt, "loop", 4000, 4000);
  363|      1|    if (!pool)
  ------------------
  |  Branch (363:9): [True: 0, False: 1]
  ------------------
  364|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  365|       |
  366|       |    /* Create the loop structure. */
  367|      1|    loop = PJ_POOL_ZALLOC_T(pool, struct loop_transport);
  ------------------
  |  |  583|      1|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  368|       |    
  369|       |    /* Initialize transport properties. */
  370|      1|    pj_ansi_snprintf(loop->base.obj_name, sizeof(loop->base.obj_name), 
  ------------------
  |  |  114|      1|#define pj_ansi_snprintf        snprintf
  ------------------
  371|      1|                     "loop%p", loop);
  372|      1|    loop->base.pool = pool;
  373|      1|    status = pj_atomic_create(pool, 0, &loop->base.ref_cnt);
  374|      1|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (374:9): [True: 0, False: 1]
  ------------------
  375|      0|        goto on_error;
  376|      1|    status = pj_lock_create_recursive_mutex(pool, "loop", &loop->base.lock);
  377|      1|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (377:9): [True: 0, False: 1]
  ------------------
  378|      0|        goto on_error;
  379|      1|    loop->base.key.type = PJSIP_TRANSPORT_LOOP_DGRAM;
  380|       |    //loop->base.key.rem_addr.addr.sa_family = pj_AF_INET();
  381|      1|    loop->base.type_name = "LOOP-DGRAM";
  382|      1|    loop->base.info = "LOOP-DGRAM";
  383|      1|    loop->base.flag = PJSIP_TRANSPORT_DATAGRAM;
  384|      1|    loop->base.local_name.host = pj_str(ADDR_LOOP_DGRAM);
  ------------------
  |  |   31|      1|#define ADDR_LOOP_DGRAM "129.0.0.1"
  ------------------
  385|      1|    loop->base.local_name.port = 
  386|      1|        pjsip_transport_get_default_port_for_type((pjsip_transport_type_e)
  387|      1|                                                  loop->base.key.type);
  388|      1|    loop->base.addr_len = sizeof(pj_sockaddr_in);
  389|      1|    loop->base.dir = PJSIP_TP_DIR_NONE;
  390|      1|    loop->base.endpt = endpt;
  391|      1|    loop->base.tpmgr = pjsip_endpt_get_tpmgr(endpt);
  392|      1|    loop->base.send_msg = &loop_send_msg;
  393|      1|    loop->base.destroy = &loop_destroy;
  394|       |
  395|      1|    pj_list_init(&loop->recv_list);
  396|      1|    pj_list_init(&loop->send_list);
  397|       |
  398|       |    /* Create worker thread. */
  399|      1|    status = pj_thread_create(pool, "loop", 
  400|      1|                              &loop_transport_worker_thread, loop, 0, 
  401|      1|                              PJ_THREAD_SUSPENDED, &loop->thread);
  402|      1|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (402:9): [True: 0, False: 1]
  ------------------
  403|      0|        goto on_error;
  404|       |
  405|       |    /* Register to transport manager. */
  406|      1|    status = pjsip_transport_register( loop->base.tpmgr, &loop->base);
  407|      1|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (407:9): [True: 0, False: 1]
  ------------------
  408|      0|        goto on_error;
  409|       |
  410|       |    /* Start the thread. */
  411|      1|    status = pj_thread_resume(loop->thread);
  412|      1|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (412:9): [True: 0, False: 1]
  ------------------
  413|      0|        goto on_error;
  414|       |
  415|       |    /*
  416|       |     * Done.
  417|       |     */
  418|       |
  419|      1|    if (transport)
  ------------------
  |  Branch (419:9): [True: 0, False: 1]
  ------------------
  420|      0|        *transport = &loop->base;
  421|       |
  422|      1|    return PJ_SUCCESS;
  423|       |
  424|      0|on_error:
  425|      0|    if (loop->base.lock)
  ------------------
  |  Branch (425:9): [True: 0, False: 0]
  ------------------
  426|      0|        pj_lock_destroy(loop->base.lock);
  427|      0|    if (loop->thread)
  ------------------
  |  Branch (427:9): [True: 0, False: 0]
  ------------------
  428|      0|        pj_thread_destroy(loop->thread);
  429|      0|    if (loop->base.ref_cnt)
  ------------------
  |  Branch (429:9): [True: 0, False: 0]
  ------------------
  430|      0|        pj_atomic_destroy(loop->base.ref_cnt);
  431|      0|    pjsip_endpt_release_pool(endpt, loop->pool);
  432|      0|    return status;
  433|      1|}
sip_transport_loop.c:loop_transport_worker_thread:
  262|      1|{
  263|      1|    struct loop_transport *loop = (struct loop_transport*) arg;
  264|      1|    struct recv_list r;
  265|      1|    struct send_list s;
  266|       |
  267|      1|    pj_list_init(&r);
  268|      1|    pj_list_init(&s);
  269|       |
  270|    551|    while (!loop->thread_quit_flag) {
  ------------------
  |  Branch (270:12): [True: 550, False: 1]
  ------------------
  271|    550|        pj_time_val now;
  272|       |
  273|    550|        pj_thread_sleep(1);
  274|    550|        pj_gettimeofday(&now);
  275|       |
  276|    550|        pj_lock_acquire(loop->base.lock);
  277|       |
  278|       |        /* Move expired send notification to local list. */
  279|    550|        while (!pj_list_empty(&loop->send_list)) {
  ------------------
  |  Branch (279:16): [True: 0, False: 550]
  ------------------
  280|      0|            struct send_list *node = loop->send_list.next;
  281|       |
  282|       |            /* Break when next node time is greater than now. */
  283|      0|            if (PJ_TIME_VAL_GTE(node->sent_time, now))
  ------------------
  |  |  508|      0|#define PJ_TIME_VAL_GTE(t1, t2) (PJ_TIME_VAL_GT(t1,t2) || \
  |  |  ------------------
  |  |  |  |  497|      0|#define PJ_TIME_VAL_GT(t1, t2)  ((t1).sec>(t2).sec || \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (497:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  498|      0|                                ((t1).sec==(t2).sec && (t1).msec>(t2).msec))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (498:34): [True: 0, False: 0]
  |  |  |  |  |  Branch (498:56): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  509|      0|                                 PJ_TIME_VAL_EQ(t1,t2))
  |  |  ------------------
  |  |  |  |  487|      0|#define PJ_TIME_VAL_EQ(t1, t2)  ((t1).sec==(t2).sec && (t1).msec==(t2).msec)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (487:34): [True: 0, False: 0]
  |  |  |  |  |  Branch (487:56): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  284|      0|                break;
  285|       |
  286|       |            /* Delete this from the list. */
  287|      0|            pj_list_erase(node);
  288|       |
  289|       |            /* Add to local list. */
  290|      0|            pj_list_push_back(&s, node);
  291|      0|        }
  292|       |
  293|       |        /* Move expired "incoming" packet to local list. */
  294|    550|        while (!pj_list_empty(&loop->recv_list)) {
  ------------------
  |  Branch (294:16): [True: 0, False: 550]
  ------------------
  295|      0|            struct recv_list *node = loop->recv_list.next;
  296|       |
  297|       |            /* Break when next node time is greater than now. */
  298|      0|            if (PJ_TIME_VAL_GTE(node->rdata.pkt_info.timestamp, now))
  ------------------
  |  |  508|      0|#define PJ_TIME_VAL_GTE(t1, t2) (PJ_TIME_VAL_GT(t1,t2) || \
  |  |  ------------------
  |  |  |  |  497|      0|#define PJ_TIME_VAL_GT(t1, t2)  ((t1).sec>(t2).sec || \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (497:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  498|      0|                                ((t1).sec==(t2).sec && (t1).msec>(t2).msec))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (498:34): [True: 0, False: 0]
  |  |  |  |  |  Branch (498:56): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  509|      0|                                 PJ_TIME_VAL_EQ(t1,t2))
  |  |  ------------------
  |  |  |  |  487|      0|#define PJ_TIME_VAL_EQ(t1, t2)  ((t1).sec==(t2).sec && (t1).msec==(t2).msec)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (487:34): [True: 0, False: 0]
  |  |  |  |  |  Branch (487:56): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  299|      0|                break;
  300|       |
  301|       |            /* Delete this from the list. */
  302|      0|            pj_list_erase(node);
  303|       |
  304|       |            /* Add to local list. */
  305|      0|            pj_list_push_back(&r, node);
  306|       |
  307|      0|        }
  308|       |
  309|    550|        pj_lock_release(loop->base.lock);
  310|       |
  311|       |        /* Process send notification and incoming packet notification
  312|       |         * without holding down the loop's mutex.
  313|       |         */
  314|    550|        while (!pj_list_empty(&s)) {
  ------------------
  |  Branch (314:16): [True: 0, False: 550]
  ------------------
  315|      0|            struct send_list *node = s.next;
  316|       |
  317|      0|            pj_list_erase(node);
  318|       |
  319|       |            /* Notify callback. */
  320|      0|            if (node->callback) {
  ------------------
  |  Branch (320:17): [True: 0, False: 0]
  ------------------
  321|      0|                (*node->callback)(&loop->base, node->token, node->sent);
  322|      0|            }
  323|       |
  324|       |            /* Decrement tdata reference counter. */
  325|      0|            pjsip_tx_data_dec_ref(node->tdata);
  326|      0|        }
  327|       |
  328|       |        /* Process "incoming" packet. */
  329|    550|        while (!pj_list_empty(&r)) {
  ------------------
  |  Branch (329:16): [True: 0, False: 550]
  ------------------
  330|      0|            struct recv_list *node = r.next;
  331|      0|            pj_ssize_t size_eaten;
  332|       |
  333|      0|            pj_list_erase(node);
  334|       |
  335|       |            /* Notify transport manager about the "incoming packet" */
  336|      0|            size_eaten = pjsip_tpmgr_receive_packet(loop->base.tpmgr,
  337|      0|                                                    &node->rdata);
  338|       |
  339|       |            /* Must "eat" all the packets. */
  340|      0|            pj_assert(size_eaten == node->rdata.pkt_info.len);
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (340:13): [True: 0, False: 0]
  |  Branch (340:13): [True: 0, False: 0]
  ------------------
  341|      0|            PJ_UNUSED_ARG(size_eaten);
  ------------------
  |  | 1537|      0|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  342|       |
  343|       |            /* Done. */
  344|      0|            pjsip_endpt_release_pool(loop->base.endpt,
  345|      0|                                     node->rdata.tp_info.pool);
  346|      0|        }
  347|    550|    }
  348|       |
  349|      1|    return 0;
  350|      1|}

pjsip_ua_init_module:
  195|      1|{
  196|      1|    pj_status_t status;
  197|       |
  198|       |    /* Check if module already registered. */
  199|      1|    PJ_ASSERT_RETURN(mod_ua.mod.id == -1, PJ_EINVALIDOP);
  ------------------
  |  |   97|      1|            do { \
  |  |   98|      1|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  |  |   99|      1|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (199:5): [True: 0, False: 0]
  |  Branch (199:5): [True: 0, False: 0]
  ------------------
  200|       |
  201|       |    /* Copy param, if exists. */
  202|      1|    if (prm)
  ------------------
  |  Branch (202:9): [True: 0, False: 1]
  ------------------
  203|      0|        pj_memcpy(&mod_ua.param, prm, sizeof(pjsip_ua_init_param));
  204|       |
  205|       |    /* Register the module. */
  206|      1|    status = pjsip_endpt_register_module(endpt, &mod_ua.mod);
  207|       |
  208|      1|    return status;
  209|      1|}
pjsip_ua_instance:
  216|     87|{
  217|     87|    return &mod_ua.mod;
  218|     87|}
pjsip_ua_get_endpt:
  225|     87|{
  226|     87|    PJ_UNUSED_ARG(ua);
  ------------------
  |  | 1537|     87|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  227|     87|    pj_assert(ua == &mod_ua.mod);
  ------------------
  |  |   65|     87|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (227:5): [True: 0, False: 87]
  |  Branch (227:5): [True: 87, False: 0]
  ------------------
  228|     87|    return mod_ua.endpt;
  229|     87|}
pjsip_ua_register_dlg:
  292|     87|{
  293|       |    /* Sanity check. */
  294|     87|    PJ_ASSERT_RETURN(ua && dlg, PJ_EINVAL);
  ------------------
  |  |   97|     87|            do { \
  |  |   98|    174|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  ------------------
  |  |   99|     87|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 87]
  |  |  ------------------
  ------------------
  |  Branch (294:5): [True: 0, False: 0]
  |  Branch (294:5): [True: 0, False: 0]
  |  Branch (294:5): [True: 0, False: 0]
  |  Branch (294:5): [True: 0, False: 0]
  ------------------
  295|       |
  296|       |    /* For all dialogs, local tag (inc hash) must has been initialized. */
  297|     87|    PJ_ASSERT_RETURN(dlg->local.info && dlg->local.info->tag.slen &&
  ------------------
  |  |   97|     87|            do { \
  |  |   98|    348|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  ------------------
  |  |   99|     87|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 87]
  |  |  ------------------
  ------------------
  |  Branch (297:5): [True: 0, False: 0]
  |  Branch (297:5): [True: 0, False: 0]
  |  Branch (297:5): [True: 0, False: 0]
  |  Branch (297:5): [True: 0, False: 0]
  |  Branch (297:5): [True: 0, False: 0]
  |  Branch (297:5): [True: 0, False: 0]
  ------------------
  298|     87|                     dlg->local.tag_hval != 0, PJ_EBUG);
  299|       |
  300|       |    /* For UAS dialog, remote tag (inc hash) must have been initialized. */
  301|       |    //PJ_ASSERT_RETURN(dlg->role==PJSIP_ROLE_UAC ||
  302|       |    //               (dlg->role==PJSIP_ROLE_UAS && dlg->remote.info->tag.slen
  303|       |    //                && dlg->remote.tag_hval != 0), PJ_EBUG);
  304|       |
  305|       |    /* Lock the user agent. */
  306|     87|    pj_mutex_lock(mod_ua.mutex);
  307|       |
  308|       |    /* For UAC, check if there is existing dialog in the same set. */
  309|     87|    if (dlg->role == PJSIP_ROLE_UAC) {
  ------------------
  |  Branch (309:9): [True: 87, False: 0]
  ------------------
  310|     87|        struct dlg_set *dlg_set;
  311|       |
  312|     87|        dlg_set = (struct dlg_set*)
  313|     87|                  pj_hash_get_lower( mod_ua.dlg_table,
  314|     87|                                     dlg->local.info->tag.ptr, 
  315|     87|                                     (unsigned)dlg->local.info->tag.slen,
  316|     87|                                     &dlg->local.tag_hval);
  317|       |
  318|     87|        if (dlg_set) {
  ------------------
  |  Branch (318:13): [True: 0, False: 87]
  ------------------
  319|       |            /* This is NOT the first dialog in the dialog set. 
  320|       |             * Just add this dialog in the list.
  321|       |             */
  322|      0|            pj_assert(dlg_set->dlg_list.next != (void*)&dlg_set->dlg_list);
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (322:13): [True: 0, False: 0]
  |  Branch (322:13): [True: 0, False: 0]
  ------------------
  323|      0|            pj_list_push_back(&dlg_set->dlg_list, dlg);
  324|       |
  325|      0|            dlg->dlg_set = dlg_set;
  326|       |
  327|     87|        } else {
  328|       |            /* This is the first dialog in the dialog set. 
  329|       |             * Create the dialog set and add this dialog to it.
  330|       |             */
  331|     87|            dlg_set = alloc_dlgset_node();
  332|     87|            dlg_set->ht_key = dlg->local.info->tag;
  333|     87|            pj_list_init(&dlg_set->dlg_list);
  334|     87|            pj_list_push_back(&dlg_set->dlg_list, dlg);
  335|       |
  336|     87|            dlg->dlg_set = dlg_set;
  337|       |
  338|       |            /* Register the dialog set in the hash table. */
  339|     87|            pj_hash_set_np_lower(mod_ua.dlg_table, 
  340|     87|                                 dlg_set->ht_key.ptr,
  341|     87|                                 (unsigned)dlg_set->ht_key.slen,
  342|     87|                                 dlg->local.tag_hval, dlg_set->ht_entry,
  343|     87|                                 dlg_set);
  344|     87|        }
  345|       |
  346|     87|    } else {
  347|       |        /* For UAS, create the dialog set with a single dialog as member. */
  348|      0|        struct dlg_set *dlg_set;
  349|       |
  350|      0|        dlg_set = alloc_dlgset_node();
  351|      0|        dlg_set->ht_key = dlg->local.info->tag;
  352|      0|        pj_list_init(&dlg_set->dlg_list);
  353|      0|        pj_list_push_back(&dlg_set->dlg_list, dlg);
  354|       |
  355|      0|        dlg->dlg_set = dlg_set;
  356|       |
  357|      0|        pj_hash_set_np_lower(mod_ua.dlg_table, 
  358|      0|                             dlg_set->ht_key.ptr,
  359|      0|                             (unsigned)dlg_set->ht_key.slen,
  360|      0|                             dlg->local.tag_hval, dlg_set->ht_entry, dlg_set);
  361|      0|    }
  362|       |
  363|       |    /* Unlock user agent. */
  364|     87|    pj_mutex_unlock(mod_ua.mutex);
  365|       |
  366|       |    /* Done. */
  367|     87|    return PJ_SUCCESS;
  368|     87|}
pjsip_ua_unregister_dlg:
  373|     87|{
  374|     87|    struct dlg_set *dlg_set;
  375|     87|    pjsip_dialog *d;
  376|       |
  377|       |    /* Sanity-check arguments. */
  378|     87|    PJ_ASSERT_RETURN(ua && dlg, PJ_EINVAL);
  ------------------
  |  |   97|     87|            do { \
  |  |   98|    174|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  ------------------
  |  |   99|     87|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 87]
  |  |  ------------------
  ------------------
  |  Branch (378:5): [True: 0, False: 0]
  |  Branch (378:5): [True: 0, False: 0]
  |  Branch (378:5): [True: 0, False: 0]
  |  Branch (378:5): [True: 0, False: 0]
  ------------------
  379|       |
  380|       |    /* Check that dialog has been registered. */
  381|     87|    PJ_ASSERT_RETURN(dlg->dlg_set, PJ_EINVALIDOP);
  ------------------
  |  |   97|     87|            do { \
  |  |   98|     87|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 87]
  |  |  ------------------
  |  |   99|     87|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 87]
  |  |  ------------------
  ------------------
  |  Branch (381:5): [True: 0, False: 0]
  |  Branch (381:5): [True: 0, False: 0]
  ------------------
  382|       |
  383|       |    /* Lock user agent. */
  384|     87|    pj_mutex_lock(mod_ua.mutex);
  385|       |
  386|       |    /* Find this dialog from the dialog set. */
  387|     87|    dlg_set = (struct dlg_set*) dlg->dlg_set;
  388|     87|    d = dlg_set->dlg_list.next;
  389|     87|    while (d != (pjsip_dialog*)&dlg_set->dlg_list && d != dlg) {
  ------------------
  |  Branch (389:12): [True: 87, False: 0]
  |  Branch (389:54): [True: 0, False: 87]
  ------------------
  390|      0|        d = d->next;
  391|      0|    }
  392|       |
  393|     87|    if (d != dlg) {
  ------------------
  |  Branch (393:9): [True: 0, False: 87]
  ------------------
  394|      0|        pj_assert(!"Dialog is not registered!");
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (394:9): [Folded, False: 0]
  |  Branch (394:9): [Folded, False: 0]
  ------------------
  395|      0|        pj_mutex_unlock(mod_ua.mutex);
  396|      0|        return PJ_EINVALIDOP;
  ------------------
  |  |  438|      0|#define PJ_EINVALIDOP       (PJ_ERRNO_START_STATUS + 13)/* 70013 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  397|      0|    }
  398|       |
  399|       |    /* Remove this dialog from the list. */
  400|     87|    pj_list_erase(dlg);
  401|       |
  402|       |    /* If dialog list is empty, remove the dialog set from the hash table. */
  403|     87|    if (pj_list_empty(&dlg_set->dlg_list)) {
  ------------------
  |  Branch (403:9): [True: 87, False: 0]
  ------------------
  404|       |
  405|       |        /* Verify that the dialog set is valid */
  406|     87|        pj_assert(pj_hash_get_lower(mod_ua.dlg_table, dlg_set->ht_key.ptr,
  ------------------
  |  |   65|     87|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (406:9): [True: 0, False: 87]
  |  Branch (406:9): [True: 87, False: 0]
  ------------------
  407|     87|                                    (unsigned)dlg_set->ht_key.slen,
  408|     87|                                    &dlg->local.tag_hval) == dlg_set);
  409|       |
  410|     87|        pj_hash_set_lower(NULL, mod_ua.dlg_table, dlg_set->ht_key.ptr,
  411|     87|                          (unsigned)dlg_set->ht_key.slen,
  412|     87|                          dlg->local.tag_hval, NULL);
  413|       |
  414|       |        /* Return dlg_set to free nodes. */
  415|     87|        pj_list_push_back(&mod_ua.free_dlgset_nodes, dlg_set);
  416|     87|    } else {
  417|       |        /* If the just unregistered dialog is being used as hash key,
  418|       |         * reset the dlg_set entry with a new key (i.e: from the first dialog
  419|       |         * in dlg_set).
  420|       |         */
  421|      0|        if (dlg_set->ht_key.ptr  == dlg->local.info->tag.ptr &&
  ------------------
  |  Branch (421:13): [True: 0, False: 0]
  ------------------
  422|      0|            dlg_set->ht_key.slen == dlg->local.info->tag.slen)
  ------------------
  |  Branch (422:13): [True: 0, False: 0]
  ------------------
  423|      0|        {
  424|      0|            pjsip_dialog* key_dlg = dlg_set->dlg_list.next;
  425|       |
  426|       |            /* Verify that the old & new keys share the hash value */
  427|      0|            pj_assert(key_dlg->local.tag_hval == dlg->local.tag_hval);
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (427:13): [True: 0, False: 0]
  |  Branch (427:13): [True: 0, False: 0]
  ------------------
  428|       |
  429|      0|            pj_hash_set_lower(NULL, mod_ua.dlg_table, dlg_set->ht_key.ptr,
  430|      0|                              (unsigned)dlg_set->ht_key.slen,
  431|      0|                              dlg->local.tag_hval, NULL);
  432|       |
  433|      0|            dlg_set->ht_key = key_dlg->local.info->tag;
  434|       |
  435|      0|            pj_hash_set_np_lower(mod_ua.dlg_table,
  436|      0|                                 dlg_set->ht_key.ptr,
  437|      0|                                 (unsigned)dlg_set->ht_key.slen,
  438|      0|                                 key_dlg->local.tag_hval, dlg_set->ht_entry,
  439|      0|                                 dlg_set);
  440|      0|        }
  441|      0|    }
  442|       |
  443|       |    /* Unlock user agent. */
  444|     87|    pj_mutex_unlock(mod_ua.mutex);
  445|       |
  446|       |    /* Done. */
  447|     87|    return PJ_SUCCESS;
  448|     87|}
sip_ua_layer.c:mod_ua_load:
  113|      1|{
  114|      1|    pj_status_t status;
  115|       |
  116|       |    /* Initialize the user agent. */
  117|      1|    mod_ua.endpt = endpt;
  118|      1|    mod_ua.pool = pjsip_endpt_create_pool( endpt, "ua%p", PJSIP_POOL_LEN_UA,
  ------------------
  |  | 1033|      1|#   define PJSIP_POOL_LEN_UA            512
  ------------------
  119|      1|                                           PJSIP_POOL_INC_UA);
  ------------------
  |  | 1040|      1|#   define PJSIP_POOL_INC_UA            512
  ------------------
  120|      1|    if (mod_ua.pool == NULL)
  ------------------
  |  Branch (120:9): [True: 0, False: 1]
  ------------------
  121|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  122|       |
  123|      1|    status = pj_mutex_create_recursive(mod_ua.pool, " ua%p", &mod_ua.mutex);
  124|      1|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (124:9): [True: 0, False: 1]
  ------------------
  125|      0|        return status;
  126|       |
  127|      1|    mod_ua.dlg_table = pj_hash_create(mod_ua.pool, PJSIP_MAX_DIALOG_COUNT);
  ------------------
  |  |  327|      1|#   define PJSIP_MAX_DIALOG_COUNT       (512-1)
  ------------------
  128|      1|    if (mod_ua.dlg_table == NULL)
  ------------------
  |  Branch (128:9): [True: 0, False: 1]
  ------------------
  129|      0|        return PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  130|       |
  131|      1|    pj_list_init(&mod_ua.free_dlgset_nodes);
  132|       |
  133|       |    /* Initialize dialog lock. */
  134|      1|    status = pj_thread_local_alloc(&pjsip_dlg_lock_tls_id);
  135|      1|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (135:9): [True: 0, False: 1]
  ------------------
  136|      0|        return status;
  137|       |
  138|      1|    pj_thread_local_set(pjsip_dlg_lock_tls_id, NULL);
  139|       |
  140|      1|    return PJ_SUCCESS;
  141|       |
  142|      1|}
sip_ua_layer.c:alloc_dlgset_node:
  273|     87|{
  274|     87|    struct dlg_set *set;
  275|       |
  276|     87|    if (!pj_list_empty(&mod_ua.free_dlgset_nodes)) {
  ------------------
  |  Branch (276:9): [True: 86, False: 1]
  ------------------
  277|     86|        set = mod_ua.free_dlgset_nodes.next;
  278|     86|        pj_list_erase(set);
  279|     86|        return set;
  280|     86|    } else {
  281|      1|        set = PJ_POOL_ALLOC_T(mod_ua.pool, struct dlg_set);
  ------------------
  |  |  569|      1|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  282|      1|        return set;
  283|      1|    }
  284|     87|}

pjsip_param_find:
   34|  4.51k|{
   35|  4.51k|    pjsip_param *p = (pjsip_param*)param_list->next;
   36|  14.7k|    while (p != param_list) {
  ------------------
  |  Branch (36:12): [True: 13.0k, False: 1.69k]
  ------------------
   37|  13.0k|        if (pj_stricmp(&p->name, name)==0)
  ------------------
  |  Branch (37:13): [True: 2.81k, False: 10.2k]
  ------------------
   38|  2.81k|            return p;
   39|  10.2k|        p = p->next;
   40|  10.2k|    }
   41|  1.69k|    return NULL;
   42|  4.51k|}
pjsip_param_cmp:
   47|    329|{
   48|    329|    const pjsip_param *p1;
   49|       |
   50|    329|    if ((ig_nf & 1)==0 && pj_list_size(param_list1)!=pj_list_size(param_list2))
  ------------------
  |  Branch (50:9): [True: 0, False: 329]
  |  Branch (50:27): [True: 0, False: 0]
  ------------------
   51|      0|        return 1;
   52|       |
   53|    329|    p1 = param_list1->next;
   54|  2.24k|    while (p1 != param_list1) {
  ------------------
  |  Branch (54:12): [True: 1.96k, False: 281]
  ------------------
   55|  1.96k|        const pjsip_param *p2;
   56|  1.96k|        p2 = pjsip_param_find(param_list2, &p1->name);
   57|  1.96k|        if (p2 ) {
  ------------------
  |  Branch (57:13): [True: 1.59k, False: 362]
  ------------------
   58|  1.59k|            int rc = pj_stricmp(&p1->value, &p2->value);
   59|  1.59k|            if (rc != 0)
  ------------------
  |  Branch (59:17): [True: 48, False: 1.55k]
  ------------------
   60|     48|                return rc;
   61|  1.59k|        } else if ((ig_nf & 1)==0)
  ------------------
  |  Branch (61:20): [True: 0, False: 362]
  ------------------
   62|      0|            return 1;
   63|       |
   64|  1.91k|        p1 = p1->next;
   65|  1.91k|    }
   66|       |
   67|    281|    return 0;
   68|    329|}
pjsip_param_clone:
   72|  18.7k|{
   73|  18.7k|    const pjsip_param *p = src_list->next;
   74|       |
   75|  18.7k|    pj_list_init(dst_list);
   76|  59.9k|    while (p && p != src_list) {
  ------------------
  |  Branch (76:12): [True: 59.9k, False: 0]
  |  Branch (76:17): [True: 41.2k, False: 18.7k]
  ------------------
   77|  41.2k|        pjsip_param *new_param = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  569|  41.2k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
   78|  41.2k|        pj_strdup(pool, &new_param->name, &p->name);
   79|  41.2k|        pj_strdup(pool, &new_param->value, &p->value);
   80|  41.2k|        pj_list_insert_before(dst_list, new_param);
   81|  41.2k|        p = p->next;
   82|  41.2k|    }
   83|  18.7k|}
pjsip_param_print_on:
  107|  1.17k|{
  108|  1.17k|    const pjsip_param *p;
  109|  1.17k|    char *startbuf;
  110|  1.17k|    char *endbuf;
  111|  1.17k|    int printed;
  112|       |
  113|  1.17k|    p = param_list->next;
  114|  1.17k|    if (p == NULL || p == param_list)
  ------------------
  |  Branch (114:9): [True: 0, False: 1.17k]
  |  Branch (114:22): [True: 1.17k, False: 0]
  ------------------
  115|  1.17k|        return 0;
  116|       |
  117|      0|    startbuf = buf;
  118|      0|    endbuf = buf + size;
  119|       |
  120|      0|    PJ_UNUSED_ARG(pname_spec);
  ------------------
  |  | 1537|      0|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  121|       |
  122|      0|    do {
  123|      0|        copy_advance_char_check(buf, (char)sep);
  ------------------
  |  |   26|      0|        do { \
  |  |   27|      0|            if (1 >= (endbuf-buf)) return -1;   \
  |  |  ------------------
  |  |  |  Branch (27:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   28|      0|            *buf++ = chr; \
  |  |   29|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (29:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  124|      0|        copy_advance_escape(buf, p->name, (*pname_spec));
  ------------------
  |  |   95|      0|        do { \
  |  |   96|      0|            printed = \
  |  |   97|      0|                (int)pj_strncpy2_escape(buf, &(str), (endbuf-buf), &(unres)); \
  |  |   98|      0|            if (printed < 0) return -1; \
  |  |  ------------------
  |  |  |  Branch (98:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   99|      0|            buf += printed; \
  |  |  100|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (100:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  125|      0|        if (p->value.slen) {
  ------------------
  |  Branch (125:13): [True: 0, False: 0]
  ------------------
  126|      0|            copy_advance_char_check(buf, '=');
  ------------------
  |  |   26|      0|        do { \
  |  |   27|      0|            if (1 >= (endbuf-buf)) return -1;   \
  |  |  ------------------
  |  |  |  Branch (27:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   28|      0|            *buf++ = chr; \
  |  |   29|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (29:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  127|      0|            if (*p->value.ptr == '"')
  ------------------
  |  Branch (127:17): [True: 0, False: 0]
  ------------------
  128|      0|                copy_advance(buf, p->value);
  ------------------
  |  |  109|      0|#define copy_advance            copy_advance_check
  |  |  ------------------
  |  |  |  |   32|      0|        do { \
  |  |  |  |   33|      0|            if ((str).slen >= (endbuf-buf)) return -1;  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (33:17): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   34|      0|            if ((str).slen) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:17): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   35|      0|                pj_memcpy(buf, (str).ptr, (str).slen); \
  |  |  |  |   36|      0|                buf += (str).slen; \
  |  |  |  |   37|      0|            } \
  |  |  |  |   38|      0|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:18): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  129|      0|            else
  130|      0|                copy_advance_escape(buf, p->value, (*pvalue_spec));
  ------------------
  |  |   95|      0|        do { \
  |  |   96|      0|            printed = \
  |  |   97|      0|                (int)pj_strncpy2_escape(buf, &(str), (endbuf-buf), &(unres)); \
  |  |   98|      0|            if (printed < 0) return -1; \
  |  |  ------------------
  |  |  |  Branch (98:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   99|      0|            buf += printed; \
  |  |  100|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (100:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  131|      0|        }
  132|      0|        p = p->next;
  133|      0|        if (sep == '?') sep = '&';
  ------------------
  |  Branch (133:13): [True: 0, False: 0]
  ------------------
  134|      0|    } while (p != param_list);
  ------------------
  |  Branch (134:14): [True: 0, False: 0]
  ------------------
  135|       |
  136|      0|    return buf-startbuf;
  137|      0|}
pjsip_sip_uri_set_secure:
  231|  15.6k|{
  232|  15.6k|    url->vptr = secure ? &sips_url_vptr : &sip_url_vptr;
  ------------------
  |  Branch (232:17): [True: 217, False: 15.4k]
  ------------------
  233|  15.6k|}
pjsip_sip_uri_init:
  236|  15.6k|{
  237|  15.6k|    pj_bzero(url, sizeof(*url));
  238|  15.6k|    url->ttl_param = -1;
  239|  15.6k|    pjsip_sip_uri_set_secure(url, secure);
  240|  15.6k|    pj_list_init(&url->other_param);
  241|  15.6k|    pj_list_init(&url->header_param);
  242|  15.6k|}
pjsip_sip_uri_create:
  246|  10.7k|{
  247|  10.7k|    pjsip_sip_uri *url = PJ_POOL_ALLOC_T(pool, pjsip_sip_uri);
  ------------------
  |  |  569|  10.7k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  248|  10.7k|    pjsip_sip_uri_init(url, secure);
  249|  10.7k|    return url;
  250|  10.7k|}
pjsip_sip_uri_assign:
  516|  4.92k|{
  517|  4.92k|    pj_strdup( pool, &url->user, &rhs->user);
  518|  4.92k|    pj_strdup( pool, &url->passwd, &rhs->passwd);
  519|       |#if defined (PJSIP_URI_USE_ORIG_USERPASS) && (PJSIP_URI_USE_ORIG_USERPASS)
  520|       |    pj_strdup( pool, &url->orig_userpass, &rhs->orig_userpass);
  521|       |#endif
  522|  4.92k|    pj_strdup( pool, &url->host, &rhs->host);
  523|  4.92k|    url->port = rhs->port;
  524|  4.92k|    pj_strdup( pool, &url->user_param, &rhs->user_param);
  525|  4.92k|    pj_strdup( pool, &url->method_param, &rhs->method_param);
  526|  4.92k|    pj_strdup( pool, &url->transport_param, &rhs->transport_param);
  527|  4.92k|    url->ttl_param = rhs->ttl_param;
  528|  4.92k|    pj_strdup( pool, &url->maddr_param, &rhs->maddr_param);
  529|  4.92k|    pjsip_param_clone(pool, &url->other_param, &rhs->other_param);
  530|  4.92k|    pjsip_param_clone(pool, &url->header_param, &rhs->header_param);
  531|  4.92k|    url->lr_param = rhs->lr_param;
  532|  4.92k|}
pjsip_name_addr_init:
  552|  34.4k|{
  553|  34.4k|    name->vptr = &name_addr_vptr;
  554|  34.4k|    name->uri = NULL;
  555|  34.4k|    name->display.slen = 0;
  556|       |    name->display.ptr = NULL;
  557|  34.4k|}
pjsip_name_addr_create:
  560|  20.9k|{
  561|  20.9k|    pjsip_name_addr *name_addr = PJ_POOL_ALLOC_T(pool, pjsip_name_addr);
  ------------------
  |  |  569|  20.9k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  562|  20.9k|    pjsip_name_addr_init(name_addr);
  563|  20.9k|    return name_addr;
  564|  20.9k|}
pjsip_name_addr_assign:
  604|  6.71k|{
  605|  6.71k|    pj_strdup( pool, &dst->display, &src->display);
  606|  6.71k|    dst->uri = (pjsip_uri*) pjsip_uri_clone(pool, src->uri);
  607|  6.71k|}
pjsip_other_uri_create:
  671|  9.49k|{
  672|  9.49k|    pjsip_other_uri *uri = PJ_POOL_ZALLOC_T(pool, pjsip_other_uri);
  ------------------
  |  |  583|  9.49k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  673|  9.49k|    uri->vptr = &other_uri_vptr;
  674|  9.49k|    return uri;
  675|  9.49k|}
sip_uri.c:pjsip_get_uri:
  220|    779|{
  221|    779|    return uri;
  222|    779|}
sip_uri.c:pjsip_url_print:
  255|  1.17k|{
  256|  1.17k|    int printed;
  257|  1.17k|    char *startbuf = buf;
  258|  1.17k|    char *endbuf = buf+size-1; // Need to minus one for NULL terminator
  259|  1.17k|    const pj_str_t *scheme;
  260|  1.17k|    const pjsip_parser_const_t *pc = pjsip_parser_const();
  261|       |
  262|  1.17k|    if (endbuf < startbuf) return -1;
  ------------------
  |  Branch (262:9): [True: 0, False: 1.17k]
  ------------------
  263|  1.17k|    *buf = '\0';
  264|       |
  265|       |    /* Print scheme ("sip:" or "sips:") */
  266|  1.17k|    scheme = pjsip_uri_get_scheme(url);
  267|  1.17k|    copy_advance_check(buf, *scheme);
  ------------------
  |  |   32|  1.17k|        do { \
  |  |   33|  1.17k|            if ((str).slen >= (endbuf-buf)) return -1;  \
  |  |  ------------------
  |  |  |  Branch (33:17): [True: 0, False: 1.17k]
  |  |  ------------------
  |  |   34|  1.17k|            if ((str).slen) { \
  |  |  ------------------
  |  |  |  Branch (34:17): [True: 1.17k, False: 0]
  |  |  ------------------
  |  |   35|  1.17k|                pj_memcpy(buf, (str).ptr, (str).slen); \
  |  |   36|  1.17k|                buf += (str).slen; \
  |  |   37|  1.17k|            } \
  |  |   38|  1.17k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (38:18): [Folded, False: 1.17k]
  |  |  ------------------
  ------------------
  268|  1.17k|    copy_advance_char_check(buf, ':');
  ------------------
  |  |   26|  1.17k|        do { \
  |  |   27|  1.17k|            if (1 >= (endbuf-buf)) return -1;   \
  |  |  ------------------
  |  |  |  Branch (27:17): [True: 0, False: 1.17k]
  |  |  ------------------
  |  |   28|  1.17k|            *buf++ = chr; \
  |  |   29|  1.17k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (29:18): [Folded, False: 1.17k]
  |  |  ------------------
  ------------------
  269|       |
  270|       |    /* Print "user:password@", if any. */
  271|  1.17k|    if (url->user.slen) {
  ------------------
  |  Branch (271:9): [True: 0, False: 1.17k]
  ------------------
  272|       |#if defined (PJSIP_URI_USE_ORIG_USERPASS) && (PJSIP_URI_USE_ORIG_USERPASS)
  273|       |        /* Use the URI's original username and password, if any. */
  274|       |        if (url->orig_userpass.slen) {
  275|       |            copy_advance_check(buf, url->orig_userpass);
  276|       |        } else {
  277|       |#endif
  278|      0|            const pj_cis_t *spec = pjsip_cfg()->endpt.allow_tx_hash_in_uri ?
  ------------------
  |  Branch (278:36): [True: 0, False: 0]
  ------------------
  279|      0|                                    &pc->pjsip_USER_SPEC_LENIENT :
  280|      0|                                    &pc->pjsip_USER_SPEC;
  281|      0|            copy_advance_escape(buf, url->user, *spec);
  ------------------
  |  |   95|      0|        do { \
  |  |   96|      0|            printed = \
  |  |   97|      0|                (int)pj_strncpy2_escape(buf, &(str), (endbuf-buf), &(unres)); \
  |  |   98|      0|            if (printed < 0) return -1; \
  |  |  ------------------
  |  |  |  Branch (98:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   99|      0|            buf += printed; \
  |  |  100|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (100:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  282|      0|            if (url->passwd.slen) {
  ------------------
  |  Branch (282:17): [True: 0, False: 0]
  ------------------
  283|      0|                copy_advance_char_check(buf, ':');
  ------------------
  |  |   26|      0|        do { \
  |  |   27|      0|            if (1 >= (endbuf-buf)) return -1;   \
  |  |  ------------------
  |  |  |  Branch (27:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   28|      0|            *buf++ = chr; \
  |  |   29|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (29:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  284|      0|                copy_advance_escape(buf, url->passwd, pc->pjsip_PASSWD_SPEC);
  ------------------
  |  |   95|      0|        do { \
  |  |   96|      0|            printed = \
  |  |   97|      0|                (int)pj_strncpy2_escape(buf, &(str), (endbuf-buf), &(unres)); \
  |  |   98|      0|            if (printed < 0) return -1; \
  |  |  ------------------
  |  |  |  Branch (98:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   99|      0|            buf += printed; \
  |  |  100|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (100:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  285|      0|            }
  286|       |#if defined (PJSIP_URI_USE_ORIG_USERPASS) && (PJSIP_URI_USE_ORIG_USERPASS)
  287|       |        }
  288|       |#endif
  289|      0|        copy_advance_char_check(buf, '@');
  ------------------
  |  |   26|      0|        do { \
  |  |   27|      0|            if (1 >= (endbuf-buf)) return -1;   \
  |  |  ------------------
  |  |  |  Branch (27:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   28|      0|            *buf++ = chr; \
  |  |   29|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (29:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  290|      0|    }
  291|       |
  292|       |    /* Print host. */
  293|  1.17k|    pj_assert(url->host.slen != 0);
  ------------------
  |  |   65|  1.17k|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (293:5): [True: 0, False: 1.17k]
  |  Branch (293:5): [True: 1.17k, False: 0]
  ------------------
  294|       |    /* Detect IPv6 IP address */
  295|  1.17k|    if (pj_memchr(url->host.ptr, ':', url->host.slen)) {
  ------------------
  |  Branch (295:9): [True: 0, False: 1.17k]
  ------------------
  296|      0|        copy_advance_pair_quote_cond(buf, "", 0, url->host, '[', ']');
  ------------------
  |  |  117|      0|        do {    \
  |  |  118|      0|          if (str2.slen && *str2.ptr!=quotebegin) \
  |  |  ------------------
  |  |  |  Branch (118:15): [True: 0, False: 0]
  |  |  |  Branch (118:28): [True: 0, False: 0]
  |  |  ------------------
  |  |  119|      0|            copy_advance_pair_quote(buf,str1,len1,str2,quotebegin,quoteend); \
  |  |  ------------------
  |  |  |  |   65|      0|        do { \
  |  |  |  |   66|      0|                printed = len1+(int)str2.slen+2; \
  |  |  |  |   67|      0|                if (printed >= (endbuf-buf)) return -1; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (67:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   68|      0|                pj_memcpy(buf,str1,len1); \
  |  |  |  |   69|      0|                *(buf+len1)=quotebegin; \
  |  |  |  |   70|      0|                pj_memcpy(buf+len1+1, str2.ptr, str2.slen); \
  |  |  |  |   71|      0|                *(buf+printed-1) = quoteend; \
  |  |  |  |   72|      0|                buf += printed; \
  |  |  |  |   73|      0|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (73:18): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|          else \
  |  |  121|      0|            copy_advance_pair(buf,str1,len1,str2); \
  |  |  ------------------
  |  |  |  |  110|      0|#define copy_advance_pair       copy_advance_pair_check
  |  |  |  |  ------------------
  |  |  |  |  |  |   41|      0|        do { \
  |  |  |  |  |  |   42|      0|            if (str2.slen) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (42:17): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|                printed = len1+(int)str2.slen; \
  |  |  |  |  |  |   44|      0|                if (printed >= (endbuf-buf)) return -1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (44:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|                pj_memcpy(buf,str1,len1); \
  |  |  |  |  |  |   46|      0|                pj_memcpy(buf+len1, str2.ptr, str2.slen); \
  |  |  |  |  |  |   47|      0|                buf += printed; \
  |  |  |  |  |  |   48|      0|            } \
  |  |  |  |  |  |   49|      0|        } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (49:18): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (122:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  297|  1.17k|    } else {
  298|  1.17k|        copy_advance_check(buf, url->host);
  ------------------
  |  |   32|  1.17k|        do { \
  |  |   33|  1.17k|            if ((str).slen >= (endbuf-buf)) return -1;  \
  |  |  ------------------
  |  |  |  Branch (33:17): [True: 0, False: 1.17k]
  |  |  ------------------
  |  |   34|  1.17k|            if ((str).slen) { \
  |  |  ------------------
  |  |  |  Branch (34:17): [True: 1.17k, False: 0]
  |  |  ------------------
  |  |   35|  1.17k|                pj_memcpy(buf, (str).ptr, (str).slen); \
  |  |   36|  1.17k|                buf += (str).slen; \
  |  |   37|  1.17k|            } \
  |  |   38|  1.17k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (38:18): [Folded, False: 1.17k]
  |  |  ------------------
  ------------------
  299|  1.17k|    }
  300|       |
  301|       |    /* Only print port if it is explicitly specified. 
  302|       |     * Port is not allowed in To and From header, see Table 1 in
  303|       |     * RFC 3261 Section 19.1.1
  304|       |     */
  305|       |    /* Note: ticket #1141 adds run-time setting to allow port number to
  306|       |     * appear in From/To header. Default is still false.
  307|       |     */
  308|  1.17k|    if (url->port &&
  ------------------
  |  Branch (308:9): [True: 0, False: 1.17k]
  ------------------
  309|      0|        (context != PJSIP_URI_IN_FROMTO_HDR ||
  ------------------
  |  Branch (309:10): [True: 0, False: 0]
  ------------------
  310|      0|         pjsip_cfg()->endpt.allow_port_in_fromto_hdr))
  ------------------
  |  Branch (310:10): [True: 0, False: 0]
  ------------------
  311|      0|    {
  312|      0|        if (endbuf - buf < 10)
  ------------------
  |  Branch (312:13): [True: 0, False: 0]
  ------------------
  313|      0|            return -1;
  314|       |
  315|      0|        copy_advance_char_check(buf, ':');
  ------------------
  |  |   26|      0|        do { \
  |  |   27|      0|            if (1 >= (endbuf-buf)) return -1;   \
  |  |  ------------------
  |  |  |  Branch (27:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   28|      0|            *buf++ = chr; \
  |  |   29|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (29:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  316|      0|        printed = pj_utoa(url->port, buf);
  317|      0|        buf += printed;
  318|      0|    }
  319|       |
  320|       |    /* User param is allowed in all contexes */
  321|  1.17k|    copy_advance_pair_check(buf, ";user=", 6, url->user_param);
  ------------------
  |  |   41|  1.17k|        do { \
  |  |   42|  1.17k|            if (str2.slen) { \
  |  |  ------------------
  |  |  |  Branch (42:17): [True: 0, False: 1.17k]
  |  |  ------------------
  |  |   43|      0|                printed = len1+(int)str2.slen; \
  |  |   44|      0|                if (printed >= (endbuf-buf)) return -1; \
  |  |  ------------------
  |  |  |  Branch (44:21): [True: 0, False: 0]
  |  |  ------------------
  |  |   45|      0|                pj_memcpy(buf,str1,len1); \
  |  |   46|      0|                pj_memcpy(buf+len1, str2.ptr, str2.slen); \
  |  |   47|      0|                buf += printed; \
  |  |   48|      0|            } \
  |  |   49|  1.17k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (49:18): [Folded, False: 1.17k]
  |  |  ------------------
  ------------------
  322|       |
  323|       |    /* Method param is only allowed in external/other context. */
  324|  1.17k|    if (context == PJSIP_URI_IN_OTHER) {
  ------------------
  |  Branch (324:9): [True: 0, False: 1.17k]
  ------------------
  325|      0|        copy_advance_pair_escape(buf, ";method=", 8, url->method_param, 
  ------------------
  |  |   76|      0|        do { \
  |  |   77|      0|          if (str2.slen) { \
  |  |  ------------------
  |  |  |  Branch (77:15): [True: 0, False: 0]
  |  |  ------------------
  |  |   78|      0|            if (len1+str2.slen >= (endbuf-buf)) return -1; \
  |  |  ------------------
  |  |  |  Branch (78:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   79|      0|            pj_memcpy(buf,str1,len1); \
  |  |   80|      0|            printed=(int)pj_strncpy2_escape(buf+len1,&str2,(endbuf-buf-len1), \
  |  |   81|      0|                                            &unres);\
  |  |   82|      0|            if (printed < 0) return -1; \
  |  |  ------------------
  |  |  |  Branch (82:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   83|      0|            buf += (printed+len1); \
  |  |   84|      0|          } \
  |  |   85|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (85:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  326|      0|                                 pc->pjsip_PARAM_CHAR_SPEC);
  327|      0|    }
  328|       |
  329|       |    /* Transport is not allowed in From/To header. */
  330|  1.17k|    if (context != PJSIP_URI_IN_FROMTO_HDR) {
  ------------------
  |  Branch (330:9): [True: 1.17k, False: 0]
  ------------------
  331|  1.17k|        copy_advance_pair_escape(buf, ";transport=", 11, url->transport_param,
  ------------------
  |  |   76|  1.17k|        do { \
  |  |   77|  1.17k|          if (str2.slen) { \
  |  |  ------------------
  |  |  |  Branch (77:15): [True: 0, False: 1.17k]
  |  |  ------------------
  |  |   78|      0|            if (len1+str2.slen >= (endbuf-buf)) return -1; \
  |  |  ------------------
  |  |  |  Branch (78:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   79|      0|            pj_memcpy(buf,str1,len1); \
  |  |   80|      0|            printed=(int)pj_strncpy2_escape(buf+len1,&str2,(endbuf-buf-len1), \
  |  |   81|      0|                                            &unres);\
  |  |   82|      0|            if (printed < 0) return -1; \
  |  |  ------------------
  |  |  |  Branch (82:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   83|      0|            buf += (printed+len1); \
  |  |   84|      0|          } \
  |  |   85|  1.17k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (85:18): [Folded, False: 1.17k]
  |  |  ------------------
  ------------------
  332|  1.17k|                                 pc->pjsip_PARAM_CHAR_SPEC);
  333|  1.17k|    }
  334|       |
  335|       |    /* TTL param is not allowed in From, To, Route, and Record-Route header. */
  336|  1.17k|    if (url->ttl_param >= 0 && context != PJSIP_URI_IN_FROMTO_HDR &&
  ------------------
  |  Branch (336:9): [True: 0, False: 1.17k]
  |  Branch (336:32): [True: 0, False: 0]
  ------------------
  337|      0|        context != PJSIP_URI_IN_ROUTING_HDR) 
  ------------------
  |  Branch (337:9): [True: 0, False: 0]
  ------------------
  338|      0|    {
  339|      0|        if (endbuf - buf < 15)
  ------------------
  |  Branch (339:13): [True: 0, False: 0]
  ------------------
  340|      0|            return -1;
  341|      0|        pj_memcpy(buf, ";ttl=", 5);
  342|      0|        printed = pj_utoa(url->ttl_param, buf+5);
  343|      0|        buf += printed + 5;
  344|      0|    }
  345|       |
  346|       |    /* maddr param is not allowed in From and To header. */
  347|  1.17k|    if (context != PJSIP_URI_IN_FROMTO_HDR && url->maddr_param.slen) {
  ------------------
  |  Branch (347:9): [True: 1.17k, False: 0]
  |  Branch (347:47): [True: 0, False: 1.17k]
  ------------------
  348|       |        /* Detect IPv6 IP address */
  349|      0|        if (pj_memchr(url->maddr_param.ptr, ':', url->maddr_param.slen)) {
  ------------------
  |  Branch (349:13): [True: 0, False: 0]
  ------------------
  350|      0|            copy_advance_pair_quote_cond(buf, ";maddr=", 7, url->maddr_param,
  ------------------
  |  |  117|      0|        do {    \
  |  |  118|      0|          if (str2.slen && *str2.ptr!=quotebegin) \
  |  |  ------------------
  |  |  |  Branch (118:15): [True: 0, False: 0]
  |  |  |  Branch (118:28): [True: 0, False: 0]
  |  |  ------------------
  |  |  119|      0|            copy_advance_pair_quote(buf,str1,len1,str2,quotebegin,quoteend); \
  |  |  ------------------
  |  |  |  |   65|      0|        do { \
  |  |  |  |   66|      0|                printed = len1+(int)str2.slen+2; \
  |  |  |  |   67|      0|                if (printed >= (endbuf-buf)) return -1; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (67:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   68|      0|                pj_memcpy(buf,str1,len1); \
  |  |  |  |   69|      0|                *(buf+len1)=quotebegin; \
  |  |  |  |   70|      0|                pj_memcpy(buf+len1+1, str2.ptr, str2.slen); \
  |  |  |  |   71|      0|                *(buf+printed-1) = quoteend; \
  |  |  |  |   72|      0|                buf += printed; \
  |  |  |  |   73|      0|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (73:18): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|          else \
  |  |  121|      0|            copy_advance_pair(buf,str1,len1,str2); \
  |  |  ------------------
  |  |  |  |  110|      0|#define copy_advance_pair       copy_advance_pair_check
  |  |  |  |  ------------------
  |  |  |  |  |  |   41|      0|        do { \
  |  |  |  |  |  |   42|      0|            if (str2.slen) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (42:17): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|                printed = len1+(int)str2.slen; \
  |  |  |  |  |  |   44|      0|                if (printed >= (endbuf-buf)) return -1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (44:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|                pj_memcpy(buf,str1,len1); \
  |  |  |  |  |  |   46|      0|                pj_memcpy(buf+len1, str2.ptr, str2.slen); \
  |  |  |  |  |  |   47|      0|                buf += printed; \
  |  |  |  |  |  |   48|      0|            } \
  |  |  |  |  |  |   49|      0|        } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (49:18): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (122:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  351|      0|                                         '[', ']');
  352|      0|        } else {
  353|      0|            copy_advance_pair_escape(buf, ";maddr=", 7, url->maddr_param,
  ------------------
  |  |   76|      0|        do { \
  |  |   77|      0|          if (str2.slen) { \
  |  |  ------------------
  |  |  |  Branch (77:15): [True: 0, False: 0]
  |  |  ------------------
  |  |   78|      0|            if (len1+str2.slen >= (endbuf-buf)) return -1; \
  |  |  ------------------
  |  |  |  Branch (78:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   79|      0|            pj_memcpy(buf,str1,len1); \
  |  |   80|      0|            printed=(int)pj_strncpy2_escape(buf+len1,&str2,(endbuf-buf-len1), \
  |  |   81|      0|                                            &unres);\
  |  |   82|      0|            if (printed < 0) return -1; \
  |  |  ------------------
  |  |  |  Branch (82:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   83|      0|            buf += (printed+len1); \
  |  |   84|      0|          } \
  |  |   85|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (85:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  354|      0|                                     pc->pjsip_PARAM_CHAR_SPEC);
  355|      0|        }
  356|      0|    }
  357|       |
  358|       |    /* lr param is not allowed in From, To, and Contact header. */
  359|  1.17k|    if (url->lr_param && context != PJSIP_URI_IN_FROMTO_HDR &&
  ------------------
  |  Branch (359:9): [True: 0, False: 1.17k]
  |  Branch (359:26): [True: 0, False: 0]
  ------------------
  360|      0|        context != PJSIP_URI_IN_CONTACT_HDR) 
  ------------------
  |  Branch (360:9): [True: 0, False: 0]
  ------------------
  361|      0|    {
  362|      0|        pj_str_t lr = { ";lr", 3 };
  363|      0|        if (endbuf - buf < 3)
  ------------------
  |  Branch (363:13): [True: 0, False: 0]
  ------------------
  364|      0|            return -1;
  365|      0|        copy_advance_check(buf, lr);
  ------------------
  |  |   32|      0|        do { \
  |  |   33|      0|            if ((str).slen >= (endbuf-buf)) return -1;  \
  |  |  ------------------
  |  |  |  Branch (33:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   34|      0|            if ((str).slen) { \
  |  |  ------------------
  |  |  |  Branch (34:17): [True: 0, False: 0]
  |  |  ------------------
  |  |   35|      0|                pj_memcpy(buf, (str).ptr, (str).slen); \
  |  |   36|      0|                buf += (str).slen; \
  |  |   37|      0|            } \
  |  |   38|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (38:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
  366|      0|    }
  367|       |
  368|       |    /* Other param. */
  369|  1.17k|    printed = (int)pjsip_param_print_on(&url->other_param, buf, endbuf-buf, 
  370|  1.17k|                                        &pc->pjsip_PARAM_CHAR_SPEC, 
  371|  1.17k|                                        &pc->pjsip_PARAM_CHAR_SPEC, ';');
  372|  1.17k|    if (printed < 0)
  ------------------
  |  Branch (372:9): [True: 0, False: 1.17k]
  ------------------
  373|      0|        return -1;
  374|  1.17k|    buf += printed;
  375|       |
  376|       |    /* Header param. 
  377|       |     * Header param is only allowed in these contexts:
  378|       |     *  - PJSIP_URI_IN_CONTACT_HDR
  379|       |     *  - PJSIP_URI_IN_OTHER
  380|       |     */
  381|  1.17k|    if (context == PJSIP_URI_IN_CONTACT_HDR || context == PJSIP_URI_IN_OTHER) {
  ------------------
  |  Branch (381:9): [True: 0, False: 1.17k]
  |  Branch (381:48): [True: 0, False: 1.17k]
  ------------------
  382|      0|        printed = (int)pjsip_param_print_on(&url->header_param, buf, endbuf-buf,
  383|      0|                                            &pc->pjsip_HDR_CHAR_SPEC, 
  384|      0|                                            &pc->pjsip_HDR_CHAR_SPEC, '?');
  385|      0|        if (printed < 0)
  ------------------
  |  Branch (385:13): [True: 0, False: 0]
  ------------------
  386|      0|            return -1;
  387|      0|        buf += printed;
  388|      0|    }
  389|       |
  390|  1.17k|    *buf = '\0';
  391|  1.17k|    return buf-startbuf;
  392|  1.17k|}
sip_uri.c:pjsip_url_compare:
  397|    678|{
  398|    678|    const pjsip_param *p1;
  399|       |
  400|       |    /*
  401|       |     * Compare two SIP URL's according to Section 19.1.4 of RFC 3261.
  402|       |     */
  403|       |
  404|       |    /* SIP and SIPS URI are never equivalent. 
  405|       |     * Note: just compare the vptr to avoid string comparison. 
  406|       |     *       Pretty neat huh!!
  407|       |     */
  408|    678|    if (url1->vptr != url2->vptr)
  ------------------
  |  Branch (408:9): [True: 16, False: 662]
  ------------------
  409|     16|        return PJSIP_ECMPSCHEME;
  ------------------
  |  |  260|     16|#define PJSIP_ECMPSCHEME        (PJSIP_ERRNO_START_PJSIP + 80)  /* 171080 */
  |  |  ------------------
  |  |  |  |   73|     16|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     16|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|     16|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|     16|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|     16|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|     16|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|     16|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|     16|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|     16|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  410|       |
  411|       |    /* Comparison of the userinfo of SIP and SIPS URIs is case-sensitive. 
  412|       |     * This includes userinfo containing passwords or formatted as 
  413|       |     * telephone-subscribers.
  414|       |     */
  415|    662|    if (pj_strcmp(&url1->user, &url2->user) != 0)
  ------------------
  |  Branch (415:9): [True: 84, False: 578]
  ------------------
  416|     84|        return PJSIP_ECMPUSER;
  ------------------
  |  |  265|     84|#define PJSIP_ECMPUSER          (PJSIP_ERRNO_START_PJSIP + 81)  /* 171081 */
  |  |  ------------------
  |  |  |  |   73|     84|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     84|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|     84|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|     84|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|     84|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|     84|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|     84|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|     84|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|     84|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  417|    578|    if (pj_strcmp(&url1->passwd, &url2->passwd) != 0)
  ------------------
  |  Branch (417:9): [True: 84, False: 494]
  ------------------
  418|     84|        return PJSIP_ECMPPASSWD;
  ------------------
  |  |  270|     84|#define PJSIP_ECMPPASSWD        (PJSIP_ERRNO_START_PJSIP + 82)  /* 171082 */
  |  |  ------------------
  |  |  |  |   73|     84|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     84|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|     84|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|     84|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|     84|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|     84|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|     84|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|     84|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|     84|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  419|       |    
  420|       |    /* Comparison of all other components of the URI is
  421|       |     * case-insensitive unless explicitly defined otherwise.
  422|       |     */
  423|       |
  424|       |    /* The ordering of parameters and header fields is not significant 
  425|       |     * in comparing SIP and SIPS URIs.
  426|       |     */
  427|       |
  428|       |    /* Characters other than those in the reserved set (see RFC 2396 [5])
  429|       |     * are equivalent to their encoding.
  430|       |     */
  431|       |
  432|       |    /* An IP address that is the result of a DNS lookup of a host name 
  433|       |     * does not match that host name.
  434|       |     */
  435|    494|    if (pj_stricmp(&url1->host, &url2->host) != 0)
  ------------------
  |  Branch (435:9): [True: 118, False: 376]
  ------------------
  436|    118|        return PJSIP_ECMPHOST;
  ------------------
  |  |  275|    118|#define PJSIP_ECMPHOST          (PJSIP_ERRNO_START_PJSIP + 83)  /* 171083 */
  |  |  ------------------
  |  |  |  |   73|    118|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    118|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|    118|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|    118|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|    118|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|    118|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|    118|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|    118|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|    118|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  437|       |
  438|       |    /* A URI omitting any component with a default value will not match a URI
  439|       |     * explicitly containing that component with its default value. 
  440|       |     * For instance, a URI omitting the optional port component will not match
  441|       |     * a URI explicitly declaring port 5060. 
  442|       |     * The same is true for the transport-parameter, ttl-parameter, 
  443|       |     * user-parameter, and method components.
  444|       |     */
  445|       |
  446|       |    /* Port is not allowed in To and From header.
  447|       |     */
  448|    376|    if (context != PJSIP_URI_IN_FROMTO_HDR) {
  ------------------
  |  Branch (448:9): [True: 188, False: 188]
  ------------------
  449|    188|        if (url1->port != url2->port)
  ------------------
  |  Branch (449:13): [True: 33, False: 155]
  ------------------
  450|     33|            return PJSIP_ECMPPORT;
  ------------------
  |  |  280|     33|#define PJSIP_ECMPPORT          (PJSIP_ERRNO_START_PJSIP + 84)  /* 171084 */
  |  |  ------------------
  |  |  |  |   73|     33|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     33|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|     33|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|     33|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|     33|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|     33|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|     33|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|     33|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|     33|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  451|    188|    }
  452|       |    /* Transport is not allowed in From/To header. */
  453|    343|    if (context != PJSIP_URI_IN_FROMTO_HDR) {
  ------------------
  |  Branch (453:9): [True: 155, False: 188]
  ------------------
  454|    155|        if (pj_stricmp(&url1->transport_param, &url2->transport_param) != 0)
  ------------------
  |  Branch (454:13): [True: 1, False: 154]
  ------------------
  455|      1|            return PJSIP_ECMPTRANSPORTPRM;
  ------------------
  |  |  285|      1|#define PJSIP_ECMPTRANSPORTPRM  (PJSIP_ERRNO_START_PJSIP + 85)  /* 171085 */
  |  |  ------------------
  |  |  |  |   73|      1|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      1|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      1|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      1|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      1|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      1|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  456|    155|    }
  457|       |    /* TTL param is not allowed in From, To, Route, and Record-Route header. */
  458|    342|    if (context != PJSIP_URI_IN_FROMTO_HDR &&
  ------------------
  |  Branch (458:9): [True: 154, False: 188]
  ------------------
  459|    154|        context != PJSIP_URI_IN_ROUTING_HDR)
  ------------------
  |  Branch (459:9): [True: 154, False: 0]
  ------------------
  460|    154|    {
  461|    154|        if (url1->ttl_param != url2->ttl_param)
  ------------------
  |  Branch (461:13): [True: 9, False: 145]
  ------------------
  462|      9|            return PJSIP_ECMPTTLPARAM;
  ------------------
  |  |  290|      9|#define PJSIP_ECMPTTLPARAM      (PJSIP_ERRNO_START_PJSIP + 86)  /* 171086 */
  |  |  ------------------
  |  |  |  |   73|      9|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      9|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      9|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      9|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      9|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      9|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      9|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      9|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      9|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  463|    154|    }
  464|       |    /* User param is allowed in all contexes */
  465|    333|    if (pj_stricmp(&url1->user_param, &url2->user_param) != 0)
  ------------------
  |  Branch (465:9): [True: 3, False: 330]
  ------------------
  466|      3|        return PJSIP_ECMPUSERPARAM;
  ------------------
  |  |  295|      3|#define PJSIP_ECMPUSERPARAM     (PJSIP_ERRNO_START_PJSIP + 87)  /* 171087 */
  |  |  ------------------
  |  |  |  |   73|      3|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      3|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      3|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      3|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      3|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      3|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      3|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      3|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      3|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  467|       |    /* Method param is only allowed in external/other context. */
  468|    330|    if (context == PJSIP_URI_IN_OTHER) {
  ------------------
  |  Branch (468:9): [True: 0, False: 330]
  ------------------
  469|      0|        if (pj_stricmp(&url1->method_param, &url2->method_param) != 0)
  ------------------
  |  Branch (469:13): [True: 0, False: 0]
  ------------------
  470|      0|            return PJSIP_ECMPMETHODPARAM;
  ------------------
  |  |  300|      0|#define PJSIP_ECMPMETHODPARAM   (PJSIP_ERRNO_START_PJSIP + 88)  /* 171088 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  471|      0|    }
  472|       |    /* maddr param is not allowed in From and To header. */
  473|    330|    if (context != PJSIP_URI_IN_FROMTO_HDR) {
  ------------------
  |  Branch (473:9): [True: 144, False: 186]
  ------------------
  474|    144|        if (pj_stricmp(&url1->maddr_param, &url2->maddr_param) != 0)
  ------------------
  |  Branch (474:13): [True: 1, False: 143]
  ------------------
  475|      1|            return PJSIP_ECMPMADDRPARAM;
  ------------------
  |  |  305|      1|#define PJSIP_ECMPMADDRPARAM    (PJSIP_ERRNO_START_PJSIP + 89)  /* 171089 */
  |  |  ------------------
  |  |  |  |   73|      1|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      1|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      1|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      1|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      1|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      1|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      1|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  476|    144|    }
  477|       |
  478|       |    /* lr parameter is ignored (?) */
  479|       |    /* lr param is not allowed in From, To, and Contact header. */
  480|       |
  481|       |
  482|       |    /* All other uri-parameters appearing in only one URI are ignored when 
  483|       |     * comparing the URIs.
  484|       |     */
  485|    329|    if (pjsip_param_cmp(&url1->other_param, &url2->other_param, 1)!=0)
  ------------------
  |  Branch (485:9): [True: 48, False: 281]
  ------------------
  486|     48|        return PJSIP_ECMPOTHERPARAM;
  ------------------
  |  |  310|     48|#define PJSIP_ECMPOTHERPARAM    (PJSIP_ERRNO_START_PJSIP + 90)  /* 171090 */
  |  |  ------------------
  |  |  |  |   73|     48|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     48|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|     48|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|     48|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|     48|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|     48|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|     48|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|     48|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|     48|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  487|       |
  488|       |    /* URI header components are never ignored. Any present header component
  489|       |     * MUST be present in both URIs and match for the URIs to match. 
  490|       |     * The matching rules are defined for each header field in Section 20.
  491|       |     */
  492|    281|    p1 = url1->header_param.next;
  493|    694|    while (p1 != &url1->header_param) {
  ------------------
  |  Branch (493:12): [True: 455, False: 239]
  ------------------
  494|    455|        const pjsip_param *p2;
  495|    455|        p2 = pjsip_param_find(&url2->header_param, &p1->name);
  496|    455|        if (p2) {
  ------------------
  |  Branch (496:13): [True: 442, False: 13]
  ------------------
  497|       |            /* It seems too much to compare two header params according to
  498|       |             * the rule of each header. We'll just compare them string to
  499|       |             * string..
  500|       |             */
  501|    442|            if (pj_stricmp(&p1->value, &p2->value) != 0)
  ------------------
  |  Branch (501:17): [True: 29, False: 413]
  ------------------
  502|     29|                return PJSIP_ECMPHEADERPARAM;
  ------------------
  |  |  315|     29|#define PJSIP_ECMPHEADERPARAM   (PJSIP_ERRNO_START_PJSIP + 91)  /* 171091 */
  |  |  ------------------
  |  |  |  |   73|     29|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     29|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|     29|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|     29|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|     29|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|     29|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|     29|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|     29|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|     29|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  503|    442|        } else {
  504|     13|            return PJSIP_ECMPHEADERPARAM;
  ------------------
  |  |  315|     13|#define PJSIP_ECMPHEADERPARAM   (PJSIP_ERRNO_START_PJSIP + 91)  /* 171091 */
  |  |  ------------------
  |  |  |  |   73|     13|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     13|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|     13|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|     13|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|     13|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|     13|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|     13|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|     13|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|     13|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  505|     13|        }
  506|    413|        p1 = p1->next;
  507|    413|    }
  508|       |
  509|       |    /* Equal!! Pheuww.. */
  510|    239|    return PJ_SUCCESS;
  511|    281|}
sip_uri.c:pjsip_url_clone:
  535|  4.92k|{
  536|  4.92k|    pjsip_sip_uri *url = PJ_POOL_ALLOC_T(pool, pjsip_sip_uri);
  ------------------
  |  |  569|  4.92k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  537|  4.92k|    if (!url)
  ------------------
  |  Branch (537:9): [True: 0, False: 4.92k]
  ------------------
  538|      0|        return NULL;
  539|       |
  540|  4.92k|    pjsip_sip_uri_init(url, IS_SIPS(rhs));
  ------------------
  |  |  143|  4.92k|#define IS_SIPS(url)    ((url)->vptr==&sips_url_vptr)
  ------------------
  541|  4.92k|    pjsip_sip_uri_assign(pool, url, rhs);
  542|  4.92k|    return url;
  543|  4.92k|}
sip_uri.c:pjsip_url_get_scheme:
  208|  2.04k|{
  209|  2.04k|    PJ_UNUSED_ARG(url);
  ------------------
  |  | 1537|  2.04k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  210|  2.04k|    return &sip_str;
  211|  2.04k|}
sip_uri.c:pjsip_name_addr_compare:
  624|    400|{
  625|    400|    int d;
  626|       |
  627|       |    /* Check that naddr2 is also a name_addr */
  628|    400|    if (naddr1->vptr != naddr2->vptr)
  ------------------
  |  Branch (628:9): [True: 2, False: 398]
  ------------------
  629|      2|        return -1;
  630|       |
  631|       |    /* I'm not sure whether display name is included in the comparison. */
  632|    398|    if (pj_strcmp(&naddr1->display, &naddr2->display) != 0) {
  ------------------
  |  Branch (632:9): [True: 340, False: 58]
  ------------------
  633|    340|        return -1;
  634|    340|    }
  635|       |
  636|     58|    pj_assert( naddr1->uri != NULL );
  ------------------
  |  |   65|     58|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (636:5): [True: 0, False: 58]
  |  Branch (636:5): [True: 58, False: 0]
  ------------------
  637|     58|    pj_assert( naddr2->uri != NULL );
  ------------------
  |  |   65|     58|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (637:5): [True: 0, False: 58]
  |  Branch (637:5): [True: 58, False: 0]
  ------------------
  638|       |
  639|       |    /* Compare name-addr as URL */
  640|     58|    d = pjsip_uri_cmp( context, naddr1->uri, naddr2->uri);
  641|     58|    if (d)
  ------------------
  |  Branch (641:9): [True: 48, False: 10]
  ------------------
  642|     48|        return d;
  643|       |
  644|     10|    return 0;
  645|     58|}
sip_uri.c:other_uri_cmp:
  713|    116|{
  714|    116|    PJ_UNUSED_ARG(context);
  ------------------
  |  | 1537|    116|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  715|       |
  716|       |    /* Check that uri2 is also an other_uri */
  717|    116|    if (uri1->vptr != uri2->vptr)
  ------------------
  |  Branch (717:9): [True: 4, False: 112]
  ------------------
  718|      4|        return -1;
  719|       |    
  720|       |    /* Scheme must match. */
  721|    112|    if (pj_stricmp(&uri1->scheme, &uri2->scheme) != 0) {
  ------------------
  |  Branch (721:9): [True: 72, False: 40]
  ------------------
  722|     72|        return PJSIP_ECMPSCHEME;
  ------------------
  |  |  260|     72|#define PJSIP_ECMPSCHEME        (PJSIP_ERRNO_START_PJSIP + 80)  /* 171080 */
  |  |  ------------------
  |  |  |  |   73|     72|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     72|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|     72|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|     72|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|     72|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|     72|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|     72|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|     72|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|     72|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  723|     72|    }
  724|       |    
  725|       |    /* Content must match. */
  726|     40|    if(pj_stricmp(&uri1->content, &uri2->content) != 0) {
  ------------------
  |  Branch (726:8): [True: 28, False: 12]
  ------------------
  727|     28|        return -1;
  728|     28|    }
  729|       |    
  730|       |    /* Equal. */
  731|     12|    return 0;
  732|     40|}
sip_uri.c:other_uri_clone:
  737|  1.06k|{
  738|  1.06k|    pjsip_other_uri *uri = pjsip_other_uri_create(pool);
  739|  1.06k|    pj_strdup(pool, &uri->scheme, &rhs->scheme);
  740|  1.06k|    pj_strdup(pool, &uri->content, &rhs->content);
  741|       |
  742|  1.06k|    return uri;
  743|  1.06k|}

pjsip_target_set_add_uri:
   58|     87|{
   59|     87|    pjsip_target *t, *pos = NULL;
   60|       |
   61|     87|    PJ_ASSERT_RETURN(tset && pool && uri, PJ_EINVAL);
  ------------------
  |  |   97|     87|            do { \
  |  |   98|    348|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  |  Branch (98:23): [True: 87, False: 0]
  |  |  ------------------
  |  |   99|     87|            } while (0)
  |  |  ------------------
  |  |  |  Branch (99:22): [Folded, False: 87]
  |  |  ------------------
  ------------------
  |  Branch (61:5): [True: 0, False: 0]
  |  Branch (61:5): [True: 0, False: 0]
  |  Branch (61:5): [True: 0, False: 0]
  |  Branch (61:5): [True: 0, False: 0]
  |  Branch (61:5): [True: 0, False: 0]
  |  Branch (61:5): [True: 0, False: 0]
  ------------------
   62|       |
   63|       |    /* Set q-value to 1 if it is not set */
   64|     87|    if (q1000 <= 0)
  ------------------
  |  Branch (64:9): [True: 87, False: 0]
  ------------------
   65|     87|        q1000 = 1000;
   66|       |
   67|       |    /* Scan all the elements to see for duplicates, and at the same time
   68|       |     * get the position where the new element should be inserted to
   69|       |     * based on the q-value.
   70|       |     */
   71|     87|    t = tset->head.next;
   72|     87|    while (t != &tset->head) {
  ------------------
  |  Branch (72:12): [True: 0, False: 87]
  ------------------
   73|      0|        if (pjsip_uri_cmp(PJSIP_URI_IN_REQ_URI, t->uri, uri)==PJ_SUCCESS)
  ------------------
  |  Branch (73:13): [True: 0, False: 0]
  ------------------
   74|      0|            return PJ_EEXISTS;
  ------------------
  |  |  448|      0|#define PJ_EEXISTS          (PJ_ERRNO_START_STATUS + 15)/* 70015 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   75|      0|        if (pos==NULL && t->q1000 < q1000)
  ------------------
  |  Branch (75:13): [True: 0, False: 0]
  |  Branch (75:26): [True: 0, False: 0]
  ------------------
   76|      0|            pos = t;
   77|      0|        t = t->next;
   78|      0|    }
   79|       |
   80|       |    /* Create new element */
   81|     87|    t = PJ_POOL_ZALLOC_T(pool, pjsip_target);
  ------------------
  |  |  583|     87|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
   82|     87|    t->uri = (pjsip_uri*)pjsip_uri_clone(pool, uri);
   83|     87|    t->q1000 = q1000;
   84|       |
   85|       |    /* Insert */
   86|     87|    if (pos == NULL)
  ------------------
  |  Branch (86:9): [True: 87, False: 0]
  ------------------
   87|     87|        pj_list_push_back(&tset->head, t);
   88|      0|    else
   89|      0|        pj_list_insert_before(pos, t);
   90|       |
   91|       |    /* Set current target if this is the first URI */
   92|     87|    if (tset->current == NULL)
  ------------------
  |  Branch (92:9): [True: 87, False: 0]
  ------------------
   93|     87|        tset->current = t;
   94|       |
   95|     87|    return PJ_SUCCESS;
   96|     87|}
pjsip_endpt_create_request:
  300|    605|{
  301|    605|    pjsip_uri *target;
  302|    605|    pjsip_tx_data *tdata;
  303|    605|    pjsip_from_hdr *from;
  304|    605|    pjsip_to_hdr *to;
  305|    605|    pjsip_contact_hdr *contact;
  306|    605|    pjsip_cseq_hdr *cseq = NULL;    /* = NULL, warning in VC6 */
  307|    605|    pjsip_cid_hdr *call_id;
  308|    605|    pj_str_t tmp;
  309|    605|    pj_status_t status;
  310|    605|    const pj_str_t STR_CONTACT = { "Contact", 7 };
  311|    605|    PJ_USE_EXCEPTION;
  ------------------
  |  |  367|    605|#define PJ_USE_EXCEPTION    struct pj_exception_state_t pj_x_except__; int pj_x_code__
  ------------------
  312|       |
  313|    605|    status = pjsip_endpt_create_tdata(endpt, &tdata);
  314|    605|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (314:9): [True: 0, False: 605]
  ------------------
  315|      0|        return status;
  316|       |
  317|       |    /* Init reference counter to 1. */
  318|    605|    pjsip_tx_data_add_ref(tdata);
  319|       |
  320|    605|    PJ_TRY {
  ------------------
  |  |  373|    605|#define PJ_TRY              if (1) { \
  |  |  ------------------
  |  |  |  Branch (373:33): [True: 605, Folded]
  |  |  ------------------
  |  |  374|    605|                                pj_push_exception_handler_(&pj_x_except__); \
  |  |  375|    605|                                pj_x_code__ = pj_setjmp(pj_x_except__.state); \
  |  |  ------------------
  |  |  |  |   31|    605|#    define pj_setjmp(buf)      setjmp(buf)
  |  |  ------------------
  |  |  376|    605|                                if (pj_x_code__ == 0)
  |  |  ------------------
  |  |  |  Branch (376:37): [True: 605, False: 0]
  |  |  ------------------
  ------------------
  321|       |        /* Request target. */
  322|    605|        pj_strdup_with_null(tdata->pool, &tmp, param_target);
  323|    605|        target = pjsip_parse_uri( tdata->pool, tmp.ptr, tmp.slen, 0);
  324|    605|        if (target == NULL) {
  ------------------
  |  Branch (324:13): [True: 0, False: 605]
  ------------------
  325|      0|            status = PJSIP_EINVALIDREQURI;
  ------------------
  |  |  159|      0|#define PJSIP_EINVALIDREQURI    (PJSIP_ERRNO_START_PJSIP + 42)  /* 171042 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  326|      0|            goto on_error;
  327|      0|        }
  328|       |
  329|       |        /* From */
  330|    605|        from = pjsip_from_hdr_create(tdata->pool);
  331|    605|        pj_strdup_with_null(tdata->pool, &tmp, param_from);
  332|    605|        from->uri = pjsip_parse_uri( tdata->pool, tmp.ptr, tmp.slen, 
  333|    605|                                     PJSIP_PARSE_URI_AS_NAMEADDR);
  334|    605|        if (from->uri == NULL) {
  ------------------
  |  Branch (334:13): [True: 0, False: 605]
  ------------------
  335|      0|            status = PJSIP_EINVALIDHDR;
  ------------------
  |  |  175|      0|#define PJSIP_EINVALIDHDR       (PJSIP_ERRNO_START_PJSIP + 51)  /* 171051 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  336|      0|            goto on_error;
  337|      0|        }
  338|    605|        pj_create_unique_string(tdata->pool, &from->tag);
  339|       |
  340|       |        /* To */
  341|    605|        to = pjsip_to_hdr_create(tdata->pool);
  342|    605|        pj_strdup_with_null(tdata->pool, &tmp, param_to);
  343|    605|        to->uri = pjsip_parse_uri( tdata->pool, tmp.ptr, tmp.slen, 
  344|    605|                                   PJSIP_PARSE_URI_AS_NAMEADDR);
  345|    605|        if (to->uri == NULL) {
  ------------------
  |  Branch (345:13): [True: 0, False: 605]
  ------------------
  346|      0|            status = PJSIP_EINVALIDHDR;
  ------------------
  |  |  175|      0|#define PJSIP_EINVALIDHDR       (PJSIP_ERRNO_START_PJSIP + 51)  /* 171051 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  347|      0|            goto on_error;
  348|      0|        }
  349|       |
  350|       |        /* Contact. */
  351|    605|        if (param_contact) {
  ------------------
  |  Branch (351:13): [True: 604, False: 1]
  ------------------
  352|    604|            pj_strdup_with_null(tdata->pool, &tmp, param_contact);
  353|    604|            contact = (pjsip_contact_hdr*)
  354|    604|                      pjsip_parse_hdr(tdata->pool, &STR_CONTACT, tmp.ptr, 
  355|    604|                                      tmp.slen, NULL);
  356|    604|            if (contact == NULL) {
  ------------------
  |  Branch (356:17): [True: 0, False: 604]
  ------------------
  357|      0|                status = PJSIP_EINVALIDHDR;
  ------------------
  |  |  175|      0|#define PJSIP_EINVALIDHDR       (PJSIP_ERRNO_START_PJSIP + 51)  /* 171051 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  528|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  358|      0|                goto on_error;
  359|      0|            }
  360|    604|        } else {
  361|      1|            contact = NULL;
  362|      1|        }
  363|       |
  364|       |        /* Call-ID */
  365|    605|        call_id = pjsip_cid_hdr_create(tdata->pool);
  366|    605|        if (param_call_id != NULL && param_call_id->slen)
  ------------------
  |  Branch (366:13): [True: 1, False: 604]
  |  Branch (366:38): [True: 1, False: 0]
  ------------------
  367|      1|            pj_strdup(tdata->pool, &call_id->id, param_call_id);
  368|    604|        else
  369|    604|            pj_create_unique_string(tdata->pool, &call_id->id);
  370|       |
  371|       |        /* CSeq */
  372|    605|        cseq = pjsip_cseq_hdr_create(tdata->pool);
  373|    605|        if (param_cseq >= 0)
  ------------------
  |  Branch (373:13): [True: 0, False: 605]
  ------------------
  374|      0|            cseq->cseq = param_cseq;
  375|    605|        else
  376|    605|            cseq->cseq = pj_rand() & 0xFFFF;
  377|       |
  378|       |        /* Method */
  379|    605|        pjsip_method_copy(tdata->pool, &cseq->method, method);
  380|       |
  381|       |        /* Create the request. */
  382|    605|        init_request_throw( endpt, tdata, &cseq->method, target, from, to, 
  383|    605|                            contact, call_id, cseq, param_text);
  384|    605|    }
  385|      0|    PJ_CATCH_ANY {
  386|      0|        status = PJ_ENOMEM;
  ------------------
  |  |  408|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  521|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  515|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  387|      0|        goto on_error;
  388|      0|    }
  389|    605|    PJ_END
  ------------------
  |  |  394|    605|#define PJ_END                  pj_pop_exception_handler_(&pj_x_except__); \
  |  |  395|    605|                            } else {}
  ------------------
  390|       |
  391|    605|    *p_tdata = tdata;
  392|    605|    return PJ_SUCCESS;
  393|       |
  394|      0|on_error:
  395|      0|    pjsip_tx_data_dec_ref(tdata);
  396|      0|    return status;
  397|    605|}
pjsip_restore_strict_route_set:
 1079|    282|{
 1080|    282|    pjsip_route_hdr *first_route_hdr, *last_route_hdr;
 1081|       |
 1082|       |    /* Check if we have found strict route before */
 1083|    282|    if (tdata->saved_strict_route == NULL) {
  ------------------
  |  Branch (1083:9): [True: 282, False: 0]
  ------------------
 1084|       |        /* This request doesn't contain strict route */
 1085|    282|        return;
 1086|    282|    }
 1087|       |
 1088|       |    /* Find the first "Route" headers from the message. */
 1089|      0|    first_route_hdr = (pjsip_route_hdr*)
 1090|      0|                      pjsip_msg_find_hdr(tdata->msg, PJSIP_H_ROUTE, NULL);
 1091|       |
 1092|      0|    if (first_route_hdr == NULL) {
  ------------------
  |  Branch (1092:9): [True: 0, False: 0]
  ------------------
 1093|       |        /* User has modified message route? We don't expect this! */
 1094|      0|        pj_assert(!"Message route was modified?");
  ------------------
  |  |   65|      0|#       define pj_assert(expr)   assert(expr)
  ------------------
  |  Branch (1094:9): [Folded, False: 0]
  |  Branch (1094:9): [Folded, False: 0]
  ------------------
 1095|      0|        tdata->saved_strict_route = NULL;
 1096|      0|        return;
 1097|      0|    }
 1098|       |
 1099|       |    /* Find last Route header */
 1100|      0|    last_route_hdr = first_route_hdr;
 1101|      0|    while (last_route_hdr->next != (void*)&tdata->msg->hdr) {
  ------------------
  |  Branch (1101:12): [True: 0, False: 0]
  ------------------
 1102|      0|        pjsip_route_hdr *hdr;
 1103|      0|        hdr = (pjsip_route_hdr*)
 1104|      0|              pjsip_msg_find_hdr(tdata->msg, PJSIP_H_ROUTE, 
 1105|      0|                                 last_route_hdr->next);
 1106|      0|        if (!hdr)
  ------------------
  |  Branch (1106:13): [True: 0, False: 0]
  ------------------
 1107|      0|            break;
 1108|      0|        last_route_hdr = hdr;
 1109|      0|    }
 1110|       |
 1111|       |    /* Put the last Route header as request URI, delete last Route
 1112|       |     * header, and insert the saved strict route as the first Route.
 1113|       |     */
 1114|      0|    tdata->msg->line.req.uri = last_route_hdr->name_addr.uri;
 1115|      0|    pj_list_insert_before(first_route_hdr, tdata->saved_strict_route);
 1116|      0|    pj_list_erase(last_route_hdr);
 1117|       |
 1118|       |    /* Reset */
 1119|       |    tdata->saved_strict_route = NULL;
 1120|      0|}
sip_util.c:init_request_throw:
  205|    605|{
  206|    605|    pjsip_msg *msg;
  207|    605|    pjsip_msg_body *body;
  208|    605|    pjsip_via_hdr *via;
  209|    605|    const pjsip_hdr *endpt_hdr;
  210|       |
  211|       |    /* Create the message. */
  212|    605|    msg = tdata->msg = pjsip_msg_create(tdata->pool, PJSIP_REQUEST_MSG);
  213|       |
  214|       |    /* Init request URI. */
  215|    605|    pj_memcpy(&msg->line.req.method, method, sizeof(*method));
  216|    605|    msg->line.req.uri = param_target;
  217|       |
  218|       |    /* Add additional request headers from endpoint. */
  219|    605|    endpt_hdr = pjsip_endpt_get_request_headers(endpt)->next;
  220|  1.21k|    while (endpt_hdr != pjsip_endpt_get_request_headers(endpt)) {
  ------------------
  |  Branch (220:12): [True: 605, False: 605]
  ------------------
  221|    605|        pjsip_hdr *hdr = (pjsip_hdr*) 
  222|    605|                         pjsip_hdr_shallow_clone(tdata->pool, endpt_hdr);
  223|    605|        pjsip_msg_add_hdr( tdata->msg, hdr );
  224|    605|        endpt_hdr = endpt_hdr->next;
  225|    605|    }
  226|       |
  227|       |    /* Add From header. */
  228|    605|    if (param_from->tag.slen == 0)
  ------------------
  |  Branch (228:9): [True: 0, False: 605]
  ------------------
  229|      0|        pj_create_unique_string(tdata->pool, &param_from->tag);
  230|    605|    pjsip_msg_add_hdr(msg, (pjsip_hdr*)param_from);
  231|       |
  232|       |    /* Add To header. */
  233|    605|    pjsip_msg_add_hdr(msg, (pjsip_hdr*)param_to);
  234|       |
  235|       |    /* Add Contact header. */
  236|    605|    if (param_contact) {
  ------------------
  |  Branch (236:9): [True: 604, False: 1]
  ------------------
  237|    604|        pjsip_msg_add_hdr(msg, (pjsip_hdr*)param_contact);
  238|    604|    }
  239|       |
  240|       |    /* Add Call-ID header. */
  241|    605|    pjsip_msg_add_hdr(msg, (pjsip_hdr*)param_call_id);
  242|       |
  243|       |    /* Add CSeq header. */
  244|    605|    pjsip_msg_add_hdr(msg, (pjsip_hdr*)param_cseq);
  245|       |
  246|       |    /* Add a blank Via header in the front of the message. */
  247|    605|    via = pjsip_via_hdr_create(tdata->pool);
  248|    605|    via->rport_param = pjsip_cfg()->endpt.disable_rport ? -1 : 0;
  ------------------
  |  Branch (248:24): [True: 0, False: 605]
  ------------------
  249|    605|    pjsip_msg_insert_first_hdr(msg, (pjsip_hdr*)via);
  250|       |
  251|       |    /* Add header params as request headers */
  252|    605|    if (PJSIP_URI_SCHEME_IS_SIP(param_target) || 
  ------------------
  |  |  234|  1.21k|    (pj_stricmp2(pjsip_uri_get_scheme(url), "sip")==0)
  |  |  ------------------
  |  |  |  Branch (234:5): [True: 605, False: 0]
  |  |  ------------------
  ------------------
  253|      0|        PJSIP_URI_SCHEME_IS_SIPS(param_target)) 
  ------------------
  |  |  242|      0|    (pj_stricmp2(pjsip_uri_get_scheme(url), "sips")==0)
  |  |  ------------------
  |  |  |  Branch (242:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  254|    605|    {
  255|    605|        pjsip_sip_uri *uri = (pjsip_sip_uri*) pjsip_uri_get_uri(param_target);
  256|    605|        pjsip_param *hparam;
  257|       |
  258|    605|        hparam = uri->header_param.next;
  259|    605|        while (hparam != &uri->header_param) {
  ------------------
  |  Branch (259:16): [True: 0, False: 605]
  ------------------
  260|      0|            pjsip_generic_string_hdr *hdr;
  261|       |
  262|      0|            hdr = pjsip_generic_string_hdr_create(tdata->pool, 
  263|      0|                                                  &hparam->name,
  264|      0|                                                  &hparam->value);
  265|      0|            pjsip_msg_add_hdr(msg, (pjsip_hdr*)hdr);
  266|      0|            hparam = hparam->next;
  267|      0|        }
  268|    605|    }
  269|       |
  270|       |    /* Create message body. */
  271|    605|    if (param_text) {
  ------------------
  |  Branch (271:9): [True: 0, False: 605]
  ------------------
  272|      0|        body = PJ_POOL_ZALLOC_T(tdata->pool, pjsip_msg_body);
  ------------------
  |  |  583|      0|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  273|      0|        body->content_type.type = str_TEXT;
  274|      0|        body->content_type.subtype = str_PLAIN;
  275|      0|        body->data = pj_pool_alloc(tdata->pool, param_text->slen );
  276|      0|        pj_memcpy(body->data, param_text->ptr, param_text->slen);
  277|      0|        body->len = (unsigned)param_text->slen;
  278|      0|        body->print_body = &pjsip_print_text_body;
  279|      0|        msg->body = body;
  280|      0|    }
  281|       |
  282|    605|    PJ_LOG(5,(THIS_FILE, "%s created.", 
  ------------------
  |  |  106|    605|#define PJ_LOG(level,arg)       do { \
  |  |  107|    605|                                    if (level <= PJ_LOG_MAX_LEVEL && level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  |  417|  1.21k|#  define PJ_LOG_MAX_LEVEL   5
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 605, Folded]
  |  |  |  Branch (107:70): [True: 0, False: 605]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  ------------------
  |  |  |  |  496|      0|    #define pj_log_wrapper_5(arg)       pj_log_5 arg
  |  |  ------------------
  |  |  109|      0|                                    } \
  |  |  110|    605|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded, False: 605]
  |  |  ------------------
  ------------------
  283|    605|                         pjsip_tx_data_get_info(tdata)));
  284|       |
  285|    605|}

LLVMFuzzerTestOneInput:
  353|  6.12k|{
  354|  6.12k|    char *DataFx;
  355|  6.12k|    pj_pool_t *pool;
  356|  6.12k|    pjsip_msg *msg;
  357|  6.12k|    static int initialized = 0;
  358|       |
  359|  6.12k|    if (Size < kMinInputLength || Size > kMaxInputLength)
  ------------------
  |  |   39|  12.2k|#define kMinInputLength 10
  ------------------
                  if (Size < kMinInputLength || Size > kMaxInputLength)
  ------------------
  |  |   40|  6.11k|#define kMaxInputLength 5120
  ------------------
  |  Branch (359:9): [True: 6, False: 6.11k]
  |  Branch (359:35): [True: 14, False: 6.10k]
  ------------------
  360|     20|        return 1;
  361|       |
  362|  6.10k|    DataFx = (char *)calloc((Size+1), sizeof(char));
  363|  6.10k|    if (DataFx == NULL)
  ------------------
  |  Branch (363:9): [True: 0, False: 6.10k]
  ------------------
  364|      0|        return 0;
  365|  6.10k|    memcpy((void *)DataFx, (void *)Data, Size);
  366|       |
  367|  6.10k|    if (!initialized) {
  ------------------
  |  Branch (367:9): [True: 1, False: 6.09k]
  ------------------
  368|      1|        pj_log_set_level(0);
  369|       |
  370|      1|        if (pj_init() != PJ_SUCCESS || pjlib_util_init() != PJ_SUCCESS) {
  ------------------
  |  Branch (370:13): [True: 0, False: 1]
  |  Branch (370:40): [True: 0, False: 1]
  ------------------
  371|      0|            free(DataFx);
  372|      0|            return 0;
  373|      0|        }
  374|       |
  375|      1|        pj_caching_pool_init(&caching_pool, &pj_pool_factory_default_policy,
  376|      1|                            PJSIP_TEST_MEM_SIZE);
  ------------------
  |  |   37|      1|#define PJSIP_TEST_MEM_SIZE         (2*1024*1024)
  ------------------
  377|       |
  378|      1|        if (pjsip_endpt_create(&caching_pool.factory, "endpt", &endpt) != PJ_SUCCESS || !endpt) {
  ------------------
  |  Branch (378:13): [True: 0, False: 1]
  |  Branch (378:89): [True: 0, False: 1]
  ------------------
  379|      0|            free(DataFx);
  380|      0|            return 0;
  381|      0|        }
  382|       |
  383|      1|        if (pjsip_tsx_layer_init_module(endpt) != PJ_SUCCESS ||
  ------------------
  |  Branch (383:13): [True: 0, False: 1]
  ------------------
  384|      1|            pjsip_loop_start(endpt, NULL) != PJ_SUCCESS) {
  ------------------
  |  Branch (384:13): [True: 0, False: 1]
  ------------------
  385|      0|            free(DataFx);
  386|      0|            return 0;
  387|      0|        }
  388|       |
  389|      1|        pjsip_ua_init_module(endpt, NULL);
  390|       |
  391|       |        /* Initialize transaction user module */
  392|      1|        pj_bzero(&tsx_user_module, sizeof(tsx_user_module));
  393|      1|        tsx_user_module.name = pj_str("tsx-user");
  394|      1|        tsx_user_module.id = -1;
  395|      1|        tsx_user_module.priority = PJSIP_MOD_PRIORITY_APPLICATION;
  396|      1|        tsx_user_module.on_tsx_state = &on_tsx_state;
  397|      1|        pjsip_endpt_register_module(endpt, &tsx_user_module);
  398|       |
  399|      1|        do_test_transaction_synthetic();
  400|       |
  401|      1|        initialized = 1;
  402|      1|    }
  403|       |
  404|  6.10k|    pool = pjsip_endpt_create_pool(endpt, NULL, POOL_SIZE, POOL_SIZE);
  ------------------
  |  |   36|  6.10k|#define POOL_SIZE       8000
  ------------------
                  pool = pjsip_endpt_create_pool(endpt, NULL, POOL_SIZE, POOL_SIZE);
  ------------------
  |  |   36|  6.10k|#define POOL_SIZE       8000
  ------------------
  405|  6.10k|    msg = parse_message(pool, DataFx, Size);
  406|       |
  407|  6.10k|    if (msg) {
  ------------------
  |  Branch (407:9): [True: 2.98k, False: 3.11k]
  ------------------
  408|  2.98k|        pjsip_rx_data rdata;
  409|  2.98k|        pj_sockaddr_in remote_addr;
  410|  2.98k|        pjsip_transport *fake_transport = NULL;
  411|  2.98k|        int i;
  412|       |
  413|  2.98k|        do_test_multipart(pool, msg);
  414|       |
  415|       |        /* Test named headers */
  416|  2.98k|        const char *hdr_names[] = {
  417|  2.98k|            "Replaces", "Refer-To", "Refer-Sub", "Subscription-State",
  418|  2.98k|            "Session-Expires", "Min-SE", "RSeq", "RAck"
  419|  2.98k|        };
  420|  26.9k|        for (i = 0; i < (int)(sizeof(hdr_names) / sizeof(hdr_names[0])); i++) {
  ------------------
  |  Branch (420:21): [True: 23.9k, False: 2.98k]
  ------------------
  421|  23.9k|            pj_str_t hdr_name = pj_str((char *)hdr_names[i]);
  422|  23.9k|            pjsip_msg_find_hdr_by_name(msg, &hdr_name, NULL);
  423|  23.9k|        }
  424|       |
  425|       |        /* Test standard header types */
  426|  23.9k|        for (i = 0; i < (int)(sizeof(hdr_types) / sizeof(hdr_types[0])); i++) {
  ------------------
  |  Branch (426:21): [True: 20.9k, False: 2.98k]
  ------------------
  427|  20.9k|            pjsip_msg_find_hdr(msg, hdr_types[i], NULL);
  428|  20.9k|        }
  429|       |
  430|       |        /* Setup rx_data for transaction testing */
  431|  2.98k|        pj_bzero(&rdata, sizeof(rdata));
  432|  2.98k|        rdata.msg_info.msg = msg;
  433|  2.98k|        rdata.msg_info.len = Size;
  434|  2.98k|        rdata.msg_info.info = DataFx;
  435|  2.98k|        rdata.tp_info.pool = pool;
  436|       |
  437|       |        /* Populate header shortcuts */
  438|  2.98k|        rdata.msg_info.from = (pjsip_from_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_FROM, NULL);
  439|  2.98k|        rdata.msg_info.to = (pjsip_to_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_TO, NULL);
  440|  2.98k|        rdata.msg_info.via = (pjsip_via_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_VIA, NULL);
  441|  2.98k|        rdata.msg_info.cseq = (pjsip_cseq_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_CSEQ, NULL);
  442|  2.98k|        rdata.msg_info.cid = (pjsip_cid_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_CALL_ID, NULL);
  443|  2.98k|        rdata.msg_info.max_fwd = (pjsip_max_fwd_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_MAX_FORWARDS, NULL);
  444|       |
  445|       |        /* Setup transport info */
  446|  2.98k|        pj_bzero(&remote_addr, sizeof(remote_addr));
  447|  2.98k|        remote_addr.sin_family = PJ_AF_INET;
  448|  2.98k|        remote_addr.sin_addr.s_addr = pj_htonl(0x7F000001);
  449|  2.98k|        remote_addr.sin_port = pj_htons(5060);
  450|       |
  451|  2.98k|        pj_memcpy(&rdata.pkt_info.src_addr, &remote_addr, sizeof(remote_addr));
  452|  2.98k|        rdata.pkt_info.src_addr_len = sizeof(remote_addr);
  453|  2.98k|        if (Size < sizeof(rdata.pkt_info.packet)) {
  ------------------
  |  Branch (453:13): [True: 2.92k, False: 67]
  ------------------
  454|  2.92k|            pj_memcpy(rdata.pkt_info.packet, DataFx, Size);
  455|  2.92k|            rdata.pkt_info.len = Size;
  456|  2.92k|        } else {
  457|     67|            pj_memcpy(rdata.pkt_info.packet, DataFx, sizeof(rdata.pkt_info.packet));
  458|     67|            rdata.pkt_info.len = sizeof(rdata.pkt_info.packet);
  459|     67|        }
  460|       |
  461|       |        /* Acquire dummy UDP transport */
  462|  2.98k|        if (pjsip_endpt_acquire_transport(endpt, PJSIP_TRANSPORT_UDP,
  ------------------
  |  Branch (462:13): [True: 0, False: 2.98k]
  ------------------
  463|  2.98k|                                          &remote_addr, sizeof(remote_addr),
  464|  2.98k|                                          NULL, &fake_transport) == PJ_SUCCESS) {
  465|      0|            rdata.tp_info.transport = fake_transport;
  466|      0|        }
  467|       |
  468|  2.98k|        do_test_transaction_layer(msg, &rdata);
  469|       |
  470|  2.98k|        if (msg->type == PJSIP_RESPONSE_MSG) {
  ------------------
  |  Branch (470:13): [True: 2.85k, False: 134]
  ------------------
  471|  2.85k|            do_test_transaction_uac(msg, &rdata);
  472|  2.85k|        }
  473|       |
  474|  2.98k|        do_test_auth_client(pool, msg);
  475|  2.98k|        do_test_dialog(msg);
  476|       |
  477|       |        /* Release transport */
  478|  2.98k|        if (fake_transport) {
  ------------------
  |  Branch (478:13): [True: 0, False: 2.98k]
  ------------------
  479|      0|            pjsip_transport_dec_ref(fake_transport);
  480|      0|        }
  481|  2.98k|    }
  482|       |
  483|  6.10k|    do_test_tel_uri(pool, DataFx, Size);
  484|       |
  485|  6.10k|    pjsip_endpt_release_pool(endpt, pool);
  486|  6.10k|    free(DataFx);
  487|       |
  488|  6.10k|    return 0;
  489|  6.10k|}
fuzz-sip.c:do_test_transaction_synthetic:
  190|      1|{
  191|      1|    pj_str_t target_uri_str = pj_str("sip:test@example.com");
  192|      1|    pj_str_t from_str = pj_str("sip:caller@example.com");
  193|      1|    pj_str_t to_str = pj_str("sip:callee@example.com");
  194|      1|    pj_str_t call_id_str = pj_str("call-id-fuzz-test@example.com");
  195|      1|    pjsip_tx_data *tdata;
  196|       |
  197|      1|    if (pjsip_endpt_create_request(endpt, &pjsip_invite_method,
  ------------------
  |  Branch (197:9): [True: 1, False: 0]
  ------------------
  198|      1|                                   &target_uri_str, &from_str, &to_str,
  199|      1|                                   NULL, &call_id_str, -1, NULL, &tdata) == PJ_SUCCESS) {
  200|      1|        pjsip_tx_data_dec_ref(tdata);
  201|      1|    }
  202|      1|}
fuzz-sip.c:parse_message:
   64|  6.10k|{
   65|  6.10k|    pjsip_parser_err_report err_list;
   66|  6.10k|    pj_list_init(&err_list);
   67|  6.10k|    return pjsip_parse_msg(pool, data, size, &err_list);
   68|  6.10k|}
fuzz-sip.c:do_test_multipart:
   72|  2.98k|{
   73|  2.98k|    if (!msg->body)
  ------------------
  |  Branch (73:9): [True: 2.80k, False: 183]
  ------------------
   74|  2.80k|        return;
   75|       |
   76|    183|    pjsip_msg_body *body = msg->body;
   77|       |
   78|    183|    if (body->content_type.type.slen > 0 &&
  ------------------
  |  Branch (78:9): [True: 183, False: 0]
  ------------------
   79|    183|        pj_stricmp2(&body->content_type.type, "multipart") == 0)
  ------------------
  |  Branch (79:9): [True: 71, False: 112]
  ------------------
   80|     71|    {
   81|     71|        pjsip_msg_body *multipart_body = NULL;
   82|     71|        if (body->data && body->len > 0) {
  ------------------
  |  Branch (82:13): [True: 71, False: 0]
  |  Branch (82:27): [True: 0, False: 71]
  ------------------
   83|      0|            multipart_body = pjsip_multipart_parse(pool, (char *)body->data,
   84|      0|                                                   body->len, &body->content_type, 0);
   85|      0|            if (!multipart_body)
  ------------------
  |  Branch (85:17): [True: 0, False: 0]
  ------------------
   86|      0|                return;
   87|     71|        } else {
   88|     71|            multipart_body = body;
   89|     71|        }
   90|       |
   91|     71|        pjsip_multipart_part *part = pjsip_multipart_get_first_part(multipart_body);
   92|       |
   93|  6.69k|        while (part) {
  ------------------
  |  Branch (93:16): [True: 6.61k, False: 71]
  ------------------
   94|  6.61k|            pjsip_media_type ctype_app, ctype_text;
   95|       |
   96|  6.61k|            ctype_app.type = pj_str("application");
   97|  6.61k|            ctype_app.subtype = pj_str("sdp");
   98|  6.61k|            ctype_text.type = pj_str("text");
   99|  6.61k|            ctype_text.subtype = pj_str("plain");
  100|       |
  101|  6.61k|            pjsip_multipart_find_part(multipart_body, &ctype_app, NULL);
  102|  6.61k|            pjsip_multipart_find_part(multipart_body, &ctype_text, NULL);
  103|       |
  104|  6.61k|            part = pjsip_multipart_get_next_part(multipart_body, part);
  105|  6.61k|        }
  106|       |
  107|     71|        pjsip_media_type search_type;
  108|     71|        search_type.type = pj_str("application");
  109|     71|        search_type.subtype = pj_str("sdp");
  110|       |        pjsip_multipart_find_part(multipart_body, &search_type, NULL);
  111|     71|    }
  112|    183|}
fuzz-sip.c:do_test_transaction_layer:
  145|  2.98k|{
  146|  2.98k|    pj_str_t tsx_key;
  147|  2.98k|    pjsip_via_hdr *via_hdr;
  148|       |
  149|  2.98k|    if (!msg || msg->type != PJSIP_REQUEST_MSG || !rdata)
  ------------------
  |  Branch (149:9): [True: 0, False: 2.98k]
  |  Branch (149:17): [True: 2.85k, False: 134]
  |  Branch (149:51): [True: 0, False: 134]
  ------------------
  150|  2.85k|        return;
  151|       |
  152|       |    /* Verify required headers exist */
  153|    134|    if (!pjsip_msg_find_hdr(msg, PJSIP_H_CALL_ID, NULL) ||
  ------------------
  |  Branch (153:9): [True: 130, False: 4]
  ------------------
  154|      4|        !pjsip_msg_find_hdr(msg, PJSIP_H_CSEQ, NULL))
  ------------------
  |  Branch (154:9): [True: 1, False: 3]
  ------------------
  155|    131|        return;
  156|       |
  157|      3|    via_hdr = (pjsip_via_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_VIA, NULL);
  158|      3|    if (!via_hdr)
  ------------------
  |  Branch (158:9): [True: 1, False: 2]
  ------------------
  159|      1|        return;
  160|       |
  161|       |    /* Skip transaction creation if transport not available */
  162|      2|    if (!rdata->tp_info.transport)
  ------------------
  |  Branch (162:9): [True: 2, False: 0]
  ------------------
  163|      2|        return;
  164|       |
  165|       |    /* Ensure From/To headers have tags */
  166|      0|    pjsip_from_hdr *from_hdr = (pjsip_from_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_FROM, NULL);
  167|      0|    pjsip_to_hdr *to_hdr = (pjsip_to_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_TO, NULL);
  168|       |
  169|      0|    if (from_hdr && pj_stricmp2(&from_hdr->tag, "") == 0)
  ------------------
  |  Branch (169:9): [True: 0, False: 0]
  |  Branch (169:21): [True: 0, False: 0]
  ------------------
  170|      0|        from_hdr->tag = pj_str("from-tag-123");
  171|       |
  172|      0|    if (to_hdr && pj_stricmp2(&to_hdr->tag, "") == 0)
  ------------------
  |  Branch (172:9): [True: 0, False: 0]
  |  Branch (172:19): [True: 0, False: 0]
  ------------------
  173|      0|        to_hdr->tag = pj_str("to-tag-456");
  174|       |
  175|       |    /* Ensure Via header has valid host/port for response addressing */
  176|      0|    if (via_hdr->sent_by.host.slen == 0) {
  ------------------
  |  Branch (176:9): [True: 0, False: 0]
  ------------------
  177|      0|        via_hdr->sent_by.host = pj_str("127.0.0.1");
  178|      0|        via_hdr->sent_by.port = 5060;
  179|      0|    }
  180|       |
  181|       |    /* Test transaction key generation */
  182|      0|    if (pjsip_tsx_create_key(rdata->tp_info.pool, &tsx_key, PJSIP_ROLE_UAS,
  ------------------
  |  Branch (182:9): [True: 0, False: 0]
  ------------------
  183|      0|                             &msg->line.req.method, rdata) == PJ_SUCCESS) {
  184|      0|        pjsip_tsx_layer_find_tsx(&tsx_key, PJ_FALSE);
  185|      0|    }
  186|      0|}
fuzz-sip.c:do_test_transaction_uac:
  206|  2.85k|{
  207|  2.85k|    pj_str_t tsx_key;
  208|       |
  209|  2.85k|    if (!msg || msg->type != PJSIP_RESPONSE_MSG || !rdata)
  ------------------
  |  Branch (209:9): [True: 0, False: 2.85k]
  |  Branch (209:17): [True: 0, False: 2.85k]
  |  Branch (209:52): [True: 0, False: 2.85k]
  ------------------
  210|      0|        return;
  211|       |
  212|       |    /* Verify CSeq header exists */
  213|  2.85k|    if (!pjsip_msg_find_hdr(msg, PJSIP_H_CSEQ, NULL))
  ------------------
  |  Branch (213:9): [True: 2.82k, False: 33]
  ------------------
  214|  2.82k|        return;
  215|       |
  216|       |    /* Skip if no transport available */
  217|     33|    if (!rdata->tp_info.transport)
  ------------------
  |  Branch (217:9): [True: 33, False: 0]
  ------------------
  218|     33|        return;
  219|       |
  220|       |    /* Test transaction key generation for responses */
  221|      0|    if (pjsip_tsx_create_key(rdata->tp_info.pool, &tsx_key, PJSIP_ROLE_UAC,
  ------------------
  |  Branch (221:9): [True: 0, False: 0]
  ------------------
  222|      0|                             &rdata->msg_info.cseq->method, rdata) == PJ_SUCCESS) {
  223|      0|        pjsip_tsx_layer_find_tsx(&tsx_key, PJ_FALSE);
  224|      0|    }
  225|      0|}
fuzz-sip.c:do_test_auth_client:
  229|  2.98k|{
  230|  2.98k|    pjsip_auth_clt_sess auth_sess;
  231|  2.98k|    pjsip_hdr *hdr = NULL;
  232|  2.98k|    pj_status_t status;
  233|       |
  234|       |    /* Only test with 401/407 responses */
  235|  2.98k|    if (!msg || msg->type != PJSIP_RESPONSE_MSG)
  ------------------
  |  Branch (235:9): [True: 0, False: 2.98k]
  |  Branch (235:17): [True: 134, False: 2.85k]
  ------------------
  236|    134|        return;
  237|       |
  238|  2.85k|    if (msg->line.status.code != 401 && msg->line.status.code != 407)
  ------------------
  |  Branch (238:9): [True: 2.23k, False: 620]
  |  Branch (238:41): [True: 2.21k, False: 19]
  ------------------
  239|  2.21k|        return;
  240|       |
  241|       |    /* Initialize auth client session */
  242|    639|    if (pjsip_auth_clt_init(&auth_sess, endpt, pool, 0) != PJ_SUCCESS)
  ------------------
  |  Branch (242:9): [True: 0, False: 639]
  ------------------
  243|      0|        return;
  244|       |
  245|       |    /* Set up credentials */
  246|    639|    pjsip_cred_info cred;
  247|    639|    pj_bzero(&cred, sizeof(cred));
  248|    639|    cred.realm = pj_str("test");
  249|    639|    cred.username = pj_str("user");
  250|    639|    cred.data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
  251|    639|    cred.data = pj_str("password");
  252|       |
  253|    639|    if (pjsip_auth_clt_set_credentials(&auth_sess, 1, &cred) != PJ_SUCCESS)
  ------------------
  |  Branch (253:9): [True: 0, False: 639]
  ------------------
  254|      0|        goto cleanup;
  255|       |
  256|       |    /* Parse authentication headers */
  257|    639|    if (msg->line.status.code == 401)
  ------------------
  |  Branch (257:9): [True: 620, False: 19]
  ------------------
  258|    620|        hdr = pjsip_msg_find_hdr(msg, PJSIP_H_WWW_AUTHENTICATE, NULL);
  259|     19|    else
  260|     19|        hdr = pjsip_msg_find_hdr(msg, PJSIP_H_PROXY_AUTHENTICATE, NULL);
  261|       |
  262|    639|    if (hdr) {
  ------------------
  |  Branch (262:9): [True: 604, False: 35]
  ------------------
  263|       |        /* Create a dummy request to test reinit */
  264|    604|        pjsip_tx_data *tdata = NULL;
  265|    604|        pjsip_method method;
  266|    604|        pj_str_t target_uri = pj_str("sip:server.com");
  267|    604|        pj_str_t from_uri = pj_str("sip:client@local");
  268|    604|        pj_str_t to_uri = pj_str("sip:server.com");
  269|    604|        pj_str_t contact = pj_str("sip:client@local");
  270|       |
  271|    604|        pjsip_method_set(&method, PJSIP_REGISTER_METHOD);
  272|       |
  273|    604|        status = pjsip_endpt_create_request(endpt, &method, &target_uri,
  274|    604|                                           &from_uri, &to_uri, &contact,
  275|    604|                                           NULL, -1, NULL, &tdata);
  276|    604|        if (status != PJ_SUCCESS || !tdata)
  ------------------
  |  Branch (276:13): [True: 0, False: 604]
  |  Branch (276:37): [True: 0, False: 604]
  ------------------
  277|      0|            goto cleanup;
  278|       |
  279|       |        /* Initialize request with auth */
  280|    604|        pjsip_auth_clt_init_req(&auth_sess, tdata);
  281|       |
  282|       |        /* Create rx_data from the 401/407 message */
  283|    604|        pjsip_rx_data rdata;
  284|    604|        pj_bzero(&rdata, sizeof(rdata));
  285|    604|        rdata.msg_info.msg = msg;
  286|    604|        rdata.msg_info.info = NULL;
  287|    604|        rdata.msg_info.len = 1024;
  288|       |
  289|       |        /* Try to reinit with the challenge */
  290|    604|        pjsip_tx_data *new_tdata = NULL;
  291|    604|        if (pjsip_auth_clt_reinit_req(&auth_sess, &rdata, tdata, &new_tdata) == PJ_SUCCESS && new_tdata) {
  ------------------
  |  Branch (291:13): [True: 282, False: 322]
  |  Branch (291:95): [True: 282, False: 0]
  ------------------
  292|    282|            pjsip_tx_data_dec_ref(new_tdata);
  293|    282|        }
  294|       |
  295|    604|        pjsip_tx_data_dec_ref(tdata);
  296|    604|    }
  297|       |
  298|    639|cleanup:
  299|    639|    pjsip_auth_clt_deinit(&auth_sess);
  300|    639|}
fuzz-sip.c:do_test_dialog:
  304|  2.98k|{
  305|  2.98k|    pjsip_dialog *dlg = NULL;
  306|  2.98k|    pjsip_to_hdr *to;
  307|  2.98k|    pjsip_from_hdr *from;
  308|  2.98k|    pj_str_t local_uri = pj_str("sip:local@test.com");
  309|  2.98k|    pj_str_t remote_uri = pj_str("sip:remote@test.com");
  310|  2.98k|    pj_str_t target = pj_str("sip:remote@test.com");
  311|       |
  312|  2.98k|    if (!msg || msg->type != PJSIP_REQUEST_MSG)
  ------------------
  |  Branch (312:9): [True: 0, False: 2.98k]
  |  Branch (312:17): [True: 2.85k, False: 134]
  ------------------
  313|  2.85k|        return;
  314|       |
  315|    134|    if (msg->line.req.method.id != PJSIP_INVITE_METHOD)
  ------------------
  |  Branch (315:9): [True: 45, False: 89]
  ------------------
  316|     45|        return;
  317|       |
  318|       |    /* Get To and From headers */
  319|     89|    to = (pjsip_to_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_TO, NULL);
  320|     89|    from = (pjsip_from_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_FROM, NULL);
  321|     89|    if (!to || !from)
  ------------------
  |  Branch (321:9): [True: 1, False: 88]
  |  Branch (321:16): [True: 1, False: 87]
  ------------------
  322|      2|        return;
  323|       |
  324|       |    /* Create UAC dialog */
  325|     87|    if (pjsip_dlg_create_uac(pjsip_ua_instance(), &local_uri, NULL,
  ------------------
  |  Branch (325:9): [True: 87, False: 0]
  ------------------
  326|     87|                             &remote_uri, &target, &dlg) == PJ_SUCCESS && dlg) {
  ------------------
  |  Branch (326:75): [True: 87, False: 0]
  ------------------
  327|     87|        pjsip_dlg_inc_lock(dlg);
  328|       |
  329|       |        /* Build route set from all Route headers */
  330|     87|        pjsip_route_hdr route_set;
  331|     87|        pjsip_route_hdr *route;
  332|     87|        pj_list_init(&route_set);
  333|     87|        route = (pjsip_route_hdr*)
  334|     87|                pjsip_msg_find_hdr(msg, PJSIP_H_ROUTE, NULL);
  335|  3.44k|        while (route) {
  ------------------
  |  Branch (335:16): [True: 3.35k, False: 87]
  ------------------
  336|  3.35k|            pjsip_route_hdr *route_clone = (pjsip_route_hdr*)
  337|  3.35k|                    pjsip_hdr_clone(dlg->pool, route);
  338|  3.35k|            pj_list_push_back(&route_set, route_clone);
  339|  3.35k|            route = (pjsip_route_hdr*)
  340|  3.35k|                    pjsip_msg_find_hdr(msg, PJSIP_H_ROUTE,
  341|  3.35k|                                        route->next);
  342|  3.35k|        }
  343|     87|        if (!pj_list_empty(&route_set)) {
  ------------------
  |  Branch (343:13): [True: 79, False: 8]
  ------------------
  344|     79|            pjsip_dlg_set_route_set(dlg, &route_set);
  345|     79|        }
  346|       |
  347|     87|        pjsip_dlg_dec_lock(dlg);
  348|     87|    }
  349|     87|}
fuzz-sip.c:do_test_tel_uri:
  116|  6.10k|{
  117|  6.10k|    pj_str_t uri_str;
  118|  6.10k|    pjsip_uri *uri;
  119|       |
  120|  6.10k|    if (size < 4 || size > 256)
  ------------------
  |  Branch (120:9): [True: 0, False: 6.10k]
  |  Branch (120:21): [True: 1.04k, False: 5.05k]
  ------------------
  121|  1.04k|        return;
  122|       |
  123|  5.05k|    uri_str.ptr = data;
  124|  5.05k|    uri_str.slen = (pj_ssize_t)size;
  125|       |
  126|  5.05k|    uri = pjsip_parse_uri(pool, uri_str.ptr, uri_str.slen, 0);
  127|       |
  128|  5.05k|    if (uri && size > 20) {
  ------------------
  |  Branch (128:9): [True: 962, False: 4.09k]
  |  Branch (128:16): [True: 757, False: 205]
  ------------------
  129|    757|        pj_str_t uri2_str;
  130|    757|        pjsip_uri *uri2;
  131|       |
  132|    757|        uri2_str.ptr = data + 10;
  133|    757|        uri2_str.slen = (pj_ssize_t)(size - 10);
  134|       |
  135|    757|        uri2 = pjsip_parse_uri(pool, uri2_str.ptr, uri2_str.slen, 0);
  136|    757|        if (uri2) {
  ------------------
  |  Branch (136:13): [True: 694, False: 63]
  ------------------
  137|    694|            pjsip_uri_cmp(PJSIP_URI_IN_FROMTO_HDR, uri, uri2);
  138|    694|            pjsip_uri_cmp(PJSIP_URI_IN_REQ_URI, uri, uri2);
  139|    694|        }
  140|    757|    }
  141|  5.05k|}

