• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pjsip_parser_const函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pjsip_parser_const函数的典型用法代码示例。如果您正苦于以下问题:C++ pjsip_parser_const函数的具体用法?C++ pjsip_parser_const怎么用?C++ pjsip_parser_const使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pjsip_parser_const函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: pjsip_reject_contact_hdr_print_on

int pjsip_reject_contact_hdr_print_on(void* void_hdr,
                                      char* buf,
                                      pj_size_t size)
{
  int printed;
  char *startbuf = buf;
  char *endbuf = buf + size;
  pjsip_reject_contact_hdr* hdr = (pjsip_reject_contact_hdr *)void_hdr;
  const pjsip_parser_const_t *pc = pjsip_parser_const();

  /* Route and Record-Route don't compact forms */
  copy_advance(buf, hdr->name);
  *buf++ = ':';
  *buf++ = ' ';
  *buf++ = '*';

  printed = pjsip_param_print_on(&hdr->feature_set, buf, endbuf-buf,
                                 &pc->pjsip_TOKEN_SPEC,
                                 &pc->pjsip_TOKEN_SPEC, ';');
  if (printed < 0)
  {
    return -1;
  }
  buf += printed;

  return buf-startbuf;
}
开发者ID:jmmL,项目名称:sprout,代码行数:27,代码来源:custom_headers.cpp


示例2: print_digest_challenge

static int print_digest_challenge( pjsip_digest_challenge *chal,
				   char *buf, pj_size_t size)
{
    pj_ssize_t printed;
    char *startbuf = buf;
    char *endbuf = buf + size;
    const pjsip_parser_const_t *pc = pjsip_parser_const();

    /* Allow empty realm, see http://trac.pjsip.org/repos/ticket/1061 */
    copy_advance_pair_quote(buf, " realm=", 7, chal->realm, '"', '"');
    copy_advance_pair_quote_cond(buf, ",domain=", 8, chal->domain, '"', '"');
    copy_advance_pair_quote_cond(buf, ",nonce=", 7, chal->nonce, '"', '"');
    copy_advance_pair_quote_cond(buf, ",opaque=", 8, chal->opaque, '"', '"');
    if (chal->stale) {
	pj_str_t true_str = { "true", 4 };
	copy_advance_pair(buf, ",stale=", 7, true_str);
    }
    copy_advance_pair(buf, ",algorithm=", 11, chal->algorithm);
    copy_advance_pair_quote_cond(buf, ",qop=", 5, chal->qop, '"', '"');
    
    printed = pjsip_param_print_on(&chal->other_param, buf, endbuf-buf, 
				   &pc->pjsip_TOKEN_SPEC, 
				   &pc->pjsip_TOKEN_SPEC, ',');
    if (printed < 0)
	return -1;
    buf += printed;

    return (int)(buf-startbuf);
}
开发者ID:AGProjects,项目名称:python-sipsimple,代码行数:29,代码来源:sip_auth_msg.c


示例3: print_digest_credential

static int print_digest_credential(pjsip_digest_credential *cred, char *buf, pj_size_t size)
{
    pj_ssize_t printed;
    char *startbuf = buf;
    char *endbuf = buf + size;
    const pjsip_parser_const_t *pc = pjsip_parser_const();
    
    copy_advance_pair_quote_cond(buf, "username=", 9, cred->username, '"', '"');
    copy_advance_pair_quote_cond_always(buf, ", realm=", 8, cred->realm, '"', 
					'"');
    copy_advance_pair_quote(buf, ", nonce=", 8, cred->nonce, '"', '"');
    copy_advance_pair_quote_cond(buf, ", uri=", 6, cred->uri, '"', '"');
    copy_advance_pair_quote(buf, ", response=", 11, cred->response, '"', '"');
    copy_advance_pair(buf, ", algorithm=", 12, cred->algorithm);
    copy_advance_pair_quote_cond(buf, ", cnonce=", 9, cred->cnonce, '"', '"');
    copy_advance_pair_quote_cond(buf, ", opaque=", 9, cred->opaque, '"', '"');
    //Note: there's no dbl-quote in qop in Authorization header 
    // (unlike WWW-Authenticate)
    //copy_advance_pair_quote_cond(buf, ", qop=", 6, cred->qop, '"', '"');
    copy_advance_pair(buf, ", qop=", 6, cred->qop);
    copy_advance_pair(buf, ", nc=", 5, cred->nc);
    
    printed = pjsip_param_print_on(&cred->other_param, buf, endbuf-buf, 
				   &pc->pjsip_TOKEN_SPEC, 
				   &pc->pjsip_TOKEN_SPEC, ',');
    if (printed < 0)
	return -1;
    buf += printed;

    return (int) (buf-startbuf);
}
开发者ID:AGProjects,项目名称:python-sipsimple,代码行数:31,代码来源:sip_auth_msg.c


示例4: pjsip_sess_expires_hdr_create

/*
 * Parse Session-Expires header.
 */
static pjsip_hdr *parse_hdr_se(pjsip_parse_ctx *ctx)
{
    pjsip_sess_expires_hdr *hdr = pjsip_sess_expires_hdr_create(ctx->pool);
    const pjsip_parser_const_t *pc = pjsip_parser_const();
    pj_str_t token;

    pj_scan_get(ctx->scanner, &pc->pjsip_DIGIT_SPEC, &token);
    hdr->sess_expires = pj_strtoul(&token);

    while (*ctx->scanner->curptr == ';') {
	pj_str_t pname, pvalue;

	pj_scan_get_char(ctx->scanner);
	pjsip_parse_param_imp(ctx->scanner, ctx->pool, &pname, &pvalue, 0);

	if (pj_stricmp(&pname, &STR_REFRESHER)==0) {
	    hdr->refresher = pvalue;
	} else {
	    pjsip_param *param = PJ_POOL_ALLOC_T(ctx->pool, pjsip_param);
	    param->name = pname;
	    param->value = pvalue;
	    pj_list_push_back(&hdr->other_param, param);
	}
    }
    pjsip_parse_end_hdr_imp( ctx->scanner );
    return (pjsip_hdr*)hdr;
}
开发者ID:Archipov,项目名称:android-client,代码行数:30,代码来源:sip_timer.c


示例5: pjsip_accept_contact_hdr_print_on

int pjsip_accept_contact_hdr_print_on(void* void_hdr,
                                      char* buf,
                                      pj_size_t size)
{
  int printed;
  char *startbuf = buf;
  char *endbuf = buf + size;
  pjsip_accept_contact_hdr* hdr = (pjsip_accept_contact_hdr *)void_hdr;
  const pjsip_parser_const_t *pc = pjsip_parser_const();

  /* Route and Record-Route don't compact forms */
  copy_advance(buf, hdr->name);
  copy_advance(buf, pj_str(": *"));

  printed = pjsip_param_print_on(&hdr->feature_set, buf, endbuf-buf,
                                 &pc->pjsip_TOKEN_SPEC,
                                 &pc->pjsip_TOKEN_SPEC, ';');
  if (printed < 0)
  {
    return -1;
  }
  buf += printed;

  if (hdr->explicit_match)
  {
    copy_advance(buf, pj_str(";explicit"));
  }

  if (hdr->required_match)
  {
    copy_advance(buf, pj_str(";require"));
  }

  return buf-startbuf;
}
开发者ID:jmmL,项目名称:sprout,代码行数:35,代码来源:custom_headers.cpp


示例6: identity_hdr_print

int identity_hdr_print(pjsip_routing_hdr* hdr,
                       char* buf,
                       pj_size_t size)
{
  int printed;
  char *startbuf = buf;
  char *endbuf = buf + size;
  const pjsip_parser_const_t *pc = pjsip_parser_const();

  /* Route and Record-Route don't compact forms */
  copy_advance(buf, hdr->name);
  *buf++ = ':';
  *buf++ = ' ';

  printed = pjsip_uri_print(PJSIP_URI_IN_ROUTING_HDR,
                            &hdr->name_addr,
                            buf,
                            endbuf-buf);
  if (printed < 1)
  {
    return -1; // LCOV_EXCL_LINE
  }
  buf += printed;

  printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf,
                                 &pc->pjsip_TOKEN_SPEC,
                                 &pc->pjsip_TOKEN_SPEC, ';');
  if (printed < 0)
  {
    return -1; // LCOV_EXCL_LINE
  }
  buf += printed;

  return buf-startbuf;
}
开发者ID:jmmL,项目名称:sprout,代码行数:35,代码来源:custom_headers.cpp


示例7: min_se_hdr_print

/*
 * Min-SE header vptr.
 */
static int min_se_hdr_print(pjsip_min_se_hdr *hdr, 
			    char *buf, pj_size_t size)
{
    char *p = buf;
    char *endbuf = buf+size;
    pj_ssize_t printed;
    const pjsip_parser_const_t *pc = pjsip_parser_const();

    /* Print header name and value */
    if ((endbuf - p) < (hdr->name.slen + 16))
	return -1;

    copy_advance(p, hdr->name);
    *p++ = ':';
    *p++ = ' ';

    printed = pj_utoa(hdr->min_se, p);
    p += printed;

    /* Print generic params */
    printed = pjsip_param_print_on(&hdr->other_param, p, endbuf-p,
				   &pc->pjsip_TOKEN_SPEC, 
				   &pc->pjsip_TOKEN_SPEC, ';');
    if (printed < 0)
	return (int)printed;

    p += printed;
    return (int)(p - buf);
}
开发者ID:Archipov,项目名称:android-client,代码行数:32,代码来源:sip_timer.c


示例8: replaces_hdr_print

static int replaces_hdr_print( pjsip_replaces_hdr *hdr, 
			       char *buf, pj_size_t size)
{
    char *p = buf;
    char *endbuf = buf+size;
    int printed;
    const pjsip_parser_const_t *pc = pjsip_parser_const();

    copy_advance(p, hdr->name);
    *p++ = ':';
    *p++ = ' ';

    copy_advance(p, hdr->call_id);
    copy_advance_pair(p, ";to-tag=", 8, hdr->to_tag);
    copy_advance_pair(p, ";from-tag=", 10, hdr->from_tag);

    if (hdr->early_only) {
	const pj_str_t str_early_only = { ";early-only", 11 };
	copy_advance(p, str_early_only);
    }
    
    printed = pjsip_param_print_on(&hdr->other_param, p, endbuf-p,
				   &pc->pjsip_TOKEN_SPEC, 
				   &pc->pjsip_TOKEN_SPEC, ';');
    if (printed < 0)
	return printed;

    p += printed;
    return p - buf;
}
开发者ID:max3903,项目名称:SFLphone,代码行数:30,代码来源:sip_replaces.c


示例9: int_parse_hdr_authenticate

static void int_parse_hdr_authenticate( pj_scanner *scanner, pj_pool_t *pool, 
					pjsip_www_authenticate_hdr *hdr)
{
    const pjsip_parser_const_t *pc = pjsip_parser_const();

    if (*scanner->curptr == '"') {
	pj_scan_get_quote(scanner, '"', '"', &hdr->scheme);
	hdr->scheme.ptr++;
	hdr->scheme.slen -= 2;
    } else {
	pj_scan_get(scanner, &pc->pjsip_TOKEN_SPEC, &hdr->scheme);
    }

    if (!pj_stricmp(&hdr->scheme, &pjsip_DIGEST_STR)) {

	parse_digest_challenge(scanner, pool, &hdr->challenge.digest);

    } else if (!pj_stricmp(&hdr->scheme, &pjsip_PGP_STR)) {

	parse_pgp_challenge(scanner, pool, &hdr->challenge.pgp);

    } else {
	PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
    }

    pjsip_parse_end_hdr_imp( scanner );
}
开发者ID:max3903,项目名称:SFLphone,代码行数:27,代码来源:sip_auth_parser.c


示例10: pjsip_event_hdr_create

/*
 * Parse Event header.
 */
static pjsip_hdr *parse_hdr_event(pjsip_parse_ctx *ctx)
{
    pjsip_event_hdr *hdr = pjsip_event_hdr_create(ctx->pool);
    const pj_str_t id_param = { "id", 2 };
    const pjsip_parser_const_t *pc = pjsip_parser_const();

    pj_scan_get(ctx->scanner, &pc->pjsip_TOKEN_SPEC, &hdr->event_type);

    while (*ctx->scanner->curptr == ';') {
	pj_str_t pname, pvalue;

	pj_scan_get_char(ctx->scanner);
	pjsip_parse_param_imp(ctx->scanner, ctx->pool, &pname, &pvalue, 0);

	if (pj_stricmp(&pname, &id_param)==0) {
	    hdr->id_param = pvalue;
	} else {
	    pjsip_param *param = PJ_POOL_ALLOC_T(ctx->pool, pjsip_param);
	    param->name = pname;
	    param->value = pvalue;
	    pj_list_push_back(&hdr->other_param, param);
	}
    }
    pjsip_parse_end_hdr_imp( ctx->scanner );
    return (pjsip_hdr*)hdr;
}
开发者ID:batk0,项目名称:pjsip,代码行数:29,代码来源:evsub_msg.c


示例11: pjsip_session_expires_hdr_print_on

int pjsip_session_expires_hdr_print_on(void* h, char* buf, pj_size_t len)
{
  char* p = buf;
  const pjsip_session_expires_hdr* hdr = (pjsip_session_expires_hdr*)h;
  const pjsip_parser_const_t *pc = pjsip_parser_const();

  // As per pjsip_generic_int_hdr_print, integers are fewer then 15 characters long.
  if ((pj_ssize_t)len < hdr->name.slen + 15)
  {
    return -1;
  }

  pj_memcpy(p, hdr->name.ptr, hdr->name.slen);
  p += hdr->name.slen;
  *p++ = ':';
  *p++ = ' ';
  p += pj_utoa(hdr->expires, p);

  if (hdr->refresher != SESSION_REFRESHER_UNKNOWN)
  {
    // Check the refresher parameter will fit.
    if (buf+len-p < 14)
    {
      return -1;
    }

    // Fill it in
    *p++ = ';';
    pj_memcpy(p, "refresher=", 10);
    p += 10;

    if (hdr->refresher == SESSION_REFRESHER_UAC)
    {
      pj_memcpy(p, "uac", 3);
    }
    else
    {
      pj_memcpy(p, "uas", 3);
    }
    p += 3;
  }

  // Try to add the other params.
  pj_ssize_t printed = pjsip_param_print_on(&hdr->other_param, p, buf+len-p,
                                            &pc->pjsip_TOKEN_SPEC,
                                            &pc->pjsip_TOKEN_SPEC, ';');
  if (printed < 0)
  {
    return -1;
  }
  p += printed;
  *p = '\0';

  return p - buf;
}
开发者ID:jmmL,项目名称:sprout,代码行数:55,代码来源:custom_headers.cpp


示例12: parse_hdr_session_expires

pjsip_hdr* parse_hdr_session_expires(pjsip_parse_ctx* ctx)
{
  pj_pool_t* pool = ctx->pool;
  pj_scanner* scanner = ctx->scanner;
  pjsip_session_expires_hdr* hdr = pjsip_session_expires_hdr_create(pool);
  const pjsip_parser_const_t* pc = pjsip_parser_const();

  // Parse the expiry number
  pj_str_t int_str;
  pj_scan_get(scanner, &pc->pjsip_DIGIT_SPEC, &int_str);
  hdr->expires = pj_strtoul(&int_str);
  pj_scan_skip_whitespace(scanner);

  // Parse the rest of the params, looking for the refresher param
  while (*scanner->curptr == ';')
  {
    // Consume the ';'.
    pj_scan_get_char(scanner);
    pj_scan_skip_whitespace(scanner);

    // Parse the param.
    pj_str_t name;
    pj_str_t value;
    pjsip_parse_param_imp(scanner, pool, &name, &value,
                          PJSIP_PARSE_REMOVE_QUOTE);
    if (!pj_stricmp2(&name, "refresher"))
    {
      if (!pj_stricmp2(&value, "uac"))
      {
        hdr->refresher = SESSION_REFRESHER_UAC;
      }
      else if (!pj_stricmp2(&value, "uas"))
      {
        hdr->refresher = SESSION_REFRESHER_UAS;
      }
      else
      {
        PJ_THROW(PJSIP_SYN_ERR_EXCEPTION); // LCOV_EXCL_LINE
      }
    }
    else
    {
      pjsip_param* param = PJ_POOL_ALLOC_T(pool, pjsip_param);
      param->name = name;
      param->value = value;
      pj_list_insert_before(&hdr->other_param, param);
    }
  }

  // We're done parsing this header.
  pjsip_parse_end_hdr_imp(scanner);

  return (pjsip_hdr*)hdr;
}
开发者ID:jmmL,项目名称:sprout,代码行数:54,代码来源:custom_headers.cpp


示例13: parse_hdr_reject_contact

pjsip_hdr* parse_hdr_reject_contact(pjsip_parse_ctx* ctx)
{
  // The Reject-Contact header has the following ABNF:
  //
  // Reject-Contact  =  ("Reject-Contact" / "j") HCOLON rc-value
  //                       *(COMMA rc-value)
  // rc-value        =  "*" *(SEMI rc-params)
  // rc-params       =  feature-param / generic-param
  //
  // But we allow any value for the header (not just *).

  pj_pool_t* pool = ctx->pool;
  pj_scanner* scanner = ctx->scanner;
  const pjsip_parser_const_t* pc = pjsip_parser_const();
  pjsip_reject_contact_hdr* hdr = pjsip_reject_contact_hdr_create(pool);
  pj_str_t name;
  pj_str_t value;
  pjsip_param *param;

  // Read and ignore the value.
  pj_str_t header_value;
  pj_scan_get(scanner, &pc->pjsip_TOKEN_SPEC, &header_value);

  for (;;)
  {
    // We might need to swallow the ';'.
    if (!pj_scan_is_eof(scanner) && *scanner->curptr == ';')
    {
      pj_scan_get_char(scanner);
    }

    pjsip_parse_param_imp(scanner, pool, &name, &value, 0);
    param = PJ_POOL_ALLOC_T(pool, pjsip_param);
    param->name = name;
    param->value = value;
    pj_list_insert_before(&hdr->feature_set, param);

    // If we're EOF or looking at a newline, we're done.
    pj_scan_skip_whitespace(scanner);
    if (pj_scan_is_eof(scanner) ||
        (*scanner->curptr == '\r') ||
        (*scanner->curptr == '\n'))
    {
      break;
    }
  }

  // We're done parsing this header.
  pjsip_parse_end_hdr_imp(scanner);

  return (pjsip_hdr*)hdr;
}
开发者ID:jmmL,项目名称:sprout,代码行数:52,代码来源:custom_headers.cpp


示例14: tel_uri_print

/* Print tel: URI */
static pj_ssize_t tel_uri_print( pjsip_uri_context_e context,
				 const pjsip_tel_uri *uri, 
				 char *buf, pj_size_t size)
{
    int printed;
    char *startbuf = buf;
    char *endbuf = buf+size-1;
    const pjsip_parser_const_t *pc = pjsip_parser_const();

    PJ_UNUSED_ARG(context);

    /* Print scheme. */
    copy_advance(buf, pc->pjsip_TEL_STR);
    *buf++ = ':';

    /* Print number. */
    copy_advance_escape(buf, uri->number, pjsip_TEL_NUMBER_SPEC);

    /* ISDN sub-address or extension must appear first. */

    /* Extension param. */
    copy_advance_pair_escape(buf, ";ext=", 5, uri->ext_param, 
			     pjsip_TEL_EXT_VALUE_SPEC);

    /* ISDN sub-address. */
    copy_advance_pair_escape(buf, ";isub=", 6, uri->isub_param, 
			     pjsip_TEL_URIC_SPEC);

    /* Followed by phone context, if present. */
    copy_advance_pair_escape(buf, ";phone-context=", 15, uri->context, 
			     pjsip_TEL_PHONE_CONTEXT_SPEC);


    /* Print other parameters. */
    printed = (int)pjsip_param_print_on(&uri->other_param, buf, (endbuf-buf), 
					&pjsip_TEL_PNAME_SPEC, 
					&pjsip_TEL_PVALUE_SPEC, ';');
    if (printed < 0)
	return -1;
    buf += printed;

    *buf = '\0';

    return (buf-startbuf);
}
开发者ID:acatighera,项目名称:python-sipsimple,代码行数:46,代码来源:sip_tel_uri.c


示例15: se_hdr_print

/*
 * Session-Expires header vptr.
 */
static int se_hdr_print(pjsip_sess_expires_hdr *hdr, 
			char *buf, pj_size_t size)
{
    char *p = buf;
    char *endbuf = buf+size;
    pj_ssize_t printed;
    const pjsip_parser_const_t *pc = pjsip_parser_const();
    const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;

    /* Print header name and value */
    if ((endbuf - p) < (hname->slen + 16))
	return -1;

    copy_advance(p, (*hname));
    *p++ = ':';
    *p++ = ' ';

    printed = pj_utoa(hdr->sess_expires, p);
    p += printed;

    /* Print 'refresher' param */
    if (hdr->refresher.slen)
    {
	if  ((endbuf - p) < (STR_REFRESHER.slen + 2 + hdr->refresher.slen))
	    return -1;

	*p++ = ';';
	copy_advance(p, STR_REFRESHER);
	*p++ = '=';
	copy_advance(p, hdr->refresher);
    }

    /* Print generic params */
    printed = pjsip_param_print_on(&hdr->other_param, p, endbuf-p,
				   &pc->pjsip_TOKEN_SPEC, 
				   &pc->pjsip_TOKEN_SPEC, ';');
    if (printed < 0)
	return (int)printed;

    p += printed;
    return (int)(p - buf);
}
开发者ID:Archipov,项目名称:android-client,代码行数:45,代码来源:sip_timer.c


示例16: pjsip_sub_state_hdr_print

static int pjsip_sub_state_hdr_print(pjsip_sub_state_hdr *hdr, 
				     char *buf, pj_size_t size)
{
    char *p = buf;
    char *endbuf = buf+size;
    pj_ssize_t printed;
    const pjsip_parser_const_t *pc = pjsip_parser_const();

    copy_advance(p, hdr->name);
    *p++ = ':';
    *p++ = ' ';

    copy_advance_escape(p, hdr->sub_state, pc->pjsip_TOKEN_SPEC);
    copy_advance_pair_escape(p, ";reason=", 8, hdr->reason_param,
			     pc->pjsip_TOKEN_SPEC);
    if (hdr->expires_param >= 0) {
	pj_memcpy(p, ";expires=", 9);
	p += 9;
	printed = pj_utoa(hdr->expires_param, p);
	p += printed;
    }
    if (hdr->retry_after >= 0) {
	pj_memcpy(p, ";retry-after=", 13);
	p += 13;
	printed = pj_utoa(hdr->retry_after, p);
	p += printed;
    }
    
    printed = pjsip_param_print_on( &hdr->other_param, p, endbuf-p, 
				    &pc->pjsip_TOKEN_SPEC,
				    &pc->pjsip_TOKEN_SPEC,
				    ';');
    if (printed < 0)
	return (int)printed;

    p += printed;

    return (int)(p - buf);
}
开发者ID:batk0,项目名称:pjsip,代码行数:39,代码来源:evsub_msg.c


示例17: pjsip_min_se_hdr_create

/*
 * Parse Min-SE header.
 */
static pjsip_hdr *parse_hdr_min_se(pjsip_parse_ctx *ctx)
{
    pjsip_min_se_hdr *hdr = pjsip_min_se_hdr_create(ctx->pool);
    const pjsip_parser_const_t *pc = pjsip_parser_const();
    pj_str_t token;

    pj_scan_get(ctx->scanner, &pc->pjsip_DIGIT_SPEC, &token);
    hdr->min_se = pj_strtoul(&token);

    while (*ctx->scanner->curptr == ';') {
	pj_str_t pname, pvalue;
	pjsip_param *param = PJ_POOL_ALLOC_T(ctx->pool, pjsip_param);

	pj_scan_get_char(ctx->scanner);
	pjsip_parse_param_imp(ctx->scanner, ctx->pool, &pname, &pvalue, 0);

	param->name = pname;
	param->value = pvalue;
	pj_list_push_back(&hdr->other_param, param);
    }
    pjsip_parse_end_hdr_imp( ctx->scanner );
    return (pjsip_hdr*)hdr;
}
开发者ID:Archipov,项目名称:android-client,代码行数:26,代码来源:sip_timer.c


示例18: pjsip_event_hdr_print

static int pjsip_event_hdr_print( pjsip_event_hdr *hdr, 
				  char *buf, pj_size_t size)
{
    char *p = buf;
    char *endbuf = buf+size;
    pj_ssize_t printed;
    const pjsip_parser_const_t *pc = pjsip_parser_const();

    copy_advance(p, hdr->name);
    *p++ = ':';
    *p++ = ' ';

    copy_advance(p, hdr->event_type);
    copy_advance_pair(p, ";id=", 4, hdr->id_param);
    
    printed = pjsip_param_print_on(&hdr->other_param, p, endbuf-p,
				   &pc->pjsip_TOKEN_SPEC, 
				   &pc->pjsip_TOKEN_SPEC, ';');
    if (printed < 0)
	return (int)printed;

    p += printed;
    return (int)(p - buf);
}
开发者ID:batk0,项目名称:pjsip,代码行数:24,代码来源:evsub_msg.c


示例19: parse_hdr_sub_state

/*
 * Parse Subscription-State header.
 */
static pjsip_hdr* parse_hdr_sub_state( pjsip_parse_ctx *ctx )
{
    pjsip_sub_state_hdr *hdr = pjsip_sub_state_hdr_create(ctx->pool);
    const pj_str_t reason = { "reason", 6 },
		   expires = { "expires", 7 },
		   retry_after = { "retry-after", 11 };
    const pjsip_parser_const_t *pc = pjsip_parser_const();

    pj_scan_get(ctx->scanner, &pc->pjsip_TOKEN_SPEC, &hdr->sub_state);

    while (*ctx->scanner->curptr == ';') {
	pj_str_t pname, pvalue;

	pj_scan_get_char(ctx->scanner);
	pjsip_parse_param_imp(ctx->scanner, ctx->pool, &pname, &pvalue, 0);

	if (pj_stricmp(&pname, &reason) == 0) {
	    hdr->reason_param = pvalue;

	} else if (pj_stricmp(&pname, &expires) == 0) {
	    hdr->expires_param = pj_strtoul(&pvalue);

	} else if (pj_stricmp(&pname, &retry_after) == 0) {
	    hdr->retry_after = pj_strtoul(&pvalue);

	} else {
	    pjsip_param *param = PJ_POOL_ALLOC_T(ctx->pool, pjsip_param);
	    param->name = pname;
	    param->value = pvalue;
	    pj_list_push_back(&hdr->other_param, param);
	}
    }

    pjsip_parse_end_hdr_imp( ctx->scanner );
    return (pjsip_hdr*)hdr;
}
开发者ID:batk0,项目名称:pjsip,代码行数:39,代码来源:evsub_msg.c


示例20: pjsip_url_print

static pj_ssize_t pjsip_url_print(  pjsip_uri_context_e context,
				    const pjsip_sip_uri *url, 
				    char *buf, pj_size_t size)
{
    int printed;
    char *startbuf = buf;
    char *endbuf = buf+size;
    const pj_str_t *scheme;
    const pjsip_parser_const_t *pc = pjsip_parser_const();

    *buf = '\0';

    /* Print scheme ("sip:" or "sips:") */
    scheme = pjsip_uri_get_scheme(url);
    copy_advance_check(buf, *scheme);
    *buf++ = ':';

    /* Print "user:[email protected]", if any. */
    if (url->user.slen) {
	copy_advance_escape(buf, url->user, pc->pjsip_USER_SPEC);
	if (url->passwd.slen) {
	    *buf++ = ':';
	    copy_advance_escape(buf, url->passwd, pc->pjsip_PASSWD_SPEC);
	}

	*buf++ = '@';
    }

    /* Print host. */
    pj_assert(url->host.slen != 0);
    /* Detect IPv6 IP address */
    if (pj_memchr(url->host.ptr, ':', url->host.slen)) {
	copy_advance_pair_quote_cond(buf, "", 0, url->host, '[', ']');
    } else {
	copy_advance_check(buf, url->host);
    }

    /* Only print port if it is explicitly specified. 
     * Port is not allowed in To and From header.
     */
    /* Unfortunately some UA requires us to send back the port
     * number exactly as it was sent. We don't remember whether an
     * UA has sent us port, so we'll just send the port indiscrimately
     */
    //PJ_TODO(SHOULD_DISALLOW_URI_PORT_IN_FROM_TO_HEADER)
    if (url->port && context != PJSIP_URI_IN_FROMTO_HDR) {
	if (endbuf - buf < 10)
	    return -1;

	*buf++ = ':';
	printed = pj_utoa(url->port, buf);
	buf += printed;
    }

    /* User param is allowed in all contexes */
    copy_advance_pair_check(buf, ";user=", 6, url->user_param);

    /* Method param is only allowed in external/other context. */
    if (context == PJSIP_URI_IN_OTHER) {
	copy_advance_pair_escape(buf, ";method=", 8, url->method_param, 
				 pc->pjsip_PARAM_CHAR_SPEC);
    }

    /* Transport is not allowed in From/To header. */
    if (context != PJSIP_URI_IN_FROMTO_HDR) {
	copy_advance_pair_escape(buf, ";transport=", 11, url->transport_param,
				 pc->pjsip_PARAM_CHAR_SPEC);
    }

    /* TTL param is not allowed in From, To, Route, and Record-Route header. */
    if (url->ttl_param >= 0 && context != PJSIP_URI_IN_FROMTO_HDR &&
	context != PJSIP_URI_IN_ROUTING_HDR) 
    {
	if (endbuf - buf < 15)
	    return -1;
	pj_memcpy(buf, ";ttl=", 5);
	printed = pj_utoa(url->ttl_param, buf+5);
	buf += printed + 5;
    }

    /* maddr param is not allowed in From and To header. */
    if (context != PJSIP_URI_IN_FROMTO_HDR && url->maddr_param.slen) {
	/* Detect IPv6 IP address */
	if (pj_memchr(url->maddr_param.ptr, ':', url->maddr_param.slen)) {
	    copy_advance_pair_quote_cond(buf, ";maddr=", 7, url->maddr_param,
				         '[', ']');
	} else {
	    copy_advance_pair_escape(buf, ";maddr=", 7, url->maddr_param,
				     pc->pjsip_PARAM_CHAR_SPEC);
	}
    }

    /* lr param is not allowed in From, To, and Contact header. */
    if (url->lr_param && context != PJSIP_URI_IN_FROMTO_HDR &&
	context != PJSIP_URI_IN_CONTACT_HDR) 
    {
	pj_str_t lr = { ";lr", 3 };
	if (endbuf - buf < 3)
	    return -1;
	copy_advance_check(buf, lr);
//.........这里部分代码省略.........
开发者ID:max3903,项目名称:SFLphone,代码行数:101,代码来源:sip_uri.c



注:本文中的pjsip_parser_const函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pjsip_sip_uri_create函数代码示例发布时间:2022-05-30
下一篇:
C++ pjsip_msg_find_hdr_by_name函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap