[jbossnative-commits] JBoss Native SVN: r1000 - in trunk/sight: native/include and 1 other directories.

jbossnative-commits at lists.jboss.org jbossnative-commits at lists.jboss.org
Mon Sep 10 02:33:23 EDT 2007


Author: mladen.turk at jboss.com
Date: 2007-09-10 02:33:22 -0400 (Mon, 10 Sep 2007)
New Revision: 1000

Added:
   trunk/sight/java/org/jboss/sight/UdpState.java
Modified:
   trunk/sight/java/org/jboss/sight/UdpConnection.java
   trunk/sight/native/include/sight_local.h
   trunk/sight/native/share/udpconn.c
Log:
Add missing fields to UdpConnection

Modified: trunk/sight/java/org/jboss/sight/UdpConnection.java
===================================================================
--- trunk/sight/java/org/jboss/sight/UdpConnection.java	2007-09-10 05:51:00 UTC (rev 999)
+++ trunk/sight/java/org/jboss/sight/UdpConnection.java	2007-09-10 06:33:22 UTC (rev 1000)
@@ -40,12 +40,22 @@
         // Nothing
     }
 
+    private void setState(int state)
+    {
+        State = UdpState.valueOf(state);
+    }
+
     /**
      * Local IP address for the UDP endpoint.
      */
     public NetworkAddress       LocalAddr;
 
     /**
+     * Specifies the address for the connection on the remote computer.
+     */
+    public NetworkAddress       RemoteAddr;
+
+    /**
      * The PID of the process that issued a context bind for
      * this endpoint.
      */

Added: trunk/sight/java/org/jboss/sight/UdpState.java
===================================================================
--- trunk/sight/java/org/jboss/sight/UdpState.java	                        (rev 0)
+++ trunk/sight/java/org/jboss/sight/UdpState.java	2007-09-10 06:33:22 UTC (rev 1000)
@@ -0,0 +1,58 @@
+/*
+ *  SIGHT - System information gathering hybrid tool
+ *
+ *  Copyright(c) 2007 Red Hat Middleware, LLC,
+ *  and individual contributors as indicated by the @authors tag.
+ *  See the copyright.txt in the distribution for a
+ *  full listing of individual contributors.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library in the file COPYING.LIB;
+ *  if not, write to the Free Software Foundation, Inc.,
+ *  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ */
+
+package org.jboss.sight;
+
+/**
+ * Determines the state of UDP connection
+ */
+public enum UdpState
+{
+
+    UNKNOWN(        0),
+    LISTENING(      1),
+    ESTABLISHED(    2);
+
+    private int value;
+    private UdpState(int v)
+    {
+        value = v;
+    }
+
+    public int valueOf()
+    {
+        return value;
+    }
+
+    public static UdpState valueOf(int value)
+    {
+        for (UdpState e : values()) {
+            if (e.value == value)
+                return e;
+        }
+        return UNKNOWN;
+    }
+
+}


Property changes on: trunk/sight/java/org/jboss/sight/UdpState.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/sight/native/include/sight_local.h
===================================================================
--- trunk/sight/native/include/sight_local.h	2007-09-10 05:51:00 UTC (rev 999)
+++ trunk/sight/native/include/sight_local.h	2007-09-10 06:33:22 UTC (rev 1000)
@@ -454,9 +454,11 @@
 jobject      sight_new_udpconn_class(SIGHT_STDARGS);
 jobjectArray sight_new_udpconn_array(SIGHT_STDARGS, jsize);
 void         sight_udpconn_set_local(SIGHT_STDARGS, jobject);
+void         sight_udpconn_set_remote(SIGHT_STDARGS, jobject);
 void         sight_udpconn_set_pid(SIGHT_STDARGS, jint);
 void         sight_udpconn_set_cts(SIGHT_STDARGS, jlong);
 void         sight_udpconn_set_tmo(SIGHT_STDARGS, jint);
+void         sight_udpconn_set_state(SIGHT_STDARGS, jint);
 
 
 #ifdef __cplusplus

Modified: trunk/sight/native/share/udpconn.c
===================================================================
--- trunk/sight/native/share/udpconn.c	2007-09-10 05:51:00 UTC (rev 999)
+++ trunk/sight/native/share/udpconn.c	2007-09-10 06:33:22 UTC (rev 1000)
@@ -46,6 +46,12 @@
     "()V"
 };
 
+J_DECLARE_M_ID(0001) = {
+    NULL,
+    "setState",
+    "(I)V"
+};
+
 J_DECLARE_F_ID(0000) = {
     NULL,
     "LocalAddr",
@@ -54,17 +60,23 @@
 
 J_DECLARE_F_ID(0001) = {
     NULL,
+    "RemoteAddr",
+    "L" SIGHT_CLASS_PATH "NetworkAddress;"
+};
+
+J_DECLARE_F_ID(0002) = {
+    NULL,
     "Pid",
     "I"
 };
 
-J_DECLARE_F_ID(0002) = {
+J_DECLARE_F_ID(0003) = {
     NULL,
     "CreateTimestamp",
     "J"
 };
 
-J_DECLARE_F_ID(0003) = {
+J_DECLARE_F_ID(0004) = {
     NULL,
     "Timeout",
     "I"
@@ -78,7 +90,9 @@
     J_LOAD_IFIELD(0001);
     J_LOAD_IFIELD(0002);
     J_LOAD_IFIELD(0003);
+    J_LOAD_IFIELD(0004);
     J_LOAD_METHOD(0000);
+    J_LOAD_METHOD(0001);
 
     return 0;
 }
@@ -109,17 +123,27 @@
     SET_IFIELD_O(0000, _O, val);
 }
 
+void sight_udpconn_set_remote(SIGHT_STDARGS, jobject val)
+{
+    SET_IFIELD_O(0001, _O, val);
+}
+
 void sight_udpconn_set_pid(SIGHT_STDARGS, jint val)
 {
-    SET_IFIELD_I(0001, _O, val);
+    SET_IFIELD_I(0002, _O, val);
 }
 
 void sight_udpconn_set_cts(SIGHT_STDARGS, jlong val)
 {
-    SET_IFIELD_J(0002, _O, val);
+    SET_IFIELD_J(0003, _O, val);
 }
 
 void sight_udpconn_set_tmo(SIGHT_STDARGS, jlong val)
 {
-    SET_IFIELD_J(0003, _O, val);
+    SET_IFIELD_J(0004, _O, val);
 }
+
+void sight_udpconn_set_state(SIGHT_STDARGS, jint val)
+{
+    CALL_METHOD1(0001, _O, val);
+}




More information about the jbossnative-commits mailing list