tcpdump mailing list archives

Re: Libpcap on mobile Android platform


From: Guy Harris <guy () alum mit edu>
Date: Fri, 5 Feb 2010 12:21:10 -0800


On Feb 5, 2010, at 3:36 AM, Mark Bednarczyk wrote:

I found a port of libpcap to Android (
<http://github.com/android/platform_external_libpcap>
http://github.com/android/platform_external_libpcap). Android is linux
underneath but java as the main application API. I am trying to figure out
if my java wrapper http://jnetpcap.com <http://jnetpcap.com/>  can be
extended for that platform. Android does support JNI (java to native
interface) so its possible to link it with native libpcap on android based
device (i.e. smart phones). So I have a few questions.

What is the status of libpcap on that platform in general? 

Is it actively maintained?

If by "that platform" you mean "Android", then libpcap doesn't support Android, it supports Linux.  We don't have 
anything whatsoever in libpcap that was put in there for Android (unless somebody contributed a patch to add stuff for 
Android and didn't indicate that was what it was for), so there's nothing Android-specific to maintain.  Making it work 
on Android would be an issue of

        1) arranging that there be a libpcap on the Android device in question

and

        2) hooking up to that via JNI.

I can't answer most of your other questions

Can libpcap library be distributed as part of an android application package
or does it need special android build to be installed?

Not being an Android developer, I don't know the answer to that question.  However, Googling for

        android libpcap

found

        http://github.com/android/platform_external_libpcap

which seems to suggest that libpcap might be part of the Android distribution, as does

        http://source.android.com/projects

In

        http://groups.google.com/group/android-developers/browse_thread/thread/f65a7f16177167f2

a Google employee named Justin says

        You'd need to write a native application to sniff network traffic. 
        Native application development is currently not supported. 

For what it's worth, nobody in that thread used the term "JNI", so I'm not sure if they didn't understand how you get 
access to, for example, libpcap from a Java application.

If no special build is required what is the minimum Android SDK API

Again, not being an Android developer, I don't know the answer to that question.

Anything missing from libpcap API because of android limitations?

You might want to look at the

        http://github.com/android/platform_external_libpcap

code to see whether they had to make any changes.-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: