莫扎特最难的曲子:port exosip to android

来源:百度文库 编辑:中财网 时间:2024/05/01 10:17:40

 port exosip to android收藏

Port exosip to android platform isn't a difficult task becauseexosip doesn't rely on any special system calls that aren't available onandroid. It only requires osip to compile, which can also be easilyported.
As an example, I created two applications to run against exosip lib. Oneis a native application that can run in android shell, the other is anjava application that interact with exosip through jni. The dependencyrelationship 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
    • Android.mk
    • source files
  • libexosip
    • Android.mk
    • source files
  • sip_exe
    • jni
      • Android.mk
      • Application.mk
      • source file
  • sip_jni
    • jni
      • Android.mk
      • source files
    • libs
      • armeabi
        • libosip.so
        • libexosip.so
    • src
      • java source files
    • AndroidManifest.xml
To comply with ndk build system's requirements, we create adirectory named jni under sip_jni and sip_exe module, and place actualsource file there. The Android.mk and Application.mk (optional) areplaced in the jni directory as well. Keeping files this way, we canissue 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, theirAndroid.mk is placed directly under libosip and libexosip directories.This is because they are dependent on by application modules. We don'tneed compile them directly, instead, the build system will build themautomatically while building applications. In order to help build systemfind libosip and libexosip, we must set NDK_MODULE_PATH environmentvariable to the directory that directly containing  libosip andlibexosip. The build system will search for them based on directoryname, so their names matter.

To port exosip to android, the essential task is to create the Android.mkfile, which specifies source files, c flags, ld flags, dependentlibraries. We define HAVE_TIME_H and HAVE_SYS_SELECT_H to compile exosipsuccessfully. And we define ENABLE_TRACE and OSIP_MT to enable loggingand 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 thebuild system in android source tree. It enables us organizing ourprojects in arbitrary manner. For example, we can place libosip andlibexosip directories in another directory. The build system can stillfind them as long as NDK_MODULE_PATH is set to the directory containingthem. It's much more flexible than specifying dependency relationshipwith 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
Can not listen to port:25460 打开bt时总显示cannot listen to port can not listen to port:12480什么意思啊~1 我用BITCOMET时,弹出“can not listen to port:**” bitcomet 下载后点击:can not listen to port:8605 can not listen to port:7271什么意思啊 进入BitComet时,提示:can not listen to port:*** 有关andro mong的问题~ Title to Products will pass upon delivery of Products to the Port 中文? BitComet6.0在打开时出现can not listen to port:7105是怎么回事??? BitComet6.0在打开时出现can not listen to port:7105是怎么回事????? 打开bt下载电影时,弹出对话框”can not listen to port:22313”是什么原因,怎么处理? 为什么我使用BT时显示can not listen to port... 打开bitcomet的时候提示Can not listen to port:7974.为什么会这样? connect to service '192.168.10.212' at port '1110' failed:Connection refused 为什么一运行BITCOMET 会出现 can not listen to port:14839,要如何解决??? 用BT软件出现can not listen to port 26567这是怎么回事? 我用bitcomet 不能下载了,提示;can not listen to the port 我新下的BT一打开就弹出Can not listen to port:10252 是怎么回事? 我一打开BT就弹出一句”Can not listen to port:10252”是怎么回事啊? 为什么一运行BITCOMET 就出现 can not listen to port:xxxxx 打开BT后出现can not listen to port:12918是什么原因? 打开BT时弹出错误提示对话框写着:can not listen to port:26026 是什么原因? 打开BT显示can not listen to port:14376,然后不能下载,什么原因啊?