This repository has been archived by the owner on Mar 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
316 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.DS_Store | ||
measurement_kit-jni-libs-v*.tar.bz2 | ||
measurement_kit-jni-libs-v*.tar.bz2.asc | ||
measurement_kit-jni-v*.tar.bz2 | ||
measurement_kit-jni-v*.tar.bz2.asc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
java/io/github/measurement_kit/jni/sync/PortolanSyncApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Part of measurement-kit <https://measurement-kit.github.io/>. | ||
// Measurement-kit is free software. See AUTHORS and LICENSE for more | ||
// information on the copying conditions. | ||
|
||
package io.github.measurement_kit.jni.sync; | ||
|
||
/** | ||
* JNI API to run synchronous Portolan tests. | ||
*/ | ||
public class PortolanSyncApi { | ||
|
||
/** | ||
* Open traceroute prober (i.e. opaque object to send probes). | ||
* @param useIpv4 whether to use IPv4. | ||
* @param sourcePort Specify source port. | ||
* @return opaque prober on success, zero on failure. | ||
*/ | ||
public static native long openProber(boolean useIpv4, int sourcePort); | ||
|
||
/** | ||
* Send single traceroute probe. | ||
* | ||
* @param prober Opaque traceroute prober instance. | ||
* @param destIp Destination IP address. | ||
* @param ttl Time to live. | ||
* @param timeout Time to wait for response. | ||
* | ||
* @param outStrings Vector of strings filled by this function that will | ||
* contain the statusCode as first element and the interfaceIp | ||
* as second element. As of MeasurementKit 0.1.0, the status code | ||
* should be one of the following: | ||
* | ||
* - OTHER | ||
* - NO_ROUTE_TO_HOST | ||
* - ADDRESS_UNREACH | ||
* - PROTO_NOT_IMPL | ||
* - PORT_IS_CLOSED | ||
* - TTL_EXCEEDED | ||
* - ADMIN_FILTER | ||
* - GOT_REPLY_PACKET | ||
* | ||
* @param outInts Vector of integers filled by this function that will | ||
* contain the ttl, the number of received bytes, and whether | ||
* the response is IPv4 (the latter with the semantic that zero | ||
* is false and nonzero is true). | ||
* | ||
* @param outDouble On success this vector will be filled with the RTT | ||
* of the response in position 0. | ||
*/ | ||
public static native void sendProbe(long prober, | ||
String destIp, | ||
int destPort, | ||
int ttl, | ||
double timeout, | ||
String[ | ||
// statusCode | ||
// interfaceIp | ||
] outStrings, | ||
int[ | ||
// ttl | ||
// recvBytes | ||
// isIpv4 | ||
] outInts, | ||
double[ | ||
// rtt | ||
] outDoubles); | ||
|
||
/** | ||
* Close opaque traceroute prober instance. | ||
* @param prober Opaque traceroute prober instance. | ||
*/ | ||
public static native void closeProber(long prober); | ||
|
||
/** | ||
* Checks whether a TCP port is open. | ||
* @param useIpv4 Whether to use IPv4 or not. | ||
* @param addr Address to use. | ||
* @param port Port to use. | ||
* @param timeo Connect() timeout. | ||
* @return True if port is open, false otherwise. | ||
*/ | ||
public static native boolean checkPort(boolean useIpv4, String addr, | ||
String port, double timeo); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
arm64-v8a/ | ||
armeabi/ | ||
armeabi-v7a/ | ||
io_github_measurement_kit_jni_*.h | ||
mips/ | ||
mips64/ | ||
x86/ | ||
x86_64/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Part of measurement-kit <https://measurement-kit.github.io/>. | ||
// Measurement-kit is free software. See AUTHORS and LICENSE for more | ||
// information on the copying conditions. | ||
|
||
#include <jni.h> | ||
#include <string> | ||
#include "common.hpp" | ||
|
||
namespace mk { | ||
namespace jni { | ||
|
||
std::string cxxstring(JNIEnv *env, jstring source) { | ||
const char *ptr = env->GetStringUTFChars(source, nullptr); | ||
if (ptr == nullptr) throw std::bad_alloc(); | ||
std::string copy = ptr; | ||
env->ReleaseStringUTFChars(source, ptr); | ||
return copy; | ||
} | ||
|
||
} // namespace jni | ||
} // namespace mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Part of measurement-kit <https://measurement-kit.github.io/>. | ||
// Measurement-kit is free software. See AUTHORS and LICENSE for more | ||
// information on the copying conditions. | ||
|
||
#ifndef JNI_COMMON_HPP | ||
#define JNI_COMMON_HPP | ||
|
||
#include <jni.h> | ||
#include <string> | ||
|
||
namespace mk { | ||
namespace jni { | ||
|
||
std::string cxxstring(JNIEnv *env, jstring source); | ||
|
||
} // namespace jni | ||
} // namespace mk | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.