📄 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/**@file nua_stack.h * @brief Nokia User Agent Library - 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>#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};enum nh_oa_event { nua_sdp_none, nua_sdp_offer_sent, /**< O/A-1 offer sent */ nua_sdp_answer_recv, /**< O/A-2 answer received */ nua_sdp_offer_recv, /**< O/A-3 offer received */ nua_sdp_answer_sent /**< O/A-4 answer sent */};typedef struct nua_chat_s nua_chat_t;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);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)))typedef struct nua_handle_preferences{ unsigned nhp_retry_count; /**< times to retry a request */ unsigned nhp_max_subscriptions; /* Session-related preferences */ unsigned nhp_invite_enable:1; unsigned nhp_auto_alert:1; unsigned nhp_early_media:1;/**< Establish early media session */ unsigned nhp_auto_answer:1; unsigned nhp_auto_ack:1; /**< Automatically ACK a final response */ unsigned nhp_natify:1; unsigned nhp_gruuize:1; unsigned nhp_check_register:1; unsigned :0; /** INVITE timeout. * * If no response is received in nhp_invite_timeout seconds, * INVITE client transaction times out */ unsigned nhp_invite_timeout; /** Default session timer (in seconds, 0 disables) */ unsigned nhp_session_timer; /** Default Min-SE Delta value */ unsigned nhp_min_se; /** no (preference), local or remote */ enum nua_session_refresher nhp_refresher; unsigned nhp_update_refresh:1; /**< Use UPDATE to refresh */ /* Messaging preferences */ unsigned nhp_message_enable : 1; /** Be bug-compatible with Windows Messenger */ unsigned nhp_win_messenger_enable : 1; /** PIM-IW hack */ unsigned nhp_message_auto_respond : 1; /* Preferences for registration (and dialog establishment) */ unsigned nhp_callee_caps:1; /**< Add callee caps to contact */ unsigned nhp_media_features:1;/**< Add media features to caps*/ /** Enable Service-Route */ unsigned nhp_service_route_enable:1; /** Enable Path */ unsigned nhp_path_enable:1; unsigned:0; /* Default lifetime for implicit subscriptions created by REFER */ unsigned nhp_refer_expires; /* Subscriber state, i.e. nua_substate_pending */ unsigned nhp_substate; sip_allow_t *nhp_allow; sip_supported_t *nhp_supported; sip_user_agent_t *nhp_user_agent; char const *nhp_ua_name; sip_organization_t *nhp_organization; char const *nhp_instance; /* A bit for each feature set by application */ union { uint32_t set_any; struct { unsigned nhp_retry_count:1; unsigned nhp_max_subscriptions:1; unsigned nhp_invite_enable:1; unsigned nhp_auto_alert:1; unsigned nhp_early_media:1; unsigned nhp_auto_answer:1; unsigned nhp_auto_ack:1; unsigned nhp_natify:1; unsigned nhp_gruuize:1; unsigned nhp_invite_timeout:1; unsigned nhp_session_timer:1; unsigned nhp_min_se:1; unsigned nhp_refresher:1; unsigned nhp_update_refresh:1; unsigned nhp_message_enable:1; unsigned nhp_win_messenger_enable:1; unsigned nhp_message_auto_respond:1; unsigned nhp_callee_caps:1; unsigned nhp_media_features:1; unsigned nhp_service_route_enable:1; unsigned nhp_path_enable:1; unsigned nhp_refer_expires:1; unsigned nhp_substate:1; unsigned nhp_allow:1; unsigned nhp_supported:1; unsigned nhp_user_agent:1; unsigned nhp_ua_name:1; unsigned nhp_organization:1; unsigned nhp_instance; unsigned :0; } set_bits; } nhp_set;} nua_handle_preferences_t;/* Get preference from default handle */#define DNH_PGET(dnh, pref) \ DNHP_GET((dnh)->nh_prefs, pref)#define DNHP_GET(dnhp, pref) ((dnhp)->nhp_##pref)#define DNHP_SET(dnhp, pref, value) \ ((dnhp)->nhp_##pref = (value), (dnhp)->nhp_set.set_bits.nhp_##pref = 1)/* Get preference from handle, if set, otherwise from default handle */#define NH_PGET(nh, pref) \ NHP_GET((nh)->nh_prefs, (nh)->nh_nua->nua_dhandle->nh_prefs, pref)#define NHP_GET(nhp, dnhp, pref) \ ((nhp)->nhp_set.set_bits.nhp_##pref \ ? (nhp)->nhp_##pref : (dnhp)->nhp_##pref)/* Check if preference is set in the handle */#define NH_PISSET(nh, pref) \ (NHP_ISSET((nh)->nh_prefs, pref) && \ (nh)->nh_nua->nua_dhandle->nh_prefs != (nh)->nh_prefs)/* Check if preference is set */#define NHP_ISSET(nhp, pref) \ ((nhp)->nhp_set.set_bits.nhp_##pref)#define NHP_UNSET_ALL(nhp) ((nhp)->nhp_set.set_any = 0)#define NHP_SET_ALL(nhp) ((nhp)->nhp_set.set_any = 0xffffffffU)#define NHP_IS_ANY_SET(nhp) ((nhp)->nhp_set.set_any != 0)/** NUA handle. *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -