mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 04:28:10 +00:00
* improve makefiles
* add fonis plugin for liblinphone * clean a few char* to const char * git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@341 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
parent
26db37b47f
commit
6c708223ba
7 changed files with 162 additions and 20 deletions
|
|
@ -1,11 +1,19 @@
|
|||
EXTRA_DIST=dependencies dependencies-src src test-src
|
||||
|
||||
SUBDIRS=launcher
|
||||
SUBDIRS=launcher plugin-src
|
||||
|
||||
antbuild/dist/p2pproxy_0.1/p2pproxy.jar: src/org/linphone/p2pproxy/*/*.java
|
||||
ALL_JARS= \
|
||||
antbuild/dist/p2pproxy_0.1/bcprov-jdk14.jar antbuild/dist/p2pproxy_0.1/log4j.jar \
|
||||
antbuild/dist/p2pproxy_0.1/javax.servlet.jar antbuild/dist/p2pproxy_0.1/org.mortbay.jetty.jar \
|
||||
antbuild/dist/p2pproxy_0.1/jstun-0.7.0.jar antbuild/dist/p2pproxy_0.1/p2pproxy.jar \
|
||||
antbuild/dist/p2pproxy_0.1/junit-4.3.1.jar antbuild/dist/p2pproxy_0.1/sip.jar
|
||||
|
||||
$(ALL_JARS): src/org/linphone/p2pproxy/*/*.java
|
||||
$(ANT) dist
|
||||
|
||||
jarsdir=$(datadir)/java/fonis
|
||||
|
||||
jars_DATA=antbuild/dist/p2pproxy_0.1/p2pproxy.jar antbuild/dist/p2pproxy_0.1/*.jar
|
||||
jars_DATA=$(ALL_JARS)
|
||||
|
||||
clean-local:
|
||||
$(ANT) clean
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ AC_ARG_ENABLE(strict,
|
|||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_LIBTOOL
|
||||
AC_ENABLE_SHARED(yes)
|
||||
AC_ENABLE_STATIC(no)
|
||||
AC_DISABLE_STATIC
|
||||
|
||||
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
|
|
@ -59,6 +58,11 @@ fi
|
|||
|
||||
AC_DEFINE_UNQUOTED(P2PPROXY_INSTALLDIR,"$jarsdir",[path of jars])
|
||||
|
||||
PKG_CHECK_MODULES(LIBLINPHONE, linphone >= 3.0.0)
|
||||
|
||||
LINPHONE_PLUGINS_DIR="\$(libdir)/liblinphone/plugins/"
|
||||
AC_SUBST(LINPHONE_PLUGINS_DIR)
|
||||
|
||||
dnl ##################################################
|
||||
dnl # Check for ESP Packager
|
||||
dnl ##################################################
|
||||
|
|
@ -124,4 +128,5 @@ AC_OUTPUT(
|
|||
Makefile
|
||||
launcher/Makefile
|
||||
launcher/src/Makefile
|
||||
plugin-src/Makefile
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,19 +5,19 @@ JAVA_LDFLAGS=\
|
|||
-Wl,-rpath,$(javadir)/jre/lib/amd64 -Wl,-rpath,$(javadir)/jre/lib/i386 \
|
||||
-Wl,-rpath,$(javadir)/jre/lib/amd64/server -Wl,-rpath,$(javadir)/jre/lib/i386/server
|
||||
|
||||
lib_LTLIBRARIES=libfonis.la
|
||||
noinst_LTLIBRARIES=libfonisc.la
|
||||
|
||||
libfonis_la_SOURCES=p2pproxy.c p2pproxy.h
|
||||
libfonisc_la_SOURCES=p2pproxy.c p2pproxy.h
|
||||
|
||||
libfonis_la_LIBADD=$(JAVA_LIBS)
|
||||
libfonisc_la_LIBADD=$(JAVA_LIBS)
|
||||
|
||||
libfonis_la_LDFLAGS=$(JAVA_LDFLAGS)
|
||||
libfonisc_la_LDFLAGS=$(JAVA_LDFLAGS)
|
||||
|
||||
noinst_PROGRAMS=launcher-tester
|
||||
|
||||
launcher_tester_SOURCES=launcher-tester.c
|
||||
|
||||
launcher_tester_LDADD=libfonis.la $(JAVA_LIBS)
|
||||
launcher_tester_LDADD=libfonisc.la $(JAVA_LIBS)
|
||||
|
||||
launcher_tester_LDFLAGS=$(JAVA_LDFLAGS)
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ int p2pproxy_accountmgt_deleteAccount(const char* user_name) {
|
|||
return lResult;
|
||||
}
|
||||
|
||||
int p2pproxy_resourcemgt_lookup_sip_proxy(char* proxy_uri,size_t size, char* domaine) {
|
||||
int p2pproxy_resourcemgt_lookup_sip_proxy(char* proxy_uri,size_t size, const char* domain) {
|
||||
jmethodID lLookupSipProxyUriMethod;
|
||||
jstring lJStringResult;
|
||||
const char* lString;
|
||||
|
|
@ -149,7 +149,7 @@ int p2pproxy_resourcemgt_lookup_sip_proxy(char* proxy_uri,size_t size, char* dom
|
|||
GET_JNI_ENV
|
||||
|
||||
|
||||
applicationArg = (*lJniEnv)->NewStringUTF(lJniEnv, domaine);
|
||||
applicationArg = (*lJniEnv)->NewStringUTF(lJniEnv, domain);
|
||||
lLookupSipProxyUriMethod = (*lJniEnv)->GetStaticMethodID(lJniEnv, lMainClass, "lookupSipProxyUri", "(Ljava/lang/String;)Ljava/lang/String;");
|
||||
lJStringResult = (*lJniEnv)->CallStaticObjectMethod(lJniEnv, lMainClass, lLookupSipProxyUriMethod, applicationArg);
|
||||
if (lJStringResult == 0) {
|
||||
|
|
@ -162,7 +162,7 @@ int p2pproxy_resourcemgt_lookup_sip_proxy(char* proxy_uri,size_t size, char* dom
|
|||
return P2PPROXY_NO_ERROR;
|
||||
}
|
||||
|
||||
int p2pproxy_resourcemgt_revoke_sip_proxy(char* proxy_uri) {
|
||||
int p2pproxy_resourcemgt_revoke_sip_proxy(const char* proxy_uri) {
|
||||
jmethodID revokeProxyMethod;
|
||||
jstring applicationArg;
|
||||
GET_JNI_ENV
|
||||
|
|
@ -213,7 +213,7 @@ void p2pproxy_resourcemgt_delete_resource_list(p2pproxy_resourcemgt_resource_lis
|
|||
free(resource_list);
|
||||
}
|
||||
|
||||
int p2pproxy_resourcemgt_lookup_media_resource(p2pproxy_resourcemgt_resource_list_t* resource_list, char* domaine) {
|
||||
int p2pproxy_resourcemgt_lookup_media_resource(p2pproxy_resourcemgt_resource_list_t* resource_list, const char* domain) {
|
||||
jmethodID lLookupMediaResourceMethod;
|
||||
jarray lJStringResults;
|
||||
jstring lResourceInstance;
|
||||
|
|
@ -227,7 +227,7 @@ int p2pproxy_resourcemgt_lookup_media_resource(p2pproxy_resourcemgt_resource_lis
|
|||
GET_JNI_ENV
|
||||
|
||||
|
||||
applicationArg = (*lJniEnv)->NewStringUTF(lJniEnv, domaine);
|
||||
applicationArg = (*lJniEnv)->NewStringUTF(lJniEnv, domain);
|
||||
lLookupMediaResourceMethod = (*lJniEnv)->GetStaticMethodID(lJniEnv, lMainClass, "lookupMediaServerAddress", "(Ljava/lang/String;)[Ljava/lang/String;");
|
||||
lJStringResults = (*lJniEnv)->CallStaticObjectMethod(lJniEnv, lMainClass, lLookupMediaResourceMethod, applicationArg);
|
||||
if (lJStringResults == 0) {
|
||||
|
|
@ -248,7 +248,7 @@ int p2pproxy_resourcemgt_lookup_media_resource(p2pproxy_resourcemgt_resource_lis
|
|||
(*p2pproxy_application_jvm)->DetachCurrentThread(p2pproxy_application_jvm);
|
||||
return P2PPROXY_NO_ERROR;
|
||||
}
|
||||
int p2pproxy_resourcemgt_revoke_media_resource(char* resource_uri) {
|
||||
int p2pproxy_resourcemgt_revoke_media_resource(const char* resource_uri) {
|
||||
jmethodID revokeMediaResourceMethod;
|
||||
jstring applicationArg;
|
||||
GET_JNI_ENV
|
||||
|
|
|
|||
|
|
@ -127,27 +127,27 @@ void p2pproxy_resourcemgt_delete_resource_list(p2pproxy_resourcemgt_resource_lis
|
|||
* @param [in] domaine name
|
||||
* @return status code P2PPROXY_NO_ERROR, P2PPROXY_ERROR_RESOURCELOCATOR_SERVER_NOT_FOUND
|
||||
*/
|
||||
int p2pproxy_resourcemgt_lookup_sip_proxy(char* proxy_uri,size_t size, char* domaine) ;
|
||||
int p2pproxy_resourcemgt_lookup_sip_proxy(char* proxy_uri,size_t size, const char* domain) ;
|
||||
/**
|
||||
* access a media ressource addresses for a given domaine name
|
||||
* @param [out] p2pproxy_resourcemgt_resource_list_t allocated by the user (size = 0)
|
||||
* @param [in] domaine name
|
||||
* @return status code P2PPROXY_NO_ERROR, P2PPROXY_ERROR_RESOURCELOCATOR_SERVER_NOT_FOUND
|
||||
*/
|
||||
int p2pproxy_resourcemgt_lookup_media_resource(p2pproxy_resourcemgt_resource_list_t* resource_list, char* domaine) ;
|
||||
int p2pproxy_resourcemgt_lookup_media_resource(p2pproxy_resourcemgt_resource_list_t* resource_list, const char* domain) ;
|
||||
/*
|
||||
* notify the library at a given proxy is no longuer reachable
|
||||
* @param [in] proxy sip uri
|
||||
* @return status code P2PPROXY_NO_ERROR
|
||||
*/
|
||||
int p2pproxy_resourcemgt_revoke_sip_proxy(char* proxy_uri);
|
||||
int p2pproxy_resourcemgt_revoke_sip_proxy(const char* proxy_uri);
|
||||
|
||||
/*
|
||||
* notify the library at a given Media resoure is no longuer reachable
|
||||
* @param [in] media resource uri (udp://hostname:port)
|
||||
* @return status code P2PPROXY_NO_ERROR
|
||||
*/
|
||||
int p2pproxy_resourcemgt_revoke_media_resource(char* resource_uri);
|
||||
int p2pproxy_resourcemgt_revoke_media_resource(const char* resource_uri);
|
||||
|
||||
#endif /*SWIG*/
|
||||
|
||||
|
|
|
|||
19
p2pproxy/plugin-src/Makefile.am
Normal file
19
p2pproxy/plugin-src/Makefile.am
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#plugin to enable fonis into linphone
|
||||
|
||||
JAVA_LDFLAGS=\
|
||||
-Wl,-rpath,$(javadir)/jre/lib/amd64 -Wl,-rpath,$(javadir)/jre/lib/i386 \
|
||||
-Wl,-rpath,$(javadir)/jre/lib/amd64/server -Wl,-rpath,$(javadir)/jre/lib/i386/server
|
||||
|
||||
pluginsdir=$(LINPHONE_PLUGINS_DIR)
|
||||
|
||||
plugins_LTLIBRARIES=libfonisprovider.la
|
||||
|
||||
libfonisprovider_la_SOURCES=fonis.c
|
||||
|
||||
libfonisprovider_la_LIBADD=$(top_builddir)/launcher/src/libfonisc.la
|
||||
|
||||
libfonisprovider_la_LDFLAGS=$(JAVA_LDFLAGS)
|
||||
|
||||
AM_CFLAGS= $(LIBLINPHONE_CFLAGS)
|
||||
|
||||
INCLUDES=-I$(top_srcdir)/launcher/src
|
||||
110
p2pproxy/plugin-src/fonis.c
Normal file
110
p2pproxy/plugin-src/fonis.c
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
linphone
|
||||
Copyright (C) 2000 Simon MORLAT (simon.morlat@linphone.org)
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "sipsetup.h"
|
||||
#include "p2pproxy.h"
|
||||
|
||||
typedef struct _FonisContext{
|
||||
int toto;
|
||||
}FonisContext;
|
||||
|
||||
static ms_thread_t fonis_thread;
|
||||
|
||||
|
||||
static void *fonis_thread_func(void *arg){
|
||||
if (p2pproxy_application_start(0,NULL)!=0){
|
||||
ms_error("Fail to start fonis thread !");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool_t fonis_init(void){
|
||||
static bool_t initd=FALSE;
|
||||
if (!initd){
|
||||
ms_thread_create(&fonis_thread,NULL,fonis_thread_func,NULL);
|
||||
initd=TRUE;
|
||||
}
|
||||
sleep(4);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static int fonis_create_account(const char *uri, const char *passwd){
|
||||
int err=p2pproxy_accountmgt_createAccount(uri);
|
||||
if (err<0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fonis_login_account(SipSetupContext * ctx,const char *uri, const char *passwd){
|
||||
if (p2pproxy_accountmgt_isValidAccount(uri)==P2PPROXY_ACCOUNTMGT_USER_EXIST) {
|
||||
return 0;
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
|
||||
static int fonis_get_proxy(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz){
|
||||
int err=p2pproxy_resourcemgt_lookup_sip_proxy(proxy,sz,(char*)domain);
|
||||
if (err==0) return 0;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
static int fonis_get_stun_servers(SipSetupContext *ctx, char *stun1, char *stun2, size_t size){
|
||||
FonisContext *fc=(FonisContext*)ctx->data;
|
||||
int ret=-1;
|
||||
p2pproxy_resourcemgt_resource_list_t* l=p2pproxy_resourcemgt_new_resource_list();
|
||||
if (p2pproxy_resourcemgt_lookup_media_resource(l,ctx->domain)==0){
|
||||
if (l->size>0) strncpy(stun1,l->resource_uri[0],size);
|
||||
if (l->size>1) strncpy(stun2,l->resource_uri[1],size);
|
||||
ret=0;
|
||||
}
|
||||
p2pproxy_resourcemgt_delete_resource_list(l);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int fonis_get_relay(SipSetupContext *ctx, char *relay, size_t size){
|
||||
FonisContext *fc=(FonisContext*)ctx->data;
|
||||
int ret=-1;
|
||||
p2pproxy_resourcemgt_resource_list_t* l=p2pproxy_resourcemgt_new_resource_list();
|
||||
if (p2pproxy_resourcemgt_lookup_media_resource(l,ctx->domain)==0){
|
||||
if (l->size>0) strncpy(relay,l->resource_uri[0],size);
|
||||
ret=0;
|
||||
}
|
||||
p2pproxy_resourcemgt_delete_resource_list(l);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static SipSetup fonis_sip_setup={
|
||||
.capabilities=SIP_SETUP_CAP_PROXY_PROVIDER|SIP_SETUP_CAP_STUN_PROVIDER|
|
||||
SIP_SETUP_CAP_RELAY_PROVIDER|SIP_SETUP_CAP_ACCOUNT_MANAGER,
|
||||
.name="fonis",
|
||||
.init=fonis_init,
|
||||
.create_account=fonis_create_account,
|
||||
.login_account=fonis_login_account,
|
||||
.get_proxy=fonis_get_proxy,
|
||||
.get_stun_servers=fonis_get_stun_servers,
|
||||
.get_relay=fonis_get_relay,
|
||||
.exit=p2pproxy_application_stop
|
||||
};
|
||||
|
||||
void libfonisprovider_init(void){
|
||||
sip_setup_register(&fonis_sip_setup);
|
||||
}
|
||||
|
||||
Loading…
Add table
Reference in a new issue