]> jspc29.x-matter.uni-frankfurt.de Git - trbnettools.git/commitdiff
update
authorhadaq <hadaq>
Sat, 25 Feb 2012 21:33:13 +0000 (21:33 +0000)
committerhadaq <hadaq>
Sat, 25 Feb 2012 21:33:13 +0000 (21:33 +0000)
pexor/Makefile
trbnetd/Makefile
trbnetd/server/Makefile
trbnetd/server/trbnetd.c
trbnetd/trbnetrpc.c
trbnetd/trbrpc.x
trbrich/Makefile

index 527b78af7e08ec717c02e461d8aba2d9a63b7e15..b6991a5ce78695c8697acd1fdfec6daea69753c5 100644 (file)
@@ -19,7 +19,7 @@ LD = $(CC)
 
 LDFLAGS = 
 LIBDIR = -L../libtrbnet
-LOADLIBES = -ltrbnet
+LOADLIBES = -ltrbnet -lm
 
 # ------------ TARGETS -------------------------------------------------
 
index 945804f87d74c29ab572250ee3d501150e53f316..e1eec5292c2ef0a797658d3162915173d254b31a 100644 (file)
@@ -20,7 +20,7 @@ LD = $(CC)
 
 LDFLAGS = 
 LIBDIR = 
-LOADLIBES = 
+LOADLIBES = -lm
 
 # ------------ TARGETS -------------------------------------------------
 
index 3818888dc51743eccb1c09730c2df8328d0f0ff0..d346b20dadbdb4a7f2656773abe0f4907b966c80 100644 (file)
@@ -24,7 +24,7 @@ LD = $(CC)
 
 LDFLAGS = 
 LIBDIR = -L../../libtrbnet
-LOADLIBES = -ltrbnet
+LOADLIBES = -ltrbnet -lm
 
 # ------------ TARGETS -------------------------------------------------
 
index 3c8df761951f6dfc671eab71a710680e79ae128d..b51def0e7e9fe1a4ad5829128785bfcefcc68cca 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "trbrpc.h"
 
-static const char trbnetd_version[] = "$Revision: 1.12 $";
+static const char trbnetd_version[] = "$Revision: 1.13 $";
 
 static int daemon_lock = 0;
 
@@ -437,6 +437,37 @@ bool_t register_modify_1_svc(uint16_t trb_address,
   return TRUE; 
 }
 
+bool_t nettrace_1_svc(uint16_t trb_address,
+                     u_int dsize,
+                     RetVal * retVal,
+                     struct svc_req * rqstp)
+{
+  int status;
+
+  /* allocate buffer memory */
+  retVal->data.Buffer_len = 0;
+  retVal->data.Buffer_val = (uint32_t *) malloc(sizeof(uint32_t) * dsize);
+  if (retVal->data.Buffer_val == NULL) {
+    fprintf(stderr, "nettrace: malloc failed\n");
+    retVal->status.trb_errno = TRB_RPC_ERROR;
+    retVal->status.retVal = -1;
+    return TRUE;
+  }
+
+  if (daemon_lock == 1) {
+    retVal->status.retVal = -128;
+    return TRUE;
+  }
+
+  status = trb_nettrace(trb_address,
+                       (uint32_t *) retVal->data.Buffer_val, dsize);
+  retVal->data.Buffer_len = status == -1 ? 0 : status;
+  retVal->status.retVal = status;
+  copyStatus(&retVal->status);
+
+  return TRUE;
+}
+
 extern void trbnetrpcprog_1(struct svc_req *rqstp, register SVCXPRT * transp);
 
 /* ------ MAIN ---------------------------------------------------------- */
index 8ce1236a2d033cf266262b4f7b28a4154abfad54..18a82769305eba6e11bdbd963964ad7dcb3985fa 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "trbnet.h"
 
-const char trbnet_version[] = "$Revision: 1.11 $  RPC";
+const char trbnet_version[] = "$Revision: 1.12 $  RPC";
 unsigned int trb_debug = 0;
 unsigned int trb_dma = 0;
 static CLIENT *trb_client = NULL;
@@ -542,3 +542,34 @@ int trb_register_modify(uint16_t trb_address,
   copyStatus(&retVal);
   return retVal.retVal;
 }
+
+int trb_nettrace(uint16_t trb_address,
+                uint32_t * data, unsigned int dsize)
+{
+  enum clnt_stat status;
+  RetVal retVal;
+  
+  if (trb_client == NULL) return -1;
+  do { 
+    retVal.data.Buffer_val = data;
+    retVal.data.Buffer_len = dsize;
+    status =
+      nettrace_1(trb_address, dsize,
+                 &retVal, trb_client);
+    
+    if (status != RPC_SUCCESS) {
+      /*
+       * An error occurred while calling the server.
+       * Print error message and stop.
+       */
+      trb_errno = status + 256;
+      return -1;
+    }
+    if (retVal.status.retVal != -128) break;
+    sleep(SLEEP_TIME);
+  } while (1);
+  
+  copyStatus(&retVal.status);
+  return retVal.status.retVal;
+}
+
index 2a406782f01ea48e088bae15d4a098426377da98..a4583f9efff1773703f70213708d3c8cb57791fb 100644 (file)
@@ -89,6 +89,10 @@ program TRBNETRPCPROG {
                            int,
                            uint32_t,
                            uint32_t) = 17;
+
+    RetVal NETTRACE(uint16_t, 
+                    unsigned int) = 18;
+
   } = 1;
 } = 0x20000099;
   
index 79be570c77672886d724449bd3e1f3ff96595fc0..20653251b762b7e53aa7fcb7cf2cd784cef2d249 100644 (file)
@@ -18,7 +18,7 @@ CFLAGS = -pipe -g -Wall  -Winline -O3 -fPIC -finline-functions -finline-limit=60
 LD = $(CC)
 LDFLAGS = 
 LIBDIR = -L../libtrbnet
-LOADLIBES = -ltrbnet
+LOADLIBES = -ltrbnet -lm
 
 # ------------ TARGETS -------------------------------------------------