linphone3.4.0代码分析

主要类型定义:

1、LinphoneCoreVTable

/**
 * This structure holds all callbacks that the application should implement.
 *  None is mandatory.
**/
typedef struct _LinphoneVTable{
    LinphoneGlobalStateCb global_state_changed; /**<Notifies globlal state changes*/
    LinphoneRegistrationStateCb registration_state_changed;/**<Notifies registration state changes*/
    LinphoneCallStateCb call_state_changed;/**<Notifies call state changes*/
    NotifyPresenceReceivedCb notify_presence_recv; /**< Notify received presence events*/
    NewSubscribtionRequestCb new_subscription_request; /**< Notify about pending subscription request */
    AuthInfoRequested auth_info_requested; /**< Ask the application some authentication information */
    CallLogUpdated call_log_updated; /**< Notifies that call log list has been updated */
    TextMessageReceived text_received; /**< A text message has been received */
    DtmfReceived dtmf_received; /**< A dtmf has been received received */
    ReferReceived refer_received; /**< An out of call refer was received */
    BuddyInfoUpdated buddy_info_updated; /**< a LinphoneFriend‘s BuddyInfo has changed*/
    NotifyReceivedCb notify_recv; /**< Other notifications*/
    DisplayStatusCb display_status; /**< Callback that notifies various events with human readable text.*/
    DisplayMessageCb display_message;/**< Callback to display a message to the user */
    DisplayMessageCb display_warning;/** Callback to display a warning to the user */
    DisplayUrlCb display_url;
    ShowInterfaceCb show; /**< Notifies the application that it should show up*/
} LinphoneCoreVTable;

app(GTK)中相对应的实现接口函数:    vtable.call_state_changed=linphone_gtk_call_state_changed;    vtable.registration_state_changed=linphone_gtk_registration_state_changed;    vtable.show=linphone_gtk_show;    vtable.notify_presence_recv=linphone_gtk_notify_recv;    vtable.new_subscription_request=linphone_gtk_new_unknown_subscriber;    vtable.auth_info_requested=linphone_gtk_auth_info_requested;    vtable.display_status=linphone_gtk_display_status;    vtable.display_message=linphone_gtk_display_message;    vtable.display_warning=linphone_gtk_display_warning;    vtable.display_url=linphone_gtk_display_url;    vtable.call_log_updated=linphone_gtk_call_log_updated;    vtable.text_received=linphone_gtk_text_received;    vtable.refer_received=linphone_gtk_refer_received;    vtable.buddy_info_updated=linphone_gtk_buddy_info_updated;
app(linphonec)中相对应的实现接口函数:    linphonec_vtable.call_state_changed=linphonec_call_state_changed;    linphonec_vtable.notify_presence_recv = linphonec_notify_presence_received;    linphonec_vtable.new_subscription_request = linphonec_new_unknown_subscriber;    linphonec_vtable.auth_info_requested = linphonec_prompt_for_auth;    linphonec_vtable.display_status = linphonec_display_status;    linphonec_vtable.display_message=linphonec_display_something;    linphonec_vtable.display_warning=linphonec_display_warning;    linphonec_vtable.display_url=linphonec_display_url;    linphonec_vtable.text_received=linphonec_text_received;    linphonec_vtable.dtmf_received=linphonec_dtmf_received;    linphonec_vtable.refer_received=linphonec_display_refer;    linphonec_vtable.notify_recv=linphonec_notify_received;

2、Sal(Signaling Abstraction Layer)

/**  This header files defines the Signaling Abstraction Layer. The purpose of this layer is too allow experiment different call signaling  protocols and implementations under linphone, for example SIP, JINGLE...**/

struct Sal{
    SalCallbacks callbacks;
    MSList *calls; /*MSList of SalOp */
    MSList *registers;/*MSList of SalOp */
    MSList *out_subscribes;/*MSList of SalOp */
    MSList *in_subscribes;/*MSList of SalOp */
    MSList *pending_auths;/*MSList of SalOp */
    MSList *other_transactions; /*MSList of SalOp */
    int running;
    int session_expires;
    int keepalive_period;
    void *up;
    bool_t one_matching_codec;
    bool_t double_reg;
};

3、SalCallbacks

typedef void (*SalOnCallReceived)(SalOp *op);
typedef void (*SalOnCallRinging)(SalOp *op);
typedef void (*SalOnCallAccepted)(SalOp *op);
typedef void (*SalOnCallAck)(SalOp *op);
typedef void (*SalOnCallUpdating)(SalOp *op);/*< Called when a reINVITE is received*/
typedef void (*SalOnCallTerminated)(SalOp *op, const char *from);
typedef void (*SalOnCallFailure)(SalOp *op, SalError error, SalReason reason, const char *details, int code);
typedef void (*SalOnCallReleased)(SalOp *salop);
typedef void (*SalOnAuthRequested)(SalOp *op, const char *realm, const char *username);
typedef void (*SalOnAuthSuccess)(SalOp *op, const char *realm, const char *username);
typedef void (*SalOnRegisterSuccess)(SalOp *op, bool_t registered);
typedef void (*SalOnRegisterFailure)(SalOp *op, SalError error, SalReason reason, const char *details);
typedef void (*SalOnVfuRequest)(SalOp *op);
typedef void (*SalOnDtmfReceived)(SalOp *op, char dtmf);
typedef void (*SalOnRefer)(Sal *sal, SalOp *op, const char *referto);
typedef void (*SalOnTextReceived)(Sal *sal, const char *from, const char *msg);
typedef void (*SalOnNotify)(SalOp *op, const char *from, const char *value);
typedef void (*SalOnNotifyPresence)(SalOp *op, SalSubscribeState ss, SalPresenceStatus status, const char *msg);
typedef void (*SalOnSubscribeReceived)(SalOp *salop, const char *from);
typedef void (*SalOnSubscribeClosed)(SalOp *salop, const char *from);
typedef void (*SalOnInternalMsg)(Sal *sal, const char *msg);
typedef void (*SalOnPingReply)(SalOp *salop);

typedef struct SalCallbacks{
    SalOnCallReceived call_received;
    SalOnCallRinging call_ringing;
    SalOnCallAccepted call_accepted;
    SalOnCallAck call_ack;
    SalOnCallUpdating call_updating;
    SalOnCallTerminated call_terminated;
    SalOnCallFailure call_failure;
    SalOnCallReleased call_released;
    SalOnAuthRequested auth_requested;
    SalOnAuthSuccess auth_success;
    SalOnRegisterSuccess register_success;
    SalOnRegisterFailure register_failure;
    SalOnVfuRequest vfu_request;
    SalOnDtmfReceived dtmf_received;
    SalOnRefer refer_received;
    SalOnTextReceived text_received;
    SalOnNotify notify;
    SalOnNotifyPresence notify_presence;
    SalOnSubscribeReceived subscribe_received;
    SalOnSubscribeClosed subscribe_closed;
    SalOnInternalMsg internal_message;
    SalOnPingReply ping_reply;
}SalCallbacks;

linphone中的sal层默认实现:SalCallbacks linphone_sal_callbacks={    call_received,    call_ringing,    call_accepted,    call_ack,    call_updating,    call_terminated,    call_failure,    call_released,    auth_requested,    auth_success,    register_success,    register_failure,    vfu_request,    dtmf_received,    refer_received,    text_received,    notify,    notify_presence,    subscribe_received,    subscribe_closed,    internal_message,    ping_reply};

4、LinphoneCallState

/**
 * LinphoneCallState enum represents the different state a call can reach into.
 * The application is notified of state changes through the LinphoneCoreVTable::call_state_changed callback.
 * @ingroup call_control
**/
typedef enum _LinphoneCallState{
    LinphoneCallIdle,                    /**<Initial call state */
    LinphoneCallIncomingReceived, /**<This is a new incoming call */
    LinphoneCallOutgoingInit, /**<An outgoing call is started */
    LinphoneCallOutgoingProgress, /**<An outgoing call is in progress */
    LinphoneCallOutgoingRinging, /**<An outgoing call is ringing at remote end */
    LinphoneCallOutgoingEarlyMedia, /**<An outgoing call is proposed early media */
    LinphoneCallConnected, /**<Connected, the call is answered */
    LinphoneCallStreamsRunning, /**<The media streams are established and running*/
    LinphoneCallPausing, /**<The call is pausing at the initiative of local end */
    LinphoneCallPaused, /**< The call is paused, remote end has accepted the pause */
    LinphoneCallResuming, /**<The call is being resumed by local end*/
    LinphoneCallRefered, /**<The call is being transfered to another party, resulting in a new outgoing call to follow immediately*/
    LinphoneCallError, /**<The call encountered an error*/
    LinphoneCallEnd, /**<The call ended normally*/
    LinphoneCallPausedByRemote, /**<The call is paused by remote end*/
    LinphoneCallUpdatedByRemote, /**<The call‘s parameters are updated, used for example when video is asked by remote */
    LinphoneCallIncomingEarlyMedia, /**<We are proposing early media to an incoming call */
    LinphoneCallUpdated, /**<The remote accepted the call update initiated by us */
    LinphoneCallReleased /**< The call object is no more retained by the core */
} LinphoneCallState;

主要函数:

1、linphone_core_new

/**
 * Instanciates a LinphoneCore object.
 * @ingroup initializing
 *
 * The LinphoneCore object is the primary handle for doing all phone actions.
 * It should be unique within your application.
 * @param vtable a LinphoneCoreVTable structure holding your application callbacks
 * @param config_path a path to a config file. If it does not exists it will be created.
 *        The config file is used to store all settings, call logs, friends, proxies... so that all these settings
 *           become persistent over the life of the LinphoneCore object.
 *           It is allowed to set a NULL config file. In that case LinphoneCore will not store any settings.
 * @param factory_config_path a path to a read-only config file that can be used to
 *        to store hard-coded preference such as proxy settings or internal preferences.
 *        The settings in this factory file always override the one in the normal config file.
 *        It is OPTIONAL, use NULL if unneeded.
 * @param userdata an opaque user pointer that can be retrieved at any time (for example in
 *        callbacks) using linphone_core_get_user_data().
 *
**/
LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
                        const char *config_path, const char *factory_config_path, void * userdata)

aa

时间: 2024-10-19 03:48:32

linphone3.4.0代码分析的相关文章

Lua1.0 代码分析 库

Lua1.0 代码分析 库库的代码相对比较简单.这里以数学库为例进行说明.比如看下这个取绝对值的数学函数 static void math_abs (void) {  double d;  lua_Object o = lua_getparam (1);  if (o == NULL)  { lua_error ("too few arguments to function `abs'"); return; }  if (!lua_isnumber(o))  { lua_error (

Lua1.0 代码分析 table.c

转载出处:http://my.oschina.net/xhan/blog/307961 table.c 代码分析 全局符号,常量,字符串,关联数组,文件列表的定义. 全局符号: 初始有 5 个基本的符号,Lua 预设的函数和库函数都注册在里面. 常量: 初始的几个常量是 Lua 中 type 的名字. 字符串表,关联数组表,文件列表 所有的这些在 table.c 中定义的这些数组可以认为是 Lua 的全局注册表空间,Lua 的环境. 函数分析 ? 1 2 3 4 5 6 7 8 9 10 11

Lua1.0 代码分析 inout.c

inout.c 代码分析 主要看下对于文件的处理 /* ** Function to open a file to be input unit. ** Return 0 on success or 1 on error. */ int lua_openfile (char *fn) {  lua_linenumber = 1;  lua_setinput (fileinput);  lua_setunput (fileunput);  fp = fopen (fn, "r");  if

Lua1.0 代码分析 hash.c

转载出处:http://my.oschina.net/xhan/blog/308325 hash.c 代码分析Lua 中最重要的一个数据结构及相关操作.主要看下几个对外的接口. ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 /* ** Create a new hash. Return the hash pointer or NULL on error. */ Hash *lua_hashcreate (unsigned int 

OAuth2.0学习(4-1)Spring Security OAuth2.0 - 代码分析

1.org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter              org.springframework.security.oauth2.provider.client.ClientCredentialsTokenEndpointFilter              org.springframework.security.oauth2.client.fil

SDL2.0例子代码分析-----CheckKeys Project

SDL简介 SDL(Simple DirectMedia Layer)是一套开放源代码的跨平台多媒体开发库,使用C语言写成.SDL提供了数种控制图像.声音.输出入的函数,让开发者只要用相同或是相似的代码就可以开发出跨多个平台(Linux.Windows.Mac OS X等)的应用软件.目前SDL多用于开发游戏.模拟器.媒体播放器等多媒体应用领域. SDL1.2和SDL2的差别 SDK1.2和SDL2.1系列的API接口变动的不小,当然功能也大大增强,支持多线程窗口. 具体的change 请看 h

Android4.0图库Gallery2代码分析(二) 数据管理和数据加载

Android4.0图库Gallery2代码分析(二) 数据管理和数据加载 2012-09-07 11:19 8152人阅读 评论(12) 收藏 举报 代码分析android相册优化工作 Android4.0图库Gallery2代码分析(二) 数据管理和数据加载 一 图库数据管理 Gallery2的数据管理 DataManager(职责:管理数据源)- MediaSource(职责:管理数据集) - MediaSet(职责:管理数据项).DataManager中初始化所有的数据源(LocalSo

(原创)cocos2d-x 3.0 示例代码分析1:AppDelegate

星月最近在用3.0做类似刀塔游戏,第一次用3.0,之前一直只是查查资料,最近发现做一些特定行为需要对3.0一些新的特性了解.所以趁这个机会,把3.0的测试代码过一遍,同时增加注释,希望能对大家有帮助~ 因为项目原因,所以不定期更新~~(小白:借口,继续找借口!) 星月倾心贡献~~~ // AppDelegate.cpp /**************************************************************************** Copyright (

阅读代码分析工具Understand 2.0试用

Understand 2.0是一款源码阅读分析软件,功能强大.试用过一段时间后,感觉相当不错,确实能够大大提高代码阅读效率. 因为Understand功能十分强大,本文不可能详尽地介绍它的全部功能,所以仅仅列举本人觉得比較重要或有特色的功能,以做抛砖引玉之举. Understand 2.0能够从http://www.scitools.com/下载到,安装后能够试用15天. 使用Understand阅读代码前.要先创建一个Project,然后把全部的源码文件增加到这个Project里.这里我创建了