mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-21 13:08:08 +00:00
git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@51 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
parent
d992de8dad
commit
f814928fca
10 changed files with 195 additions and 47 deletions
|
|
@ -49,7 +49,7 @@
|
|||
<option id="gnu.c.compiler.option.warnings.toerrors.168149749" name="Warnings as errors (-Werror)" superClass="gnu.c.compiler.option.warnings.toerrors"/>
|
||||
<option id="gnu.c.compiler.option.misc.other.465456911" name="Other flags" superClass="gnu.c.compiler.option.misc.other"/>
|
||||
<option id="gnu.c.compiler.option.misc.verbose.1739414683" name="Verbose (-v)" superClass="gnu.c.compiler.option.misc.verbose"/>
|
||||
<option id="gnu.c.compiler.option.misc.ansi.2034289138" name="Support ANSI programs (-ansi)" superClass="gnu.c.compiler.option.misc.ansi"/>
|
||||
<option id="gnu.c.compiler.option.misc.ansi.2034289138" name="Support ANSI programs (-ansi)" superClass="gnu.c.compiler.option.misc.ansi" value="true" valueType="boolean"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1981684865" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1568763747" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug">
|
||||
|
|
@ -107,7 +107,7 @@
|
|||
<option id="gnu.c.compiler.option.warnings.toerrors.2063337025" name="Warnings as errors (-Werror)" superClass="gnu.c.compiler.option.warnings.toerrors"/>
|
||||
<option id="gnu.c.compiler.option.misc.other.676396200" name="Other flags" superClass="gnu.c.compiler.option.misc.other"/>
|
||||
<option id="gnu.c.compiler.option.misc.verbose.1885722707" name="Verbose (-v)" superClass="gnu.c.compiler.option.misc.verbose"/>
|
||||
<option id="gnu.c.compiler.option.misc.ansi.134114436" name="Support ANSI programs (-ansi)" superClass="gnu.c.compiler.option.misc.ansi"/>
|
||||
<option id="gnu.c.compiler.option.misc.ansi.134114436" name="Support ANSI programs (-ansi)" superClass="gnu.c.compiler.option.misc.ansi" value="true" valueType="boolean"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.479507797" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
|
|
@ -120,6 +120,7 @@
|
|||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
|
|
@ -504,6 +505,7 @@
|
|||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
|
|
|
|||
3
p2pproxy/launcher/.settings/org.eclipse.cdt.core.prefs
Normal file
3
p2pproxy/launcher/.settings/org.eclipse.cdt.core.prefs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#Wed Sep 24 10:53:31 CEST 2008
|
||||
eclipse.preferences.version=1
|
||||
environment/project/cdt.managedbuild.config.gnu.exe.debug.312796505=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment append\="true" appendContributed\="true"/>\n
|
||||
44
p2pproxy/launcher/Debug/makefile
Normal file
44
p2pproxy/launcher/Debug/makefile
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
-include ../makefile.init
|
||||
|
||||
RM := rm -rf
|
||||
|
||||
# All of the sources participating in the build are defined here
|
||||
-include sources.mk
|
||||
-include subdir.mk
|
||||
-include src/subdir.mk
|
||||
-include objects.mk
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
ifneq ($(strip $(C_DEPS)),)
|
||||
-include $(C_DEPS)
|
||||
endif
|
||||
endif
|
||||
|
||||
-include ../makefile.defs
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
|
||||
# All Target
|
||||
all: p2pproxy-launcher
|
||||
|
||||
# Tool invocations
|
||||
p2pproxy-launcher: $(OBJS) $(USER_OBJS)
|
||||
@echo 'Building target: $@'
|
||||
@echo 'Invoking: GCC C Linker'
|
||||
gcc -L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64 -L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server -o"p2pproxy-launcher" $(OBJS) $(USER_OBJS) $(LIBS)
|
||||
@echo 'Finished building target: $@'
|
||||
@echo ' '
|
||||
|
||||
# Other Targets
|
||||
clean:
|
||||
-$(RM) $(OBJS)$(EXECUTABLES)$(C_DEPS) p2pproxy-launcher
|
||||
-@echo ' '
|
||||
|
||||
.PHONY: all clean dependents
|
||||
.SECONDARY:
|
||||
|
||||
-include ../makefile.targets
|
||||
7
p2pproxy/launcher/Debug/objects.mk
Normal file
7
p2pproxy/launcher/Debug/objects.mk
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
LIBS := -ljvm
|
||||
|
||||
USER_OBJS :=
|
||||
17
p2pproxy/launcher/Debug/sources.mk
Normal file
17
p2pproxy/launcher/Debug/sources.mk
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
C_SRCS :=
|
||||
O_SRCS :=
|
||||
ASM_SRCS :=
|
||||
S_SRCS :=
|
||||
OBJ_SRCS :=
|
||||
OBJS :=
|
||||
EXECUTABLES :=
|
||||
C_DEPS :=
|
||||
|
||||
# Every subdirectory with source files must be described here
|
||||
SUBDIRS := \
|
||||
src \
|
||||
|
||||
4
p2pproxy/launcher/Debug/src/launcher-tester.d
Normal file
4
p2pproxy/launcher/Debug/src/launcher-tester.d
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
src/launcher-tester.d src/launcher-tester.o: ../src/launcher-tester.c \
|
||||
../src/p2pproxy.h
|
||||
|
||||
../src/p2pproxy.h:
|
||||
9
p2pproxy/launcher/Debug/src/p2pproxy.d
Normal file
9
p2pproxy/launcher/Debug/src/p2pproxy.d
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
src/p2pproxy.d src/p2pproxy.o: ../src/p2pproxy.c \
|
||||
/usr/lib/jvm/java-6-openjdk/include/jni.h \
|
||||
/usr/lib/jvm/java-6-openjdk/include/jni_md.h ../src/p2pproxy.h
|
||||
|
||||
/usr/lib/jvm/java-6-openjdk/include/jni.h:
|
||||
|
||||
/usr/lib/jvm/java-6-openjdk/include/jni_md.h:
|
||||
|
||||
../src/p2pproxy.h:
|
||||
34
p2pproxy/launcher/Debug/src/subdir.mk
Normal file
34
p2pproxy/launcher/Debug/src/subdir.mk
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../src/launcher-tester.c \
|
||||
../src/p2pproxy.c
|
||||
|
||||
OBJS += \
|
||||
./src/launcher-tester.o \
|
||||
./src/p2pproxy.o
|
||||
|
||||
C_DEPS += \
|
||||
./src/launcher-tester.d \
|
||||
./src/p2pproxy.d
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
src/%.o: ../src/%.c
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: GCC C Compiler'
|
||||
gcc -I/usr/lib/jvm/java-6-openjdk/include -O0 -g3 -Wall -c -fmessage-length=0 -ansi -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
src/p2pproxy.o: ../src/p2pproxy.c
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: GCC C Compiler'
|
||||
gcc -I/usr/lib/jvm/java-6-openjdk/include -O2 -g -Wall -c -fmessage-length=0 -ansi -MMD -MP -MF"$(@:%.o=%.d)" -MT"src/p2pproxy.d" -o"$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
||||
|
|
@ -9,37 +9,44 @@
|
|||
#define P2PPROXY_INSTALLDIR "/usr/local/share/java"
|
||||
#endif
|
||||
#ifndef P2PPROXY_BUILDDIR
|
||||
#define P2PPROXY_BUILDDIR "./antbuild/dist/p2pproxy_0.1"
|
||||
#define P2PPROXY_BUILDDIR ".././antbuild/dist/p2pproxy_0.1"
|
||||
#endif
|
||||
JNIEnv* p2pproxy_application_jnienv = 0;
|
||||
JavaVM* p2pproxy_application_jvm = 0;
|
||||
|
||||
int p2pproxy_application_start(int argc, char **argv) {
|
||||
|
||||
|
||||
JavaVMInitArgs args;
|
||||
JavaVMOption options[0];
|
||||
JavaVMOption options[8];
|
||||
jint res=-1;
|
||||
|
||||
jclass lP2pProxyMainClass;
|
||||
jmethodID mainMethod;
|
||||
jobjectArray applicationArgsList;
|
||||
jstring applicationArg;
|
||||
int i=0;
|
||||
|
||||
if (p2pproxy_application_jnienv != 0) {
|
||||
fprintf(stderr,"p2pproxy already started");
|
||||
return P2PPROXY_ERROR_APPLICATION_ALREADY_STARTED;
|
||||
}
|
||||
args.version = JNI_VERSION_1_4;
|
||||
args.nOptions = sizeof (options);
|
||||
/*options[0].optionString = "-verbose:jni";*/
|
||||
/*options[1].optionString = "-Djava.class.path="P2PPROXY_BUILDDIR"/p2pproxy.jar:"\
|
||||
P2PPROXY_INSTALLDIR"/p2pproxy.jar:"\
|
||||
P2PPROXY_BUILDDIR"/log4j.jar:"\
|
||||
P2PPROXY_INSTALLDIR"/log4j.jar";
|
||||
|
||||
args.nOptions = 8;
|
||||
options[0].optionString = "-verbose:jni";
|
||||
options[1].optionString = "-Djava.class.path="P2PPROXY_BUILDDIR"/p2pproxy.jar:"\
|
||||
P2PPROXY_INSTALLDIR"/p2pproxy.jar:"\
|
||||
P2PPROXY_BUILDDIR"/log4j.jar:"\
|
||||
P2PPROXY_INSTALLDIR"/log4j.jar";
|
||||
|
||||
|
||||
|
||||
options[2].optionString = "-Dcom.sun.management.jmxremote";
|
||||
options[3].optionString = "-Dcom.sun.management.jmxremote.port="P2PPROXY_JMX_PORT;
|
||||
options[4].optionString = "-Dcom.sun.management.jmxremote.authenticate=false";
|
||||
options[5].optionString = "-Dcom.sun.management.jmxremote.ssl=false";
|
||||
options[6].optionString = "-Dorg.linphone.p2pproxy.install.dir="P2PPROXY_INSTALLDIR;
|
||||
options[7].optionString = "-Dorg.linphone.p2pproxy.build.dir="P2PPROXY_BUILDDIR;
|
||||
|
||||
|
||||
/*
|
||||
options[1].optionString = "-Dcom.sun.management.jmxremote";
|
||||
options[2].optionString = "-Dcom.sun.management.jmxremote.port="P2PPROXY_JMX_PORT;
|
||||
options[3].optionString = "-Dcom.sun.management.jmxremote.authenticate=false";
|
||||
options[4].optionString = "-Dcom.sun.management.jmxremote.ssl=false";
|
||||
*/
|
||||
|
||||
args.options = options;
|
||||
args.ignoreUnrecognized = JNI_FALSE;
|
||||
|
||||
|
|
@ -48,6 +55,26 @@ int p2pproxy_application_start(int argc, char **argv) {
|
|||
fprintf(stderr,"cannot start p2pproxy vm [%i]",res);
|
||||
return P2PPROXY_ERROR;
|
||||
}
|
||||
|
||||
lP2pProxyMainClass = (*p2pproxy_application_jnienv)->FindClass(p2pproxy_application_jnienv, "org/linphone/p2pproxy/core/P2pProxyMain");
|
||||
|
||||
if (lP2pProxyMainClass == 0) {
|
||||
fprintf(stderr,"cannot find class org/linphone/p2pproxy/core/P2pProxyMain");
|
||||
return P2PPROXY_ERROR;
|
||||
}
|
||||
mainMethod = (*p2pproxy_application_jnienv)->GetStaticMethodID(p2pproxy_application_jnienv, lP2pProxyMainClass, "main", "([Ljava/lang/String;)V");
|
||||
|
||||
applicationArgsList = (*p2pproxy_application_jnienv)->NewObjectArray(p2pproxy_application_jnienv, argc, (*p2pproxy_application_jnienv)->FindClass(p2pproxy_application_jnienv, "java/lang/String"), NULL);
|
||||
|
||||
for (i=0;i<argc;i++) {
|
||||
applicationArg = (*p2pproxy_application_jnienv)->NewStringUTF(p2pproxy_application_jnienv, *argv++);
|
||||
(*p2pproxy_application_jnienv)->SetObjectArrayElement(p2pproxy_application_jnienv, applicationArgsList, 0, applicationArg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
(*p2pproxy_application_jnienv)->CallStaticVoidMethod(p2pproxy_application_jnienv, lP2pProxyMainClass, mainMethod, applicationArgsList);
|
||||
|
||||
return P2PPROXY_NO_ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -76,20 +103,7 @@ JNIEnv* create_vm() {
|
|||
}
|
||||
|
||||
void invoke_class(JNIEnv* env) {
|
||||
jclass helloWorldClass;
|
||||
jmethodID mainMethod;
|
||||
jobjectArray applicationArgs;
|
||||
jstring applicationArg0;
|
||||
|
||||
helloWorldClass = (*env)->FindClass(env, "example/jni/InvocationHelloWorld");
|
||||
|
||||
mainMethod = (*env)->GetStaticMethodID(env, helloWorldClass, "main", "([Ljava/lang/String;)V");
|
||||
|
||||
applicationArgs = (*env)->NewObjectArray(env, 1, (*env)->FindClass(env, "java/lang/String"), NULL);
|
||||
applicationArg0 = (*env)->NewStringUTF(env, "From-C-program");
|
||||
(*env)->SetObjectArrayElement(env, applicationArgs, 0, applicationArg0);
|
||||
|
||||
(*env)->CallStaticVoidMethod(env, helloWorldClass, mainMethod, applicationArgs);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ public class P2pProxyMain implements P2pProxyMainMBean {
|
|||
public final static String MAIN_MBEAN_NAME="org.linphone.p2proxy:type=main";
|
||||
private static P2pProxyMain mP2pProxyMain = new P2pProxyMain();
|
||||
private static Configurator mConfigurator;
|
||||
private static String mConfigHomeDir;
|
||||
|
||||
static {
|
||||
// System.setProperty("com.sun.management.jmxremote", "true");
|
||||
// System.setProperty("com.sun.management.jmxremote.port", "6789");
|
||||
|
|
@ -72,7 +74,7 @@ public class P2pProxyMain implements P2pProxyMainMBean {
|
|||
*/
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
String lconfigHomeDir=System.getProperty("user.home")+"/.p2pproxy";
|
||||
mConfigHomeDir=System.getProperty("user.home")+"/.p2pproxy";
|
||||
int lsipPort=5040;
|
||||
JxtaNetworkManager.Mode lMode = JxtaNetworkManager.Mode.auto;
|
||||
boolean lEnableHttp = false;
|
||||
|
|
@ -82,14 +84,14 @@ public class P2pProxyMain implements P2pProxyMainMBean {
|
|||
for (int i=0; i < args.length; i=i+2) {
|
||||
String argument = args[i];
|
||||
if (argument.equals("-jxta")) {
|
||||
lconfigHomeDir = args[i + 1];
|
||||
File lFile = new File(lconfigHomeDir);
|
||||
mConfigHomeDir = args[i + 1];
|
||||
File lFile = new File(mConfigHomeDir);
|
||||
if (lFile.exists() == false) lFile.mkdir();
|
||||
|
||||
System.out.println("lconfigHomeDir detected[" + lconfigHomeDir + "]");
|
||||
System.out.println("mConfigHomeDir detected[" + mConfigHomeDir + "]");
|
||||
}
|
||||
}
|
||||
System.setProperty("org.linphone.p2pproxy.home", lconfigHomeDir);
|
||||
System.setProperty("org.linphone.p2pproxy.home", mConfigHomeDir);
|
||||
|
||||
|
||||
System.setProperty("net.jxta.logging.Logging", "FINEST");
|
||||
|
|
@ -101,7 +103,7 @@ public class P2pProxyMain implements P2pProxyMainMBean {
|
|||
|
||||
mLog.info("p2pproxy initilizing...");
|
||||
|
||||
File lPropertyFile = new File(lconfigHomeDir+"/p2pproxy.properties.xml");
|
||||
File lPropertyFile = new File(mConfigHomeDir+"/p2pproxy.properties.xml");
|
||||
mConfigurator = new Configurator(lPropertyFile);
|
||||
try {
|
||||
ObjectName lObjectName = new ObjectName(MAIN_MBEAN_NAME);
|
||||
|
|
@ -121,7 +123,7 @@ public class P2pProxyMain implements P2pProxyMainMBean {
|
|||
for (int i=0; i < args.length; i=i+2) {
|
||||
String argument = args[i];
|
||||
if (argument.equals("-jxta")) {
|
||||
lconfigHomeDir = args[i + 1];
|
||||
mConfigHomeDir = args[i + 1];
|
||||
//nop
|
||||
} else if (argument.equals("-sip")) {
|
||||
lsipPort = Integer.parseInt(args[i + 1]);
|
||||
|
|
@ -219,7 +221,7 @@ public class P2pProxyMain implements P2pProxyMainMBean {
|
|||
|
||||
//check from env
|
||||
|
||||
File lJxtaDirectory = new File (lconfigHomeDir);
|
||||
File lJxtaDirectory = new File (mConfigHomeDir);
|
||||
if (lJxtaDirectory.exists() == false) lJxtaDirectory.mkdir();
|
||||
|
||||
|
||||
|
|
@ -256,7 +258,7 @@ public class P2pProxyMain implements P2pProxyMainMBean {
|
|||
//setup account manager
|
||||
mP2pProxyAccountManagement = new P2pProxyAccountManagement(mJxtaNetworkManager);
|
||||
// setup sip provider
|
||||
SipStack.log_path = lconfigHomeDir+"/logs";
|
||||
SipStack.log_path = mConfigHomeDir+"/logs";
|
||||
mSipAndPipeListener = new SipProxyRegistrar(mConfigurator,mJxtaNetworkManager,mP2pProxyAccountManagement,mP2pProxyManagement);
|
||||
//set management
|
||||
try {
|
||||
|
|
@ -339,13 +341,25 @@ public void loadTraceConfigFile() throws P2pProxyException {
|
|||
}
|
||||
public static void staticLoadTraceConfigFile() throws P2pProxyException {
|
||||
try {
|
||||
PropertyConfigurator.configureAndWatch("log4j.properties");
|
||||
String lSearchDir;
|
||||
//search build dir
|
||||
lSearchDir = System.getProperty("org.linphone.p2pproxy.build.dir");
|
||||
File lFile = new File(lSearchDir+"/log4j.properties");
|
||||
if (lFile.exists() == false) {
|
||||
lSearchDir = mConfigHomeDir;
|
||||
lFile = new File(lSearchDir+"/log4j.properties");
|
||||
if (lFile.exists() == false) {
|
||||
lSearchDir=".";
|
||||
}
|
||||
}
|
||||
String lLog4jFile= lSearchDir+"/log4j.properties";
|
||||
PropertyConfigurator.configureAndWatch(lLog4jFile);
|
||||
// read java.util.logging properties
|
||||
Properties lLogginProperties = new Properties();
|
||||
lLogginProperties.load(new FileInputStream("log4j.properties"));
|
||||
lLogginProperties.load(new FileInputStream(lLog4jFile));
|
||||
lLogginProperties.setProperty("java.util.logging.FileHandler.pattern",System.getProperty("org.linphone.p2pproxy.home")+"/logs/p2pproxy.log");
|
||||
lLogginProperties.store(new FileOutputStream("log4j.properties.tmp"), "tmp");
|
||||
System.setProperty("java.util.logging.config.file","log4j.properties.tmp");
|
||||
lLogginProperties.store(new FileOutputStream(lLog4jFile+".tmp"), "tmp");
|
||||
System.setProperty("java.util.logging.config.file",lLog4jFile+".tmp");
|
||||
java.util.logging.LogManager.getLogManager().readConfiguration();
|
||||
} catch (Exception e) {
|
||||
throw new P2pProxyException("enable to load traces",e);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue