📄 nua_stack.h
字号:
/* * This file is part of the Sofia-SIP package * * Copyright (C) 2005 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 * */#ifndef NUA_STACK_H/** Defined when <nua_stack.h> has been included. */#define NUA_STACK_H/**@IFILE nua_stack.h * @brief Sofia-SIP User Agent Engine - internal stack interface * * @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Kai Vehmanen <Kai.Vehmanen@nokia.com> * * @date Created: Wed Feb 14 17:09:44 2001 ppessi */#ifndef SU_CONFIG_H#include <su_config.h>#endif#if HAVE_UICC_H#include <uicc.h>#endif#if SU_HAVE_PTHREADS#include <pthread.h>#endif#ifndef SOA_H#include "sofia-sip/soa.h"#endif#ifndef NTA_H#include <sofia-sip/nta.h>#endif#ifndef AUTH_CLIENT_H#include <sofia-sip/auth_client.h>#endif#ifndef NEA_H#include <sofia-sip/nea.h>#endif#ifndef NUA_H#include <sofia-sip/nua.h>#endif#define SU_LOG (nua_log)#include <sofia-sip/su_debug.h>#ifndef NUA_DIALOG_H#define NUA_OWNER_T struct nua_handle_s#include <nua_dialog.h>#endifSOFIA_BEGIN_DECLS#if HAVE_SIGCOMP#include <sigcomp.h>#endif#ifndef NUA_PARAMS_H#include <nua_params.h>#endiftypedef struct event_s event_t;#define NONE ((void *)-1)enum nh_kind { nh_has_nothing, nh_has_invite, nh_has_subscribe, nh_has_notify, nh_has_register, nh_has_streaming};typedef struct nua_client_request nua_client_request_t; typedef struct nua_server_request nua_server_request_t; typedef void nua_creq_restart_f(nua_handle_t *, tagi_t *tags);typedef struct register_usage nua_registration_t;struct nua_client_request{ nua_event_t cr_event; /**< Request event */ nua_creq_restart_f *cr_restart; nta_outgoing_t *cr_orq; msg_t *cr_msg; nua_dialog_usage_t *cr_usage; unsigned short cr_retry_count; /**< Retry count for this request */ unsigned short cr_answer_recv; /**< Recv answer in response */ unsigned cr_offer_sent:1; /**< Sent offer in this request */ unsigned cr_offer_recv:1; /**< Recv offer in a response */ unsigned cr_answer_sent:1; /**< Sent answer in (PR)ACK */};typedef struct nua_session_state{ /** Session-related state */ unsigned ss_active:1; /**< Session is currently active. */ /* enum nua_callstate */ unsigned ss_state:4; /**< Session status (enum nua_callstate) */ unsigned ss_100rel:1; /**< Use 100rel, send 183 */ unsigned ss_alerting:1; /**< 180 is sent/received */ unsigned ss_update_needed:2; /**< Send an UPDATE (do O/A if > 1) */ unsigned ss_precondition:1; /**< Precondition required */ unsigned ss_hold_remote:1; /**< We are holding remote */ unsigned : 0; unsigned ss_session_timer; /**< Value of Session-Expires (delta) */ unsigned ss_min_se; /**< Minimum session expires */ enum nua_session_refresher ss_refresher; /**< none, local or remote */ char const *ss_ack_needed; /**< Send an ACK * (do O/A, if "offer" or "answer") */ nua_dialog_usage_t *ss_usage; /* Outgoing invite */ struct nua_client_request ss_crequest[1]; /* Incoming invite */ struct nua_server_request { /** Respond to an incoming INVITE transaction. * * When the application responds to an incoming INVITE transaction with * nua_respond(), the ss_respond_to_invite() is called (if non-NULL). */ void (*sr_respond)(nua_t *nua, nua_handle_t *nh, int status, char const *phrase, tagi_t const *tags); nta_incoming_t *sr_irq; msg_t *sr_msg; /**< Request message */ unsigned sr_offer_recv:1; /**< We have received an offer */ unsigned sr_answer_sent:2; /**< We have answered (reliably, if >1) */ unsigned sr_offer_sent:1; /**< We have offered SDP */ unsigned sr_answer_recv:1; /**< We have received SDP answer */ } ss_srequest[1];} nua_session_state_t;#define \ NH_ACTIVE_MEDIA_TAGS(include, soa) \ TAG_IF((include) && (soa) && soa_is_audio_active(soa) >= 0, \ SOATAG_ACTIVE_AUDIO(soa_is_audio_active(soa))), \ TAG_IF((include) && (soa) && soa_is_video_active(soa) >= 0, \ SOATAG_ACTIVE_VIDEO(soa_is_video_active(soa))), \ TAG_IF((include) && (soa) && soa_is_image_active(soa) >= 0, \ SOATAG_ACTIVE_IMAGE(soa_is_image_active(soa))), \ TAG_IF((include) && (soa) && soa_is_chat_active(soa) >= 0, \ SOATAG_ACTIVE_CHAT(soa_is_chat_active(soa)))#define \ NH_REMOTE_MEDIA_TAGS(include, soa) \ TAG_IF((include) && (soa) && soa_is_remote_audio_active(soa) >= 0, \ SOATAG_ACTIVE_AUDIO(soa_is_remote_audio_active(soa))), \ TAG_IF((include) && (soa) && soa_is_remote_video_active(soa) >= 0, \ SOATAG_ACTIVE_VIDEO(soa_is_remote_video_active(soa))), \ TAG_IF((include) && (soa) && soa_is_remote_image_active(soa) >= 0, \ SOATAG_ACTIVE_IMAGE(soa_is_remote_image_active(soa))), \ TAG_IF((include) && (soa) && soa_is_remote_chat_active(soa) >= 0, \ SOATAG_ACTIVE_CHAT(soa_is_remote_chat_active(soa)))/** NUA handle. * */struct nua_handle_s { su_home_t nh_home[1]; /**< Memory home */ nua_handle_t *nh_next; nua_handle_t **nh_prev; nua_t *nh_nua; /**< Pointer to NUA object */ void *nh_valid; nua_hmagic_t *nh_magic; /**< Application context */ tagi_t *nh_tags; /**< Default tags */#if HAVE_PTHREAD_H#if __CYGWIN__ pthread_mutex_t sup_reflock[1]; int sup_ref;#else pthread_rwlock_t nh_refcount[1]; #endif#else unsigned nh_refcount;#endif nua_handle_preferences_t *nh_prefs; /**< Preferences */ /* Handle state */ nua_event_t nh_special; /**< Special event */ unsigned nh_ref_by_stack:1; /**< Has stack used the handle? */ unsigned nh_ref_by_user:1; /**< Has user used the handle? */ unsigned nh_init:1; unsigned nh_has_invite:1; /**< Has call */ unsigned nh_has_subscribe:1; /**< Has watcher */ unsigned nh_has_notify:1; /**< Has notifier */ unsigned nh_has_register:1; /**< Has registration */ unsigned nh_has_streaming:1; /**< Has RTSP-related session */ struct nua_client_request nh_cr[1]; nua_dialog_state_t nh_ds[1]; nua_session_state_t nh_ss[1]; auth_client_t *nh_auth; /**< Authorization objects */ soa_session_t *nh_soa; /**< Media session */ struct nua_referral { nua_handle_t *ref_handle; /**< Referring handle */ sip_event_t *ref_event; /**< Event used with NOTIFY */ } nh_referral[1]; nea_server_t *nh_notifier; /**< SIP notifier */};#define NH_IS_VALID(nh) ((nh) && (nh)->nh_valid)#define NH_STATUS(nh) \ (nh)->nh_status, \ (nh)->nh_phrase, \ SIPTAG_WARNING_STR(nh->nh_warning)#define NH_IS_DEFAULT(nh) ((nh) == (nh)->nh_nua->nua_handles)static inlineint nh_is_special(nua_handle_t *nh){ return nh == NULL || nh->nh_special;}static inlineint nh_has_session(nua_handle_t const *nh){ return nh != NULL && nh->nh_ss->ss_state > nua_callstate_init && nh->nh_ss->ss_state < nua_callstate_terminated;}extern char const nua_internal_error[];#define NUA_INTERNAL_ERROR 900, nua_internal_error
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -