首页 > 其他分享 >port exosip to android

port exosip to android

时间:2023-06-02 21:39:50浏览次数:45  
标签:files system mk source build android exosip port

 

Port exosip to android platform isn't a difficult task because exosip doesn't rely on any special system calls that aren't available on android. It only requires osip to compile, which can also be easily ported.
As an example, I created two applications to run against exosip lib. One is a native application that can run in android shell, the other is an java application that interact with exosip through jni. The dependency relationship between modules is:



The diagram below depicts the organization of files. They're organized this way so that they can be compiled through android ndk build system.


exosip_root (NDK_MODULE_PATH environment variable points here)

  • libosip
  • libexosip
  • sip_exe
  • jni
  • sip_jni
  • jni
  • libs
  • armeabi
  • libosip.so
  • libexosip.so
  • src
  • java source files


To comply with ndk build system's requirements, we create a directory named jni under sip_jni and sip_exe module, and place actual source file there. The Android.mk and Application.mk (optional) are placed in the jni directory as well. Keeping files this way, we can issue ndk-build command right in sip_jni or sip_exe directories to compile applications.
Note that we don't create jni directory for libosip and libexosip, their Android.mk is placed directly under libosip and libexosip directories. This is because they are dependent on by application modules. We don't need compile them directly, instead, the build system will build them automatically while building applications. In order to help build system find libosip and libexosip, we must set NDK_MODULE_PATH environment variable to the directory that directly containing  libosip and libexosip. The build system will search for them based on directory name, so their names matter.

To port exosip to android, the essential task is to create the Android.mk file, which specifies source files, c flags, ld flags, dependent libraries. We define HAVE_TIME_H and HAVE_SYS_SELECT_H to compile exosip successfully. And we define ENABLE_TRACE and OSIP_MT to enable logging and multi-threading. In the last line, $ ( call import - module , libosip ) tells the build system that exosip depends on osip, and all header files exported by osip ( LOCAL_EXPORT_C_INCLUDES := $ ( LOCAL_C_INCLUDES ) )  will be included by exosip automatically. 
import-module is a feature that isn't available in the build system in android source tree. It enables us organizing our projects in arbitrary manner. For example, we can place libosip and libexosip directories in another directory. The build system can still find them as long as NDK_MODULE_PATH is set to the directory containing them. It's much more flexible than specifying dependency relationship with relative path.

Sample:
The sample for this post is available at:
http://code.google.com/p/rxwen-blog-stuff/source/browse/trunk/android/exosip_sample/
It shows how to:

  1. use ndk build system
  2. use stl in c++ code
  3. create a very basic exosip application
  4. call native code from java
  5. call java code from native code

References:
ndk document
exosip user manual

标签:files,system,mk,source,build,android,exosip,port
From: https://blog.51cto.com/u_16125990/6405067

相关文章

  • [原]Android上GTalk以及Push机制的XMPP数据选择使用protobuf格式而非XML格式
    [url]http://code.google.com/p/protobuf/[/url][b]先介绍下什么是protobuf以及有什么好处.[/b][i]ProtocolBuffersareawayofencodingstructureddatainanefficientyetextensibleformat.GoogleusesProtocolBuffersforalmostallofit......
  • Android上试用Linphone(Free SIP VOIP Client)
    1.下载Linphoneapk并且安装到两个Android手机上[url]http://www.linphone.org/eng/download/packages/android.html[/url]2.申请两个免费的SIP帐号进行测试[url]https://www.ekiga.net/[/url]3.在每个Android手机上分别配置Linphone应用程序点......
  • [原创]通过代码及流程图说明Google在Android上的Push机制的实现
    [color=red][b]声明:如果您要转载,请事先征得本人的同意后方可并且请您附上原文链接.本人保留一切权利.多谢![/b][/color]Google从FroYo版本后引入了C2DM(CloudtoDeviceMessaging)框架:[url]http://code.google.com/android/c2dm/index.html[/url......
  • android-夜间模式
    资源1AndroidMaterialDesign系列之夜间模式阐述了夜间模式的资源文件,告知建立了values-night文件夹对于夜间模式的颜色和主题配置,我们需要建立一个res下建立一个values-night文件夹,里面放着夜间主题样式的color等资源。colors.xml配置如下:<?xmlversion="1.0"encoding="utf-8"......
  • 移动开发之设计模式-组合模式(IOS&Android)
    组合模式组合模式(CompositePattern),又叫部分整体模式,是用于把一组相似的对象当作一个单一的对象。组合模式依据树形结构来组合对象,用来表示部分以及整体层次。这种类型的设计模式属于结构型模式,它创建了对象组的树形结构。这种模式创建了一个包含自己对象组的类。该类提供了修改相......
  • Fragment原理解析androidx版本&ViewPager与Fragment
    资料Fragment生命周期为什么要通过Fragment.setArguments(Bundle)传递参数单独问题:动态方式,静态方式添加随Activity启动动态添加回退栈onSaveInstance静态方式添加FragmentmHost是这个finalFragmentControllermFragments=FragmentController.createController(newHostCallb......
  • 2014.4.25.12.51_context_2014.4.25_Android种的Context详解
    Android中Context详解----你所不知道的Context一、Context相关类的继承关系2二、什么时候创建Context实例5从上可知一下三点,即:1、它描述的是一个应用程序环境的信息,即上下文。2、该类是一个抽象(abstractclass)类,Android提供了该抽象类的具体实现类(后面我们会讲到是Co......
  • 2015.4.24.17.23_界面_2015.4.24__Android界面设计工具_0.01
    iOS,Android原型图设计软件–>AxureRP,UIDesigner,Pencil,iPhoneMockup,Justinmind<–#AxureRPAxureRP-快速原型制作软件–线框图,原型,规格文档,由美国AxureSoftwareSolutions,Inc.公司开发。AxureRP也分商业版和免费版,英文官方:http://www.axure.com/download中文网站:h......
  • android基础-ConstraintLayout
    资料约束布局ConstraintLayout看这一篇就够了ConstraintLayout布局居中|居右实现。ConstraintLayout中TextView文字超过屏幕问题ConstraintLayoutConstraintLayout字体超出屏幕解决方法约束布局ConstraintLayout看这一篇就够了具体的方法layout_constraintLeft_toLeftOflayout_c......
  • Android利用tcpdump抓包
    [b]Instructions[/b][url]http://source.android.com/porting/tcpdump.html[/url][b]SourceCodeandDocuments[/b][url]http://www.tcpdump.org/[/url][b]CompiledBinaryDownload[/b][url]http://www.strazzere.com/android/tcpdump[/url]......