⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apps_utils.h

📁 sofia-sip-1.11.8的源码例子。
💻 H
字号:
#ifndef APPS_UTILS_H /** Defined when apps_utils.h has been included. */#define APPS_UTILS_H "$Id: apps_utils.h,v 1.1 2005/07/20 20:08:15 kaiv Exp $"/** * @nofile apps_utils.h * @brief  *  * Copyright (C) 2005 Nokia Research Center. * * Written by Pekka Pessi <pekka -dot pessi -at- nokia -dot- com> * * @STARTLGPL@ * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * @ENDLGPL@ *  * @par Contributor(s): *  * @date Created: Thu Apr  8 15:55:15 2004 ppessi *  * $Date: 2005/07/20 20:08:15 $ */static inlineint proxy_authenticate(context_t *c,		       nta_outgoing_t *oreq,		       sip_t const *sip,		       nta_response_f response_function){  if (sip && sip->sip_status->st_status == 407 &&       sip->sip_proxy_authenticate &&      c->c_proxy_auth_retries++ < 3 &&       c->c_proxy && c->c_proxy->url_user && c->c_proxy->url_password) {    url_t *u = c->c_proxy;    msg_t *rmsg = nta_outgoing_getrequest(oreq);    sip_t *rsip = sip_object(rmsg);    if (auc_challenge(&c->c_proxy_auth, c->c_home, sip->sip_proxy_authenticate,		      sip_proxy_authorization_class) >= 0 	&&	auc_all_credentials(&c->c_proxy_auth, NULL, NULL, 			    u->url_user, u->url_password) > 0	&& 	auc_authorization(&c->c_proxy_auth, rmsg, (msg_pub_t *)rsip,			  rsip->sip_request->rq_method_name,			  rsip->sip_request->rq_url,			  rsip->sip_payload) > 0) {      nta_outgoing_destroy(c->c_orq);      sip_header_remove(rmsg, rsip, (sip_header_t *)rsip->sip_via);      nta_msg_request_complete(rmsg, c->c_leg, 0, NULL, NULL);      c->c_orq = nta_outgoing_tmcreate(c->c_agent, response_function, c, NULL, 				       rmsg, TAG_END());      return 1;    }  }  return 0;}				   static inlineint server_authenticate(context_t *c,			nta_outgoing_t *oreq,			sip_t const *sip,			nta_response_f response_function){  if (sip && sip->sip_status->st_status == 401 &&       sip->sip_www_authenticate &&      c->c_auth_retries++ < 3 &&       c->c_password && c->c_username) {    msg_t *rmsg = nta_outgoing_getrequest(oreq);    sip_t *rsip = sip_object(rmsg);    if (auc_challenge(&c->c_auth, c->c_home, sip->sip_www_authenticate,		      sip_authorization_class) >= 0 	&&	auc_all_credentials(&c->c_auth, NULL, NULL, c->c_username, c->c_password) > 0	&& 	auc_authorization(&c->c_auth, rmsg, (msg_pub_t *)rsip,			  rsip->sip_request->rq_method_name,			  rsip->sip_request->rq_url,			  rsip->sip_payload) > 0) {      nta_outgoing_destroy(c->c_orq);      sip_header_remove(rmsg, rsip, (sip_header_t *)rsip->sip_via);      nta_msg_request_complete(rmsg, c->c_leg, 0, NULL, NULL);      c->c_orq = nta_outgoing_tmcreate(c->c_agent, response_function, c, NULL, 				       rmsg, TAG_END());      return 1;    }  }  return 0;}				   static inlineint tag_from_header(nta_agent_t *nta,		    su_home_t *home,		    sip_from_t *f){  char *env = getenv("SIPTAG");  char *t = (void *)nta_agent_newtag(home, NULL, nta);  int retval;  if (env) {    char *t1 = su_sprintf(home, "tag=%s-%s", env, t);    su_free(home, t);    t = t1;  }  retval = sip_from_tag(home, f, t);  su_free(home, t);  return retval;}#endif /* !defined APPS_UTILS_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -