Changeset 81:eb9fad69e486 in mediastreamer2
- Timestamp:
- Oct 13, 2008 5:20:18 PM (5 years ago)
- Branch:
- default
- Location:
- p2pproxy
- Files:
-
- 2 added
- 2 deleted
- 9 edited
-
launcher/.cproject (modified) (2 diffs)
-
launcher/Debug/makefile (modified) (1 diff)
-
launcher/src/launcher-tester.c (modified) (1 diff)
-
launcher/src/p2pproxy.c (modified) (3 diffs)
-
launcher/src/p2pproxy.h (modified) (3 diffs)
-
src/org/linphone/p2pproxy/api/P2pProxySipProxyRegistrarManagement.java (modified) (1 diff)
-
src/org/linphone/p2pproxy/core/JxtaNetworkManager.java (modified) (1 diff)
-
src/org/linphone/p2pproxy/core/P2pProxyMain.java (modified) (3 diffs)
-
src/org/linphone/p2pproxy/core/P2pProxySipProxyRegistrarManagementImpl.java (modified) (2 diffs)
-
src/org/linphone/p2pproxy/core/stun/StunServer.java (added)
-
src/org/linphone/p2pproxy/core/turnserver/TurnServer.java (deleted)
-
test-src/org/linphone/p2pproxy/test/StunServerTester.java (added)
-
test-src/org/linphone/p2pproxy/test/TurnServerTester.java (deleted)
Legend:
- Unmodified
- Added
- Removed
-
p2pproxy/launcher/.cproject
r48 r81 122 122 <storageModule moduleId="org.eclipse.cdt.core.language.mapping"/> 123 123 124 124 125 <storageModule moduleId="scannerConfiguration"> 125 126 <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> … … 507 508 <storageModule moduleId="org.eclipse.cdt.core.language.mapping"/> 508 509 510 509 511 <storageModule moduleId="scannerConfiguration"> 510 512 <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> -
p2pproxy/launcher/Debug/makefile
r77 r81 30 30 @echo 'Building target: $@' 31 31 @echo 'Invoking: GCC C Linker' 32 gcc -L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64 -L/usr/lib/jvm/java-6-openjdk/jre/lib/ i386 -L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server -L/usr/lib/jvm/java-6-openjdk/jre/lib/i386/server -o"p2pproxy-launcher" $(OBJS) $(USER_OBJS) $(LIBS)32 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) 33 33 @echo 'Finished building target: $@' 34 34 @echo ' ' -
p2pproxy/launcher/src/launcher-tester.c
r77 r81 33 33 34 34 char string_buffer[256]; 35 if (p2pproxy_resource location_get_sip_proxyregistrar_uri(string_buffer,256) != P2PPROXY_NO_ERROR) {35 if (p2pproxy_resourcemgt_lookup_sip_proxy(string_buffer,256,"p2p.linphone.org") != P2PPROXY_NO_ERROR) { 36 36 printf("cannot get proxy\n"); 37 37 } else { 38 38 printf("registrar is [%s]\n",string_buffer); 39 39 } 40 41 if (p2pproxy_resourcemgt_revoke_sip_proxy(string_buffer) != P2PPROXY_NO_ERROR) { 42 printf("cannot fulsh proxy [%s]\n",string_buffer); 43 } 44 45 if (p2pproxy_resourcemgt_lookup_sip_proxy(string_buffer,256,"toto.linphone.org") != P2PPROXY_RESOURCEMGT_SERVER_NOT_FOUND) { 46 printf("unexpected proxy [%s]\n",string_buffer); 47 } else { 48 printf("unknown domaine\n"); 49 } 50 40 51 if (p2pproxy_accountmgt_deleteAccount("sip:titi@p2p.linphone.org") != P2PPROXY_NO_ERROR) { 41 52 printf("cannot delete account \n"); 42 53 } 54 43 55 44 56 p2pproxy_application_stop(); -
p2pproxy/launcher/src/p2pproxy.c
r77 r81 1 1 #include <stdio.h> 2 2 #include <jni.h> 3 #include <string.h> 3 4 #include "p2pproxy.h" 4 5 … … 139 140 } 140 141 141 int p2pproxy_resource location_get_sip_proxyregistrar_uri(char* aStringArray, size_t aSize) {142 jmethodID getSipProxyRegistrarUriMethod;142 int p2pproxy_resourcemgt_lookup_sip_proxy(char* proxy_uri,size_t size, char* domaine) { 143 jmethodID lLookupSipProxyUriMethod; 143 144 jstring lJStringResult; 144 145 const jbyte* lString; 145 146 jboolean lIsCopy; 146 GET_JNI_ENV 147 148 getSipProxyRegistrarUriMethod = (*lJniEnv)->GetStaticMethodID(lJniEnv, lMainClass, "getSipProxyRegistrarUri", "()Ljava/lang/String;"); 149 lJStringResult = (*lJniEnv)->CallStaticObjectMethod(lJniEnv, lMainClass, getSipProxyRegistrarUriMethod); 147 jstring applicationArg; 148 149 GET_JNI_ENV 150 151 152 applicationArg = (*lJniEnv)->NewStringUTF(lJniEnv, domaine); 153 lLookupSipProxyUriMethod = (*lJniEnv)->GetStaticMethodID(lJniEnv, lMainClass, "lookupSipProxyUri", "(Ljava/lang/String;)Ljava/lang/String;"); 154 lJStringResult = (*lJniEnv)->CallStaticObjectMethod(lJniEnv, lMainClass, lLookupSipProxyUriMethod, applicationArg); 150 155 if (lJStringResult == 0) { 151 return P2PPROXY_ ERROR_RESOURCELOCATOR_SERVER_NOT_FOUND;156 return P2PPROXY_RESOURCEMGT_SERVER_NOT_FOUND; 152 157 } 153 158 lString = (*lJniEnv)->GetStringUTFChars(lJniEnv, lJStringResult, &lIsCopy); 154 memcpy( aStringArray,lString,aSize);159 memcpy(proxy_uri,lString,size); 155 160 (*lJniEnv)->ReleaseStringUTFChars(lJniEnv, lJStringResult, lString); 156 161 (*p2pproxy_application_jvm)->DetachCurrentThread(p2pproxy_application_jvm); … … 158 163 } 159 164 165 int p2pproxy_resourcemgt_revoke_sip_proxy(char* proxy_uri) { 166 jmethodID revokeProxyMethod; 167 jstring lJStringResult; 168 const jbyte* lString; 169 jboolean lIsCopy; 170 GET_JNI_ENV 171 172 revokeProxyMethod = (*lJniEnv)->GetStaticMethodID(lJniEnv, lMainClass, "revokeSipProxy", "(Ljava/lang/String;)V"); 173 (*lJniEnv)->CallStaticVoidMethod(lJniEnv, lMainClass, revokeProxyMethod); 174 if (lJStringResult == 0) { 175 return P2PPROXY_ERROR; 176 } 177 return P2PPROXY_NO_ERROR; 178 } 160 179 int p2pproxy_application_get_state() { 161 180 jmethodID stateMethod; -
p2pproxy/launcher/src/p2pproxy.h
r74 r81 30 30 #define P2PPROXY_ACCOUNTMGT_USER_EXIST 1 31 31 #define P2PPROXY_ACCOUNTMGT_USER_NOT_EXIST 0 32 32 #define P2PPROXY_RESOURCEMGT_SERVER_NOT_FOUND 3 33 33 /* state code*/ 34 34 #define P2PPROXY_CONNECTED 2 … … 42 42 #define P2PPROXY_ERROR_ACCOUNTMGT_USER_ALREADY_EXIST -4 43 43 #define P2PPROXY_ERROR_ACCOUNTMGT_BAD_SIP_URI -5 44 #define P2PPROXY_ERROR_RESOURCE LOCATOR_SERVER_NOT_FOUND -644 #define P2PPROXY_ERROR_RESOURCEMGT_SERVER_NOT_FOUND -6 45 45 46 46 #ifndef SWIG … … 98 98 int p2pproxy_accountmgt_deleteAccount(const char* user_name); 99 99 100 /*************************** /101 /***resource location******/102 /*************************** /100 /****************************/ 101 /***resource management******/ 102 /****************************/ 103 103 /** 104 * access a proxy registrar sip addreess 105 * @param buffer allocated by the user 106 * @param size buffer size 104 * access a proxy registrar sip addreess for a given domaine name 105 * @param [out] proxy_uri buffer allocated by the user 106 * @param [in] size buffer size 107 * @param [in] domaine name 107 108 * @return status code P2PPROXY_NO_ERROR, P2PPROXY_ERROR_RESOURCELOCATOR_SERVER_NOT_FOUND 108 109 */ 109 int p2pproxy_resourcelocation_get_sip_proxyregistrar_uri(char* string_buffer,size_t size) ; 110 int p2pproxy_resourcemgt_lookup_sip_proxy(char* proxy_uri,size_t size, char* domaine) ; 111 /* 112 * notify the library at a given proxy is no longuer reachable 113 * @param [in] proxy sip uri 114 * @return status code P2PPROXY_NO_ERROR 115 */ 116 int p2pproxy_resourcemgt_revoke_sip_proxy(char* proxy_uri); 117 110 118 111 119 #endif /*SWIG*/ -
p2pproxy/src/org/linphone/p2pproxy/api/P2pProxySipProxyRegistrarManagement.java
r70 r81 20 20 package org.linphone.p2pproxy.api; 21 21 22 import java.net.InetSocketAddress; 22 23 23 24 24 public interface P2pProxySipProxyRegistrarManagement { 25 25 /** 26 26 * 27 * @return the SIP uri of an available sip proxy registrar 27 * @return the SIP uri of an available sip proxy registrar for a given domaine 28 28 */ 29 public String getSipProxyRegistrarUri() throws P2pProxyException ; 29 public String lookupSipProxyUri(String aDomaine) throws P2pProxyException ; 30 31 public void revokeSipProxy(String aProxy) throws P2pProxyException; 32 30 33 } -
p2pproxy/src/org/linphone/p2pproxy/core/JxtaNetworkManager.java
r70 r81 137 137 lNetworkConfigurator.load(); 138 138 } 139 139 //mode is alway taken from start line 140 lNetworkConfigurator.setMode(lMode); 140 141 // set sedding host 141 142 if (aProperties.getProperty(SEEDING_RDV) != null) { -
p2pproxy/src/org/linphone/p2pproxy/core/P2pProxyMain.java
r79 r81 387 387 if ((mJxtaNetworkManager!=null && mJxtaNetworkManager.isConnectedToRendezVous(0) == true) 388 388 || 389 (mJxtaNetworkManager!=null && mJxtaNetworkManager.getPeerGroup().getRendezVousService().isRendezVous())) 390 { 389 (mJxtaNetworkManager!=null && mJxtaNetworkManager.getPeerGroup().getRendezVousService().isRendezVous())) { 391 390 //nop connected 392 391 } else { 393 throw new P2pProxyNotReadyException("not connected to any rdv ");392 throw new P2pProxyNotReadyException("not connected to any rdv: status ["+mJxtaNetworkManager.getPeerGroup().getRendezVousService().getRendezVousStatus()+"]"); 394 393 } 395 394 } catch (InterruptedException e) { … … 432 431 } 433 432 } 434 public static String getSipProxyRegistrarUri() {435 try { 436 isReady(); 437 return mP2pProxySipProxyRegistrarManagement. getSipProxyRegistrarUri();433 public static String lookupSipProxyUri(String aDomaine) { 434 try { 435 isReady(); 436 return mP2pProxySipProxyRegistrarManagement.lookupSipProxyUri(aDomaine); 438 437 } catch (Exception e) { 439 438 return null; … … 445 444 return P2pProxylauncherConstants.P2PPROXY_CONNECTED; 446 445 } catch (P2pProxyException e) { 446 mLog.error("cannot get state",e); 447 447 return P2pProxylauncherConstants.P2PPROXY_NOT_CONNECTED; 448 448 } 449 449 } 450 public static int revokeSipProxy(String aProxy) { 451 try { 452 isReady(); 453 mLog.error("not implemented"); 454 return P2pProxylauncherConstants.P2PPROXY_ERROR; 455 } catch (P2pProxyException e) { 456 return P2pProxylauncherConstants.P2PPROXY_NOT_CONNECTED; 457 } 458 } 459 450 460 public static void stop() { 451 461 mExit = true; -
p2pproxy/src/org/linphone/p2pproxy/core/P2pProxySipProxyRegistrarManagementImpl.java
r79 r81 1 1 package org.linphone.p2pproxy.core; 2 2 3 import org.apache.log4j.Logger; 3 4 import org.linphone.p2pproxy.api.P2pProxyException; 4 5 import org.linphone.p2pproxy.api.P2pProxySipProxyRegistrarManagement; … … 6 7 7 8 public class P2pProxySipProxyRegistrarManagementImpl implements P2pProxySipProxyRegistrarManagement { 8 protected final JxtaNetworkManager mJxtaNetworkManager; 9 P2pProxySipProxyRegistrarManagementImpl(JxtaNetworkManager aJxtaNetworkManager) { 10 mJxtaNetworkManager = aJxtaNetworkManager; 11 } 12 public String getSipProxyRegistrarUri() throws P2pProxyException { 13 try { 14 SipProxyRegistrarAdvertisement lSipProxyRegistrarAdvertisement = (SipProxyRegistrarAdvertisement) (mJxtaNetworkManager.getAdvertisement(null, SipProxyRegistrarAdvertisement.NAME, true)); 15 return lSipProxyRegistrarAdvertisement.getAddress(); 16 }catch (Exception e) { 17 throw new P2pProxyException(e); 18 } 9 protected final JxtaNetworkManager mJxtaNetworkManager; 10 private final String DOMAINE="p2p.linphone.org"; 11 private final static Logger mLog = Logger.getLogger(P2pProxySipProxyRegistrarManagementImpl.class); 12 P2pProxySipProxyRegistrarManagementImpl(JxtaNetworkManager aJxtaNetworkManager) { 13 mJxtaNetworkManager = aJxtaNetworkManager; 14 } 15 public String lookupSipProxyUri(String aDomaine) throws P2pProxyException { 16 try { 17 if (!DOMAINE.equals(aDomaine)) { 18 //unknown domaine 19 return null; 20 } 21 SipProxyRegistrarAdvertisement lSipProxyRegistrarAdvertisement = (SipProxyRegistrarAdvertisement) (mJxtaNetworkManager.getAdvertisement(null, SipProxyRegistrarAdvertisement.NAME, true)); 22 return lSipProxyRegistrarAdvertisement.getAddress(); 23 }catch (Exception e) { 24 throw new P2pProxyException(e); 25 } 19 26 20 } 27 } 28 public void revokeSipProxy(String aProxy) throws P2pProxyException { 29 try { 30 SipProxyRegistrarAdvertisement lSipProxyRegistrarAdvertisement = (SipProxyRegistrarAdvertisement) (mJxtaNetworkManager.getAdvertisement(null, SipProxyRegistrarAdvertisement.ADDRESS_TAG, true)); 31 mJxtaNetworkManager.getPeerGroup().getDiscoveryService().flushAdvertisement(lSipProxyRegistrarAdvertisement); 32 mLog.info(aProxy +"revoked"); 33 } catch (Exception e) { 34 throw new P2pProxyException(e); 35 } 36 } 21 37 22 38 }
Note: See TracChangeset
for help on using the changeset viewer.
