add NetConnection state

This commit is contained in:
Doug MacEachern committed 2005-03-11 17:15:24 +00:00
1 parent 3c0527670c
commit 98761935f7
2 files changed
+17

No files matched your search

+7
View File
@@ -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() {
+10
View File
@@ -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)
{