亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? nua_register.c

?? this is simple sip stack.
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * This file is part of the Sofia-SIP package * * Copyright (C) 2006 Nokia Corporation. * * Contact: Pekka Pessi <pekka.pessi@nokia.com> * * 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 * *//**@CFILE nua_register.c * @brief REGISTER and registrations * * @author Pekka Pessi <Pekka.Pessi@nokia.com> * * @date Created: Wed Mar  8 11:48:49 EET 2006 ppessi */#include "config.h"#include <sofia-sip/string0.h>#include <sofia-sip/su_strlst.h>#include <sofia-sip/su_uniqueid.h>#include <sofia-sip/su_tagarg.h>#include <sofia-sip/sip_protos.h>#include <sofia-sip/sip_util.h>#include <sofia-sip/sip_status.h>#define NTA_LEG_MAGIC_T      struct nua_handle_s#define NTA_OUTGOING_MAGIC_T struct nua_handle_s#define NTA_UPDATE_MAGIC_T   struct nua_s#include "nua_stack.h"#include <sofia-sip/hostdomain.h>#include <sofia-sip/nta_tport.h>#include <sofia-sip/tport.h>#include <sofia-sip/tport_tag.h>#define OUTBOUND_OWNER_T struct nua_handle_s#include "outbound.h"#if HAVE_SIGCOMP#include <sigcomp.h>#endif#include <stddef.h>#include <stdlib.h>#include <string.h>#include <limits.h>#include <assert.h>#if !defined(random) && defined(_WIN32)#define random rand#endif/* ======================================================================== *//* Registrations and contacts */int nua_registration_from_via(nua_registration_t **list,			      su_home_t *home,			      sip_via_t const *via,			      int public);int nua_registration_add(nua_registration_t **list, nua_registration_t *nr);void nua_registration_remove(nua_registration_t *nr);int nua_registration_set_aor(su_home_t *, nua_registration_t *nr,			     sip_from_t const *aor);int nua_registration_set_contact(su_home_t *,				 nua_registration_t *nr,				 sip_contact_t const *m,				 int terminating);void nua_registration_set_ready(nua_registration_t *nr, int ready);/* ====================================================================== *//* REGISTER usage */static char const *nua_register_usage_name(nua_dialog_usage_t const *du);static int nua_register_usage_add(nua_handle_t *nh,				  nua_dialog_state_t *ds,				  nua_dialog_usage_t *du);static void nua_register_usage_remove(nua_handle_t *nh,				      nua_dialog_state_t *ds,				      nua_dialog_usage_t *du);static void nua_register_usage_peer_info(nua_dialog_usage_t *du,					 nua_dialog_state_t const *ds,					 sip_t const *sip);/** REGISTER usage, aka nua_registration_t */struct register_usage {  nua_registration_t *nr_next, **nr_prev, **nr_list; /* Doubly linked list and its head */  sip_from_t *nr_aor;		/**< AoR for this registration, NULL if none */  sip_contact_t *nr_contact;	/**< Our Contact */  /** Status of registration */  unsigned nr_ready:1;  /** Kind of registration.   *   * If nr_default is true, this is not a real registration but placeholder   * for Contact header derived from a transport address.   *   * If nr_secure is true, this registration supports SIPS/TLS.   *   * If nr_public is true, transport should have public address.   */  unsigned nr_default:1, nr_secure:1, nr_public:1;  /** Stack-generated contact */  unsigned nr_by_stack:1, :0;  sip_route_t *nr_route;	/**< Outgoing Service-Route */  sip_path_t *nr_path;		/**< Incoming Path */  tport_t *nr_tport;		/**< Transport to be used when registered */  nua_dialog_state_t *nr_dialogs; /**< List of our dialogs */#if HAVE_SIGCOMP  struct sigcomp_compartment *nr_compartment;#endif  outbound_t *nr_ob;	/**< Outbound connection */};nua_usage_class const nua_register_usage[1] = {  {    sizeof (struct register_usage),    (sizeof nua_register_usage),    nua_register_usage_add,    nua_register_usage_remove,    nua_register_usage_name,    nua_register_usage_peer_info,  }};static char const *nua_register_usage_name(nua_dialog_usage_t const *du){  return "register";}static int nua_register_usage_add(nua_handle_t *nh,				  nua_dialog_state_t *ds,				  nua_dialog_usage_t *du){  nua_registration_t *nr = nua_dialog_usage_private(du);  if (ds->ds_has_register)    return -1;			/* There can be only one usage */  ds->ds_has_register = 1;  nr->nr_public = 1;		/* */  return 0;}static void nua_register_usage_remove(nua_handle_t *nh,				      nua_dialog_state_t *ds,				      nua_dialog_usage_t *du){  nua_registration_t *nr = nua_dialog_usage_private(du);  if (nr->nr_list)    nua_registration_remove(nr);	/* Remove from list of registrations */  if (nr->nr_ob)    outbound_unref(nr->nr_ob);#if HAVE_SIGCOMP  if (nr->nr_compartment)    sigcomp_compartment_unref(nr->nr_compartment);  nr->nr_compartment = NULL;#endif  ds->ds_has_register = 0;	/* There can be only one */}/** @internal Store information about registrar. */static void nua_register_usage_peer_info(nua_dialog_usage_t *du,					 nua_dialog_state_t const *ds,					 sip_t const *sip){  nua_registration_t *nr = nua_dialog_usage_private(du);  if (nr->nr_ob)    outbound_peer_info(nr->nr_ob, sip);}/* ======================================================================== *//* REGISTER */static void restart_register(nua_handle_t *nh, tagi_t *tags);static void refresh_register(nua_handle_t *, nua_dialog_usage_t *, sip_time_t);static int process_response_to_register(nua_handle_t *nh,					nta_outgoing_t *orq,					sip_t const *sip);static void unregister_expires_contacts(msg_t *msg, sip_t *sip);/* Interface towards outbound_t */static int nua_stack_outbound_features(nua_handle_t *nh, outbound_t *ob);static int nua_stack_outbound_refresh(nua_handle_t *,				      outbound_t *ob);static int nua_stack_outbound_status(nua_handle_t *,				     outbound_t *ob,				     int status, char const *phrase,				     tag_type_t tag, tag_value_t value, ...);static int nua_stack_outbound_failed(nua_handle_t *,				     outbound_t *ob,				     int status, char const *phrase,				     tag_type_t tag, tag_value_t value, ...);static int nua_stack_outbound_credentials(nua_handle_t *, auth_client_t **auc);outbound_owner_vtable nua_stack_outbound_callbacks = {    sizeof nua_stack_outbound_callbacks,    nua_stack_outbound_refresh,    nua_stack_outbound_status,    nua_stack_outbound_failed,    nua_stack_outbound_failed,    nua_stack_outbound_credentials  };/**@fn void nua_register(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...); *  * Send SIP REGISTER request to the registrar.  * * Request status will be delivered to the application using #nua_r_register * event. When successful the registration will be updated periodically. * * The handle used for registration cannot be used for any other purposes. * * @param nh              Pointer to operation handle * @param tag, value, ... List of tagged parameters * * @return *     nothing * * @par Related tags: *     NUTAG_REGISTRAR(), NUTAG_INSTANCE(), NUTAG_OUTBOUND(), *     NUTAG_KEEPALIVE(), NUTAG_KEEPALIVE_STREAM(), * * @par Events: *     #nua_r_register, #nua_i_outbound * * @par NAT, Firewall and Outbound Support * * If the application did not include the Contact header in the tags, * nua_register() will generate one and start a protocol engine for outbound * connections used for NAT and firewall traversal and connectivity checks.  * * First, nua_register() will probe for NATs in between UA and registrar. It * will send a REGISTER request as usual. Upon receiving the response it * checks for the presence of valid "received" and "rport" parameters in the * Via header returned by registrar. The presence of NAT is determined from * the "received" parameter in a Via header. When a REGISTER request was * sent, the stack inserted the source IP address in the Via header: if that * is different from the source IP address seen by the registrar, the * registrar inserts the source IP address it sees into the "received" * parameter. * * Please note that an ALG (application-level gateway) modifying the Via * headers in outbound requests and again in incoming responses will make * the above-described NAT check to fail. * * The response to the initial REGISTER should also include feature tags * indicating whether registrar supports various SIP extensions: @e * outbound, @e pref, @e path, @e gruu. * * Basically, @e outbound means that instead of registering its contact URI * with a particular address-of-record URI, the user-agent registers a * transport-level connection. Such a connection is identified on the * Contact header field with an instance identifier, application-provided * @ref NUTAG_INSTANCE() "unique string" identifying the user-agent instance * and a stack-generated numeric index identifying the transport-level * connection. * * If the @e outbound extension is supported, NUTAG_OUTBOUND() contains * option string "outbound" and the application has provided an instance * identifer to the stack with NUTAG_INSTANCE(), the nua_register() will try * to use outbound. * * If @e outbound is not supported, nua_register() has to generate a URI * that can be used to reach it from outside. It will check for public * transport addresses detected by underlying stack with, e.g., STUN, UPnP * or SOCKS. If there are public addresses, nua_register() will use them. If * there is no public address, it will try to generate a Contact URI from * the "received" and "rport" parameters found in the Via header of the * response message. * * @todo Actually generate public addresses. * * You can disable this kind of NAT traversal by setting "no-natify" into * NUTAG_OUTBOUND() options string. *  * @par GRUU and Service-Route * * After a successful response to the REGISTER request has been received, * nua_register() will update the information about the registration based * on it. If there is a "gruu" parameter included in the response, * nua_register() will save it and use the gruu URI in the Contact header * fields of dialog-establishing messages, such as INVITE or SUBSCRIBE.  * Also, if the registrar has included a Service-Route header in the * response, and the service route feature has not been disabled using * NUTAG_SERVICE_ROUTE_ENABLE(), the route URIs from the Service-Route * header will be used for initial non-REGISTER requests. * * The #nua_r_register message will include the contact header and route * used in with the registration. * * @par Registration Keep-Alive * * After the registration has successfully completed the nua_register() will * validate the registration and initiate the keepalive mechanism, too. The * user-agent validates the registration by sending a OPTIONS requests to * itself. If there is an error, nua_register() will indicate that to the * application using nua_i_outbound event, and start unregistration * procedure (unless that has been explicitly disabled). * * You can disable validation by inserting "no-validate" into * NUTAG_OUTBOUND() string. * * The keepalive mechanism depends on the network features detected earlier.  * If @a outbound extension is used, the STUN keepalives will be used.  * Otherwise, NUA stack will repeatedly send OPTIONS requests to itself. In * order to save bandwidth, it will include Max-Forwards: 0 in the * keep-alive requests, however. The keepalive interval is determined by * NUTAG_KEEPALIVE() parameter. If the interval is 0, no keepalive messages * is sent. * * You can disable keepalive OPTIONS by inserting "no-options-keepalive" * into NUTAG_OUTBOUND() string. Currently there are no other keepalive * mechanisms available. * * The value of NUTAG_KEEPALIVE_STREAM(), if specified, is used to indicate * the desired transport-layer keepalive interval for stream-based * transports like TLS and TCP. * * @sa NUTAG_OUTBOUND() and tags. *//** @var nua_event_e::nua_r_register * * Answer to outgoing REGISTER. * * The REGISTER may be sent explicitly by nua_register() or implicitly by * NUA state machines. The @a status may be 100 even if the real response * status returned is different if the REGISTER request has been restarted. * * @param nh     operation handle associated with the call * @param hmagic operation magic associated with the call * @param status registration status * @param sip    response to REGISTER request or NULL upon an error *               (error code and message are in status an phrase parameters) * @param tags   empty *//** @var nua_event_e::nua_i_outbound * * Answer to outgoing REGISTER. * * The REGISTER may be sent explicitly by nua_register() or * implicitly by NUA state machine. * * @param nh     operation handle associated with the call * @param hmagic operation magic associated with the call * @param sip    response to REGISTER request or NULL upon an error *               (error code and message are in status an phrase parameters) * @param tags   empty *//**@fn void nua_unregister(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...); * Unregister.  * * Send a REGISTER request with expiration time 0. This removes the  * registration from the registrar. If the handle was earlier used  * with nua_register() the periodic updates will be terminated.  * * If a SIPTAG_CONTACT_STR() with argument "*" is used, all the * registrations will be removed from the registrar otherwise only the * contact address belonging to the NUA stack is removed. * * @param nh              Pointer to operation handle * @param tag, value, ... List of tagged parameters * * @return *     nothing * * @par Related tags: *     NUTAG_REGISTRAR() \n *     Tags in <sip_tag.h> except SIPTAG_EXPIRES() or SIPTAG_EXPIRES_STR() * * @par Events: *     #nua_r_unregister *//** @var nua_event_e::nua_r_unregister * * Answer to outgoing un-REGISTER. * * @param nh     operation handle associated with the call * @param hmagic operation magic associated with the call * @param sip    response to REGISTER request or NULL upon an error *               (error code and message are in status and phrase parameters) * @param tags   empty */intnua_stack_register(nua_t *nua, nua_handle_t *nh, nua_event_t e,		   tagi_t const *tags){  nua_dialog_usage_t *du;  nua_registration_t *nr = NULL;  outbound_t *ob = NULL;  struct nua_client_request *cr = nh->nh_cr;  msg_t *msg = NULL;  sip_t *sip;  int terminating = e != nua_r_register;  if (nh->nh_special && nh->nh_special != nua_r_register)    return UA_EVENT2(e, 900, "Invalid handle for REGISTER");  if (cr->cr_orq)    return UA_EVENT2(e, 900, "Request already in progress");  nua_stack_init_handle(nua, nh, nh_has_register, "", TAG_NEXT(tags));  nh->nh_special = nua_r_register;  du = nua_dialog_usage_add(nh, nh->nh_ds, nua_register_usage, NULL);  if (!du)    return UA_EVENT1(e, NUA_INTERNAL_ERROR);  nr = nua_dialog_usage_private(du); assert(nr);  nua_registration_add(&nh->nh_nua->nua_registrations, nr);  if (!terminating && du->du_terminating)    return UA_EVENT2(e, 900, "Unregister in progress");  if (cr->cr_msg)    msg_destroy(cr->cr_msg), cr->cr_msg = NULL;  /* Use original message as template when unregistering */  if (terminating)		    cr->cr_msg = msg_ref_create(du->du_msg);  msg = nua_creq_msg(nua, nh, cr, cr->cr_msg != NULL,		     SIP_METHOD_REGISTER,		     TAG_IF(!terminating, NUTAG_USE_DIALOG(1)),		     TAG_NEXT(tags));  sip = sip_object(msg);  if (!msg || !sip)    goto error;  if (!nr->nr_aor) {    if (nua_registration_set_aor(nh->nh_home, nr, sip->sip_to) < 0)      goto error;  }  du->du_terminating = terminating;  if (du->du_msg == NULL)    du->du_msg = msg_ref_create(cr->cr_msg); /* Save original message */  if (terminating)    /* Add Expires: 0 and remove the expire parameters from contacts */    unregister_expires_contacts(msg, sip);  if (nua_registration_set_contact(nh->nh_home, nr, sip->sip_contact, terminating) < 0)    goto error;    ob = nr->nr_ob;    if (!ob && (NH_PGET(nh, outbound) || NH_PGET(nh, instance))) {    nr->nr_ob = ob = outbound_new(nh, &nua_stack_outbound_callbacks,				  nh->nh_nua->nua_root,				  nh->nh_nua->nua_nta,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一级日本不卡的影视| 国产成人99久久亚洲综合精品| 久久99精品国产麻豆婷婷| 成人网在线播放| 欧美高清视频www夜色资源网| 国产精品麻豆欧美日韩ww| 久久99久久精品欧美| 欧美视频一区在线观看| 亚洲欧洲国产日韩| 国产伦精品一区二区三区视频青涩| 在线欧美日韩国产| 国产精品传媒入口麻豆| 国产精品资源网| 精品日韩欧美在线| 奇米精品一区二区三区四区 | 欧美日韩中文另类| 国产精品污网站| 国产成人av影院| 精品sm捆绑视频| 午夜久久久久久| 欧美日韩在线综合| 亚洲卡通动漫在线| 色婷婷一区二区三区四区| 中文av字幕一区| 国产乱国产乱300精品| 久久久亚洲国产美女国产盗摄 | 日韩亚洲电影在线| 五月天丁香久久| 欧美午夜精品久久久久久超碰| 亚洲私人黄色宅男| 一本久久综合亚洲鲁鲁五月天| 中文字幕欧美区| 成人av小说网| 亚洲人成亚洲人成在线观看图片 | 欧美成人性战久久| 国产在线精品国自产拍免费| 精品入口麻豆88视频| 国产在线麻豆精品观看| 久久久久亚洲综合| av亚洲精华国产精华| 亚洲欧洲日本在线| 欧美性生活影院| 日本成人在线看| 亚洲精品一区二区精华| 国产91丝袜在线观看| 国产精品成人免费在线| 色婷婷亚洲精品| 日韩国产成人精品| 久久久激情视频| 91首页免费视频| 午夜欧美视频在线观看| 91精品国产综合久久小美女| 久久99精品国产麻豆婷婷| 欧美国产禁国产网站cc| 色av成人天堂桃色av| 日韩av午夜在线观看| 中文一区在线播放| 欧美性极品少妇| 国产一区二区看久久| 亚洲视频在线一区| 日韩视频在线一区二区| 丰满少妇在线播放bd日韩电影| 樱花草国产18久久久久| 欧美电影免费观看高清完整版| 成人久久18免费网站麻豆| 亚洲一区免费视频| 国产日韩欧美综合一区| 欧洲激情一区二区| 激情亚洲综合在线| 一区二区三区日本| 日韩精品一区国产麻豆| 色八戒一区二区三区| 国内精品久久久久影院薰衣草| 亚洲欧洲99久久| 精品成人佐山爱一区二区| 日本高清视频一区二区| 国产最新精品免费| 天天色综合成人网| 日韩毛片视频在线看| 欧美videossexotv100| 欧美亚洲精品一区| 北岛玲一区二区三区四区| 精品一区在线看| 亚洲国产一二三| 国产精品夫妻自拍| 久久久亚洲精品石原莉奈| 欧美精品欧美精品系列| 91视频91自| 91在线无精精品入口| 极品尤物av久久免费看| 午夜久久久影院| 亚洲大片精品永久免费| 国产精品久久久久9999吃药| www一区二区| 日韩精品一区二区三区四区视频 | 激情深爱一区二区| 午夜精品视频在线观看| 一区二区三区在线免费播放 | 免费看日韩a级影片| 亚洲自拍偷拍图区| 亚洲卡通动漫在线| 成人欧美一区二区三区黑人麻豆| 国产午夜精品一区二区三区四区| 91精品国产综合久久久久| 欧美日韩精品一区二区| 91福利在线观看| 在线观看日韩毛片| 色哟哟国产精品免费观看| 色综合天天综合给合国产| fc2成人免费人成在线观看播放| 国产成人亚洲综合a∨婷婷| 韩国三级电影一区二区| 狠狠狠色丁香婷婷综合久久五月| 蜜臀av一区二区在线免费观看 | 精品sm在线观看| 久久青草欧美一区二区三区| 久久久久九九视频| 国产精品视频一二三区| 国产精品久久久久天堂| 亚洲人成精品久久久久| 亚洲国产精品久久人人爱蜜臀| 亚洲一级电影视频| 日韩不卡在线观看日韩不卡视频| 蜜臀久久久99精品久久久久久| 免费观看在线综合色| 精品一区二区三区的国产在线播放| 久久国产精品第一页| 国产乱人伦偷精品视频免下载| 国产成人精品亚洲日本在线桃色| 国产成人av网站| 在线视频一区二区三| 欧美老人xxxx18| 精品乱人伦小说| 中文字幕一区二区三区av| 亚洲aaa精品| 激情综合色播激情啊| 91丝袜美女网| 日韩欧美一级二级三级久久久| 久久久噜噜噜久久中文字幕色伊伊 | 欧美日韩亚洲不卡| 欧美va亚洲va| 亚洲色图另类专区| 日本亚洲电影天堂| 成人av在线资源| 欧美久久久久中文字幕| 亚洲精品一区二区三区蜜桃下载| 1000精品久久久久久久久| 亚洲mv在线观看| 成人精品在线视频观看| 9191成人精品久久| 中文字幕免费观看一区| 丝袜诱惑制服诱惑色一区在线观看| 国产一区二区三区精品视频| 91视视频在线直接观看在线看网页在线看| 欧美日韩国产中文| 欧美国产成人精品| 日本美女一区二区三区| 色综合久久天天| 国产亚洲一区二区三区在线观看| 亚洲精品第1页| 国产一二精品视频| 69堂国产成人免费视频| 综合分类小说区另类春色亚洲小说欧美| 亚洲 欧美综合在线网络| 国产成人免费视频一区| 91精品国产一区二区三区香蕉 | 色综合咪咪久久| 国产亚洲精久久久久久| 三级久久三级久久久| av在线播放不卡| 久久久精品免费网站| 日韩影院在线观看| 在线观看91精品国产入口| 国产欧美日韩视频一区二区| 日韩av在线发布| 欧美色图在线观看| 亚洲天堂久久久久久久| 国产精品白丝jk黑袜喷水| 日韩视频一区二区| 午夜亚洲国产au精品一区二区| 91视频免费看| 日韩美女视频一区二区| 成人黄色网址在线观看| 久久久久久亚洲综合| 免费av网站大全久久| 欧美日韩国产综合一区二区| 一区二区成人在线视频| 91美女视频网站| 国产精品蜜臀av| 成人性生交大片免费看视频在线 | 日韩精品在线网站| 蜜臀av一级做a爰片久久| 欧美日韩精品免费| 亚洲午夜久久久久中文字幕久| 91理论电影在线观看| 成人免费一区二区三区在线观看| 成人黄色777网| 综合激情成人伊人| 色婷婷av一区二区三区gif| 亚洲欧美一区二区不卡|