History log of /libcore/luni/src/main/native/NetworkUtilities.cpp
Revision Date Author Comments
d8cec780b3b5177b5c1e500ea606f731a67fb53c 21-Jun-2011 Elliott Hughes <enh@google.com> Add a couple more missing calls to DeleteLocalRef.

Change-Id: I84176e57d775cf5e433078b726be9cda3c6d4934
8ecbb3f6a89983adb1a085469befc70488f4f04f 27-May-2011 Elliott Hughes <enh@google.com> Don't use mapped IPv4 addresses with MCAST_JOIN_GROUP.

This change is really a one-liner, but I did some cleanup too. This fixes most
of the Harmony multicast tests.

Change-Id: I37ff9c6ee6ee64de0500ef4b51638b3d3a6417ff
4728a015bcd3f432e000d1547c668e804015dc04 19-May-2011 Elliott Hughes <enh@google.com> More IPv6 sin6_scope_id fixes.

My earlier patch fixed the Java-to-native direction. This fixes the
native-to-Java direction, which didn't occur to us at the time.

I've also fixed the documentation so that public methods don't
define themselves in terms of a private method (that ought to
exist in the public API, but doesn't).

Change-Id: Ib16a5952bb69b0b96a66775304947f2a120a1dcf
23ec09188303a874b3b391f96ae0a29af002bff9 19-May-2011 Elliott Hughes <enh@google.com> Implement recvfrom(2).

This one's a little bit hairy because of multiple return values.

Bug: 3107501
Change-Id: I3bd35647d94bb6bc2192d6f31a39ecca07a3926e
e9f12043a1e2a29c60779cdb55c58eb156963570 11-May-2011 Elliott Hughes <enh@google.com> Add missing ScopedLocalRef usages.

The one in RealToString is strictly unnecessary, but the other missing ones
should have been there, and this seems like another instance of the "optional
braces" anti-pattern: you should need a specific reason _not_ to have a
ScopedLocalRef, and currently only our iovec code has such a reason (and it
was already explicitly manipulating its local frame correctly).

Change-Id: I24d4766a37bd9677db43da55b94da036a263c0c8
32b0fa4d1a31ef07bc4297c615f0fe50e9aa7c21 11-May-2011 Elliott Hughes <enh@google.com> DatagramSocket.disconnect is really a connect(2) of an AF_UNSPEC sockaddr.

Bug: 3107501
Change-Id: Ib04369b9ca63ff3fe7eb87dcbf2926fe704813e3
da15009528cc8300a6251f1d0931ac8657c9fc31 09-May-2011 Elliott Hughes <enh@google.com> Expose bind(2).

I've renamed the java.net.InetAddress to struct sockaddr conversion functions
too, after initially screwing up this patch by copy & pasting a usage of the
one that only one caller actually wants. Now the name's so ugly no-one will
be likely to use it by accident.

Bug: 3107501
Change-Id: I869a8d27fc40e462505e02bf25a67e771a403e92
4664da5cfc3f22a633ca2c7013a97c08a42e6ba7 07-May-2011 Elliott Hughes <enh@google.com> Simplify our AF_INET/AF_INET6 address situation.

Looks like there's just one special case (presentation to the user) where we
want an Inet4Address to be an AF_INET sockaddr_in rather than an IPv4-mapped
AF_INET6 sockaddr_in6.

Change-Id: Ib3bcc9b69a0fc27c7348b97cc81fb326ba1d5d9d
49ff8b8582bca20a1adbda1d957220526332a8ca 06-May-2011 Elliott Hughes <enh@google.com> More networking cleanup.

Move a bit more work into Java.

Change-Id: I656ec6e3c792ce9baed32662d65c45d75af1d371
c06e5e270b958aeb8060cd7f2576c0f1e6ac415e 05-May-2011 Elliott Hughes <enh@google.com> Set the sin6_scope_id field when translating an Inet6Address to a sockaddr.

This basically means link-local IPv6 addresses have never worked on Android.

Change-Id: I343493cbbde1e4441385487f054c4bdad5dcef52
1c039d71d3879f39e3a75b8788e656f7b4f88f08 05-May-2011 Elliott Hughes <enh@google.com> Add getaddrinfo(2).

This only supports the "node" side of getaddrinfo(2), not the "service" side.
There's also no support for AI_CANONNAME, so we currently return InetAddress[]
rather than anything equivalent to C's linked list of struct addrinfo.

Bug: 3107501
Change-Id: I8cf6baa3027a0fa05ac6e2f8fcc1dd8b576ff8c4
4f11ebea266eada830d507b8f011e811a8e5d7bc 20-Apr-2011 Elliott Hughes <enh@google.com> Add getnameinfo(3) (and gai_strerror(3)).

There's quite a large corresponding change to InetAddress, plus I've changed
the documentation for all the Permission classes to match the handful that
we'd already documented as legacy cruft.

Bug: http://b/3107501
Change-Id: Ia67aba79f0ab13e64085bd4a2df20ad0776bcc5b
51236bf3f42f234359ccbf1d09b41f7e09396889 09-Apr-2011 Elliott Hughes <enh@google.com> Use jniThrowExceptionFmt.

There were a couple of places where we were doing this manually.

Change-Id: Iea6201815e8b52e4caba13b789abedc0e173df79
8398239b31c6f6fb9b19788d0a4b9ff16a59caf7 01-Apr-2011 Elliott Hughes <enh@google.com> Make inetAddressToSocketAddress more available.

I should probably rename the NetworkUtilities.h methods to say something like
SockaddrStorage instead of SocketAddress, to avoid confusion with
java.net.SocketAddress, but that can come later.

Change-Id: Id878c2b865c284bb4a14f3db1eb15b3fa9ccc9e9
0a9d1ee45a9884a9616624d747172e18734e8fe0 31-Mar-2011 Elliott Hughes <enh@google.com> Add getsockname(2) and getsockopt(2).

Bug: 3107501
Change-Id: Ibb0d5a576ecb46e51dbda6051776145eec9e7fe1
acce5ff29455054faa08a10e1486a156b9d1553e 14-Aug-2010 Elliott Hughes <enh@google.com> Fix last few uses of "type *id" to be "type* id".

We don't want anyone calling us unreformed C programmers...

Change-Id: I79b12245b206495ca747b4027b2bca423c27aec0
440ba565fa5384bc23255fbc412f7b97fcbdccd9 04-Aug-2010 Elliott Hughes <enh@google.com> Rename setNonBlocking to setBlocking.

This makes the boolean argument less confusing.

Change-Id: Ic226f6d3c5afe8e15a95e74917656424f8a448fe
91ad12a4e7c9eeb19b48fa296b4ed87d6c7b612b 26-Jul-2010 Elliott Hughes <enh@google.com> Better detail messages for exceptions thrown when converting between byte[]/InetAddress.

Change-Id: I0e87b0ed6487f8434435027ee70ec294c98617e8
3b0a5b910110625c50dae6baa94d9adaf58ed46e 23-Jul-2010 Elliott Hughes <enh@google.com> Consistently use POSIX O_NONBLOCK instead of FIONBIO.

Change-Id: I395012f0e51e1928e720d09d0f44b7d5085b01a3
a9f5c16a864ff63ba63f810410f8a27c086d5d52 17-Jun-2010 Elliott Hughes <enh@google.com> Remove dynamic calls to FindClass.

Initially, I was just fixing a threading bug in NativeDecimalFormat.cpp where
we were bypassing GCC's built-in static initializer thread safety. This led me
to the question of how expensive FindClass is, which led me to creating a new
canonical cache of jclasses.

Here's the motivating benchmark, showing the cost of calling an empty regular
(non-native) method, an empty native method, a native method that calls
FindClass, a native method that calls FindClass and GetFieldID, and a native
method that calls FindClass and GetMethodID:

benchmark ns logarithmic runtime
NoArgsRegular 74 ||||||||||||||
NoArgsNative 428 XX|||||||||||||||||||
FindClass 3064 XXXXXXXXXXXXXXXX|||||||||||
FindClassGetField 3654 XXXXXXXXXXXXXXXXXXX|||||||||
FindClassGetMethod 5634 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Change-Id: I41ab2b347895f043a7e21d8fa19e4541e198c3fc
abf945fb9ce99d8c2769ac5b2691b2732fa59887 04-Jun-2010 Elliott Hughes <enh@google.com> Bullet-proof the lseek/read in Inflater.setFileInput.

Also document why that non-API method exists, and that we don't have
benchmarks to support the claimed optimization.

Also be more consistent about setting LOG_TAG, and fix a few old-school
copyright headers.

Change-Id: If9fdc4583eaf91275ed44e2dc56174819d1913d0
753dcd862b31e85766225590d90ba0b9f481176f 02-Jun-2010 Elliott Hughes <enh@google.com> Refactor some of the OSNetworkSystem stuff to more appropriate homes.

Also rewrite PlainDatagramSocketImpl.peek in terms of existing primitives
rather than requiring its own. I still don't see how it can get called, but
at least now it doesn't require its own native code.

Bug: 2686833

Change-Id: I0453add66dab4c7095ee2a3f51a49efbd1205598