add NetConnection state
This commit is contained in:
parent
3c0527670c
commit
98761935f7
|
@ -739,6 +739,11 @@ my %classes = (
|
|||
desc => '',
|
||||
plat => 'L'
|
||||
},
|
||||
{
|
||||
name => 'state', type => 'Int',
|
||||
desc => '',
|
||||
plat => 'L'
|
||||
},
|
||||
],
|
||||
Who => [
|
||||
{
|
||||
|
@ -1002,6 +1007,8 @@ my %extra_code = (
|
|||
EOF
|
||||
NetConnection => <<'EOF',
|
||||
public native String getTypeString();
|
||||
|
||||
public native String getStateString();
|
||||
EOF
|
||||
Mem => <<'EOF',
|
||||
public String toString() {
|
||||
|
|
|
@ -760,6 +760,16 @@ JNIEXPORT jstring SIGAR_JNI(NetConnection_getTypeString)
|
|||
sigar_net_connection_type_get(type));
|
||||
}
|
||||
|
||||
JNIEXPORT jstring SIGAR_JNI(NetConnection_getStateString)
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
jclass cls = JENV->GetObjectClass(env, obj);
|
||||
jfieldID field = JENV->GetFieldID(env, cls, "state", "I");
|
||||
jint type = JENV->GetIntField(env, obj, field);
|
||||
return JENV->NewStringUTF(env,
|
||||
sigar_net_connection_state_get(type));
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray SIGAR_JNI(Sigar_getWhoList)
|
||||
(JNIEnv *env, jobject sigar_obj)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue