diff options
author | Andrew Comminos <andrewcomminos@gmail.com> | 2013-11-26 04:03:27 +0400 |
---|---|---|
committer | Andrew Comminos <andrewcomminos@gmail.com> | 2013-11-26 04:03:27 +0400 |
commit | 1b58f1a707dd9960ce782363b95f3fd1be7455c6 (patch) | |
tree | 04f35d742664cb1ae1e6cfcd3a09a9724a2ec161 /src/main/java | |
parent | dcf3fed8885d04109dddb816794864356507607b (diff) |
Fixed issue with UDP send. Some changes to IPC.
Diffstat (limited to 'src/main/java')
5 files changed, 35 insertions, 14 deletions
diff --git a/src/main/java/com/morlunk/jumble/JumbleService.java b/src/main/java/com/morlunk/jumble/JumbleService.java index 03d2348..e01b291 100644 --- a/src/main/java/com/morlunk/jumble/JumbleService.java +++ b/src/main/java/com/morlunk/jumble/JumbleService.java @@ -224,6 +224,16 @@ public class JumbleService extends Service implements JumbleConnection.JumbleCon } @Override + public boolean isBluetoothAvailable() throws RemoteException { + return false; + } + + @Override + public void setBluetoothEnabled(boolean enabled) throws RemoteException { + + } + + @Override public void joinChannel(int channel) throws RemoteException { Mumble.UserState.Builder usb = Mumble.UserState.newBuilder(); usb.setSession(mConnection.getSession()); @@ -452,8 +462,8 @@ public class JumbleService extends Service implements JumbleConnection.JumbleCon mTextMessageHandler = new TextMessageHandler(this); mAudioOutput = new AudioOutput(this); mAudioInput = new AudioInput(this, JumbleUDPMessageType.UDPVoiceOpus, mTransmitMode, mDetectionThreshold, mAudioInputListener); - mConnection.addMessageHandlers(mChannelHandler, mUserHandler, mTextMessageHandler, mAudioOutput, mAudioInput); + mConnection.connect(); } diff --git a/src/main/java/com/morlunk/jumble/net/CryptState.java b/src/main/java/com/morlunk/jumble/net/CryptState.java index aba0295..31ec013 100644 --- a/src/main/java/com/morlunk/jumble/net/CryptState.java +++ b/src/main/java/com/morlunk/jumble/net/CryptState.java @@ -158,26 +158,25 @@ public class CryptState { final ByteBuffer plainBuffer = ByteBuffer.wrap(plain); final ByteBuffer encryptedBuffer = ByteBuffer.wrap(encrypted); - final byte[] plainRegion = new byte[AES_BLOCK_SIZE]; - final byte[] encryptedRegion = new byte[AES_BLOCK_SIZE]; + final byte[] buffer = new byte[AES_BLOCK_SIZE]; int len = plainLength; while(len > AES_BLOCK_SIZE) { - plainBuffer.get(plainRegion, 0, AES_BLOCK_SIZE); - encryptedBuffer.get(encryptedRegion, 0, AES_BLOCK_SIZE); - CryptSupport.S2(delta); - CryptSupport.XOR(tmp, delta, plainRegion); + plainBuffer.get(buffer, 0, AES_BLOCK_SIZE); + CryptSupport.XOR(checksum, checksum, buffer); + CryptSupport.XOR(tmp, delta, buffer); mEncryptKey.doFinal(tmp, 0, AES_BLOCK_SIZE, tmp); - CryptSupport.XOR(encryptedRegion, delta, tmp); - CryptSupport.XOR(checksum, checksum, plainRegion); + + CryptSupport.XOR(buffer, delta, tmp); + encryptedBuffer.get(buffer, 0, AES_BLOCK_SIZE); len -= AES_BLOCK_SIZE; } CryptSupport.S2(delta); CryptSupport.ZERO(tmp); long num = len * 8; - tmp[AES_BLOCK_SIZE-1] = (byte) ((num >> 8) & 0xFF); + tmp[AES_BLOCK_SIZE-2] = (byte) ((num >> 8) & 0xFF); tmp[AES_BLOCK_SIZE-1] = (byte) (num & 0xFF); CryptSupport.XOR(tmp, tmp, delta); mEncryptKey.doFinal(tmp, 0, tmp.length, pad); diff --git a/src/main/java/com/morlunk/jumble/net/JumbleConnection.java b/src/main/java/com/morlunk/jumble/net/JumbleConnection.java index 349d82e..e597dd8 100644 --- a/src/main/java/com/morlunk/jumble/net/JumbleConnection.java +++ b/src/main/java/com/morlunk/jumble/net/JumbleConnection.java @@ -237,6 +237,7 @@ public class JumbleConnection { buffer.putLong(t); sendUDPMessage(buffer.array(), 16, true); + Log.v(Constants.TAG, "OUT: UDP Ping"); } Mumble.Ping.Builder pb = Mumble.Ping.newBuilder(); @@ -313,10 +314,6 @@ public class JumbleConnection { return (System.nanoTime()-mStartTimestamp)/1000; } - public void addMessageHandler(JumbleMessageListener handler) { - mHandlers.add(handler); - } - public void addMessageHandlers(JumbleMessageListener... handlers) { for(JumbleMessageListener listener : handlers) mHandlers.add(listener); diff --git a/src/main/java/com/morlunk/jumble/net/JumbleObserver.java b/src/main/java/com/morlunk/jumble/net/JumbleObserver.java index db653eb..d328c2f 100644 --- a/src/main/java/com/morlunk/jumble/net/JumbleObserver.java +++ b/src/main/java/com/morlunk/jumble/net/JumbleObserver.java @@ -88,6 +88,11 @@ public class JumbleObserver extends IJumbleObserver.Stub { } @Override + public void onPermissionDenied(String reason) throws RemoteException { + + } + + @Override public void onLogInfo(String message) throws RemoteException { } diff --git a/src/main/java/com/morlunk/jumble/protocol/UserHandler.java b/src/main/java/com/morlunk/jumble/protocol/UserHandler.java index a520451..48c1121 100644 --- a/src/main/java/com/morlunk/jumble/protocol/UserHandler.java +++ b/src/main/java/com/morlunk/jumble/protocol/UserHandler.java @@ -264,4 +264,14 @@ public class UserHandler extends ProtocolHandler { } }); } + + @Override + public void messagePermissionDenied(final Mumble.PermissionDenied msg) { + getService().notifyObservers(new JumbleService.ObserverRunnable() { + @Override + public void run(IJumbleObserver observer) throws RemoteException { + observer.onPermissionDenied(msg.getReason()); + } + }); + } } |