summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2016-04-20Revert use of Java 7 'XXX' Time Pattern element.Alan Young
Not supported in Android. Was introduced in commit 8fe7526. Change-Id: I9fb396749c92b89cbaa7fac6cdeb047161ed0358
2016-03-07Add missing TLS and Base classesAlex Clayton
Add missing methods and classes in the TLS and Base packages where possible. In the case of TLSContextFactory the methods could not be implemented in java so added a not saying they are not supported in java. Test-information: Unit tests still build and run ok. Change-Id: I9be2035f092875fcdc02644a3c0082739f26949a
2016-02-29Add sort method for ServiceQuery and add TestsAlex Clayton
Add the sortResult static method to the DomainNameServiceQuery class. This required adding a few equivalances for C++ std library methods to the class. And add a test for the new method too. Test-information: All unit tests pass ok. Change-Id: Idee0888f7ea140d35a971414fc2fd3cbcdfc337f
2016-02-16Add the FileTransfer testsAlex Clayton
Add the missing FileTransfer tests to stroke. When porting the tests I found some of them were failing and required changes to the classes being tested to fix. Had to add a DummyNetworkEnvironment as well for the OutgoingJingleFileTransferTest. Test-information: All unit tests pass. Change-Id: Id511a556ef3a5d66e0e107f36f736db3bbb3a437
2016-01-21Completes FileTransfer according to Swiften.Tarun Gupta
S5BTransport Session still needs generic T. FileTransfer, OutgoingFileTransfer and IncomingFileTransfer are made an interface due to the need of multiple inheritance in IncomingJingleFileTransfer and OutgoingJingleFileTransfer. Corresponding documentation has been updated. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: None. Change-Id: If44cf387767865c37492d871c12d623f94ebaa3a
2016-01-18Some Jingle FixesAlex Clayton
Some fixes to the Jingle classes for the previous patch. Test-information: By code inspection. Ran Unit Tests there were no failures. Change-Id: I61210dd1ec2c7e0dd11d67a45a0ced63952804c7
2016-01-14Completes Jingle.Tarun Gupta
Adds Listenable, JingleSession, JingleContentID, FakeJingleSession, JingleSessionListener, JingleSessionManager, JingleResponder. NotifyListeners are not in line with Swiften and have to be corrected. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: None. Change-Id: I6533b2be02a0843277a63ca115348ff6138a0fc0
2015-08-13Rework ByteArray implementationAlan Young
Use and ArrayList<byte[]> as the internal storage, instead of Vector<Byte>. Constructors and methods that supply a byte[] to add to the instance will have that value copied, rather than just taking ownership of the byte[]. There is an argument, on efficiency grounds, for providing methods that take ownership of the supplied argument. The earlier discussions about use of synchronization in the class are revisited. This is a low-level container that should be thread-safe or take precautions against non-thread-safe use. It is anticipated that the vast majority of uses will be thread-safe. Use of synchronization permits occasional deviations from this without imposing any significant overhead for the normal case - uncontended synchronization is close to free. Change-Id: Ifb7b2915d5c96345c53aec8e33673d892c430431
2015-07-28Complete StreamStack and add tests.Tarun Gupta
TLSLayer could not be updated because it requires TLS to be ported first. Updates other classes, only for having compatibility with SafeByteArray because of updates in Stream Stack. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests added for StreamStack and XMPPLayer, which passes. Change-Id: I8707fc1f16d622d2a90f6f39f671b7e7c46aa170
2015-07-28Update Serializers and Parsers.Tarun Gupta
Updates Serializers and Parsers along with one minor change in XMPPlayer. Update Non Payload Serializers to return SafeByteArray. Updates SafeByteArray to return SafeByteArray on append and plus method. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: None. Change-Id: I6fe665a26b10cac37b3e3acd9ec15c211ac9b8ab
2015-07-07Adds tests for Parser and Serializers.Tarun Gupta
Adds PubSubEvent Element. Adds StreamFeaturesSerializer. Adds ParserTester, ElementParserTester, StanzaParserTester, PayloadParserTester, PayloadsSerializer and EnumParser. Updates Error Payload, JingleFIleTransferHash Elements/ Updates StreamFeaturesParser, ParserElement. Updates Delay Serializer, Error Serializer. Updates AuthChallenge and AuthRequest Element. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Test are added for: AuthChallenge Serializer, AuthRequest Serializer, AuthResponse Serializer, AuthSuccess Serializer. GenericPayloadTreeParserTest. IQ Parser. Message Parser. Presence Parser. StanzaAck Parser. Stanza Parser. StreamFeatures Parser and Serializer. StreamManagementEnabled Parser. Private Storage Parser and Serializer. RawXMLPayload Parser. Storage Parser and Serializer. Error Serializer. Jingle Serializer. PubSubItem Serializer and PubSubItems Serializer. Serializing Parser. All tests passes. Change-Id: I79e00dc5b5c4f85e659bf88b1547dd7c17825805
2015-07-06Add Base Functionalities.Tarun Gupta
Adds FileSize, SafeString, StartStoppable, StartStopper and TriState. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: None. Change-Id: I94020700a77bb33dab39fb838eefc96c07b73868
2015-06-23Add ComponentHandshake Element.Tarun Gupta
Adds ComponentHandshake Element, its parser and Serializer. Adds ComponentHandshake Generator. Adds TopLevelElement. Updates SafeByteArray. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Test added for ComponentHandshakeGenerator, which passes. Change-Id: If3026a3db2207e6c65aa2306fee56d8dd5dee86f
2015-06-14Add support for Crypto-functions.Tarun Gupta
Completes the JavaCryptoProvider providing functionalities for SHA-1 Hash, MD5 Hash and HMACSHA1 Hash. Also updates reference for JavaCryptoProvider in JavaNetworkFactories. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests are added for JavaCryptoProvider, which passes. Change-Id: I2439e5fd76a23e9b5c4e9132a9856543a7ca53fd
2015-05-27Add the functionality for processing of URL.Tarun Gupta
Adds functionalities for URL processing such as extracting parameters from URL, decoding URL. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Corresponding tests are added for each function which passes. Change-Id: I1d54b86167b4f368c365f16c63641a6e6a91cbb8
2015-05-26Add functionality for UUID Generator.Tarun Gupta
Adds the Simple ID Generator as well as Random ID Generator. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests added for both IDGenerator and SimpleIDGenerator which passes. Change-Id: I9bce3a172774effead3ada695bcceb0b0f81b851
2015-04-10Checkpoint - A bunch of initial stuff for AndroidAlan Young
MemoryStorages, Storages NickManager, NickResolver CryptoProvider, Hash, SafeByteArray, JavaCryptoProvider CapsInfoGenerator, CapsManager, CapsMemoryStorage, CapsProvider, CapsStorage, CapsInfo CapsInfoSerializer, CapsInfoParser ClientDiscoManager, DiscoInfoResponder, EntityCapsManager, EntityCapsProvider GetDiscoInfoRequest ChatState, Idle Presence, PayloadAddingPresenceSender, PresenceOracle, SubscriptionManager StatusSerializer, StatusShowSerializer, StatusParser, StatusShowParser, Replace, ReplaceParser, ReplaceSerializer SecurityLabel, SecurityLabelsCatalog, GetSecurityLabelsCatalogRequest VCard, GetVCardRequest, SetVCardRequest, VCardManager, VCardMemoryStorage, VCardStorage RosterMemoryStorage, RosterPushResponder, RosterStorage, SetRosterRequest XMPPRoster, XMPPRosterController, XMPPRosterImpl, XMPPRosterItem GetRosterRequest, SetResponder Add parsers and serializers for Idle, VCard, PrivateStorage & Stroage. Add parser for Subject. Add impromptu flag to MUCInvitation. Update copyrights. Change-Id: I9949f506b70e60b3a64f1dadde8f9b235b322e1d
2015-04-02Fix copyright header on DateTimeKevin Smith
Change-Id: I97fa434712eb32ad2c56558434a09fe5b1e3fb92
2015-04-02Use specific Local.US for date-time strings for protocol use.Alan Young
Default Locale is unsafe as one could, for example, get Arabic numerals instead of ASCII ones. Change-Id: Ib70d271bf433c4928accca3b4802c3ba3cb2aa0e
2014-05-26Added MAM parsers, serializers and tests.Richard Maudsley
Change-Id: I4e5368f9ac86446b7ebf976e2cb63d64ebefe7b2
2013-10-15Revert "synchronized" patch and fix use of ByteArray inside JavaConnectionNick Hudson
Some discussion followed the "Fix synchronization problem in ByteArray" patch, and that led us to believe that it would be better to change the JavaConnection class so that it does not rely on being able to pass ByteArrays around in a way that makes them vulnerable to the problems that had been seen. The JavaConnection class accepts a ByteArray in its "write()" method, and emits a ByteArray when it has read data. ByteArrays are not the ideal way for the JavaConnection class to manipulate data and so this patch changes the implementation so that: a) the "write()" method extracts the byte[] from the supplied ByteArray and uses these objects, rather than keeping references to the ByteArray objects (which might lead to synchronisation issues). b) the "doRead()" method uses a ByteArrayOutputStream to hold incoming data, and only constructs a ByteArray out of it when it is ready to return the data to the application. These changes make the class more efficient, since in the case of (a), the need to create temporary ByteArrays is removed, and in (b) the code no longer creates ByteArrays by iterating through the network data one byte at a time and appending it to a ByteArray. It also means that the "synchronized" patch (which would fix the problem) is no longer necessary, and so that code is reverted. Test-information: I patched the code to emulate the situation that would occur when a buffer is only partially written, and verified that in this case it correctly re-inserted the unwritten portion of the buffer at the front of the pending queue. Ran MLC to various servers, all seems to work OK. Tested in Harrier, seems to work OK, and does not exhibit problems that we had seen previously which led us to investigate this issue. Change-Id: Ifcda547402430c87da45ba7d692518b5af285763 Signed-off-by: Nick Hudson <nick.hudson@isode.com>
2013-10-08Fix synchronization problem in ByteArrayNick Hudson
We noticed that in certain circumstances a stream of data being sent to a server was being corrupted. According to the "onDataWritten" signal, we could see that the data which Stroke thought it was writing was valid, but by adding debug code to the JavaConnection class, we could see that what was actually being sent over the socket was wrong. For example, where "onDataWritten" would report something like some text for the server the actual data being written to the socket (as shown by toString() of the bytestream) would be something like: some text fo\200\300\200\300\200\300\200\300\200\300\200\300\200\300\200\300\200\300\200\300\200\300\200\300 i.e. the length of data is correct, but the last part of the buffer is broken. We saw this on non-TLS connections, but never on TLS connections. The reason for this (verified after some debugging) is that the "ByteData.getData()" method was unsynchronized. In the failing cases, two threads are calling this method at once. The first one finds that "dataCopy_" is null, and so new's it and starts filling it with data. The second thread calls "getData()" before this completes, which means it sees "dataCopy_" as non-null, and uses that value (even though the first thread hasn't finished populating it yet). In the failing scenario, the two threads involved were (1) thread that was handling the "onDataWritten()" callback (which called "getData()" to get a String that it sent to a debug stream) and (2) the JavaConnection code (which wants to write the data to the socket). It seems likely that the reason this doesn't happen for TLS connections is that in that case, the JavaConnection object will be processing a ByteArray object that has been generated via the SSLEngine (rather than the one which "onDataWritten()" sees, and so the chance of two threads both calling "getData()" is reduced. (I have not followed the TLS code path thoroughly to verify this). So this change makes any method in ByteArray that touches "dataCopy_" be synchronized (as well as hashCode() as suggested by findbugs) Test-information: Having inserted some debug code, I could reproduce the "data corruption" problem reliably. After adding the "synchronized" directive to "getData()", I could no longer reproduce the corruption. Ran MLC with this patch and works with no problems Change-Id: I02008736a2a8bd44f3702c4526fd67369a3c136a Signed-off-by: Nick Hudson <nick.hudson@isode.com>
2012-03-07Using JZlib for compression, as features we need aren't in Java until 1.7Kevin Smith
2012-02-13Update ByteArray with "readFromFile" implementation and more javadocNick Hudson
This change provides implementation for the previously empty "readFromFile" method, which is based on the code inside Swiften's ByteArray.readByteArrayFromFile(). Note that, as for the Swiften method, no errors are reported if an attempt to read from a file fails; it just leaves the contents of the object unchanged. Some javadoc was also provided, especially noting that the various String methods are only safe so long as you're working with UTF-8 Strings. Test-information: Existing Stroke unit tests still pass Signed-off-by: Nick Hudson <nick.hudson@isode.com>
2012-01-16Add support for DiscoItems and DiscoInfo.Kevin Smith
Updates requisite classes in line with Swiften. Also fixes bugs in the EventLoops not using handleEvent.
2011-10-31Fix utf-8 encoding on Remko's name throughout. Now compiles with Java 7Kevin Smith
2011-07-01Update the ByteArray to not copy excessively on appends.Kevin Smith
Also updates build.xml so the path to the xpp library can be specified, rather than needing the same layout as my build tree.
2011-07-01Initial importKevin Smith