Index: trunk/Nebulous/nebclient/src/nebclient.c
===================================================================
--- trunk/Nebulous/nebclient/src/nebclient.c	(revision 4506)
+++ trunk/Nebulous/nebclient/src/nebclient.c	(revision 4507)
@@ -4,5 +4,5 @@
  * Copyright (C) 2005  Joshua Hoblitt
  *
- * $Id: nebclient.c,v 1.12 2005-07-07 22:47:40 jhoblitt Exp $
+ * $Id: nebclient.c,v 1.13 2005-07-07 22:57:40 jhoblitt Exp $
  */
 
@@ -27,5 +27,5 @@
 static bool nebSetErr(nebServer *server, const char *format, ...);
 static bool nebSetServerErr(nebServer *server);
-static off_t nebCopyFile(char *source, char *dest);
+static off_t nebCopyFile(const char *source, const char *dest);
 static off_t nebCopyFilehandle(int sourceFH, int destFH);
 static int nebParseURI(const char *URI, char **filename);
@@ -56,5 +56,5 @@
 }
 
-int nebCreate(nebServer *server, char *key, unsigned int class, char *volume, char *comment, char **URI)
+int nebCreate(nebServer *server, const char *key, unsigned int class, const char *volume, const char *comment, char **URI)
 {
     struct ns1__create_USCOREobjectResponse response;
@@ -62,5 +62,5 @@
     int             file;
 
-    if (soap_call_ns1__create_USCOREobject(server->soap, NULL, NULL, key, class, volume, comment, (char **)&response) == SOAP_OK) {
+    if (soap_call_ns1__create_USCOREobject(server->soap, NULL, NULL, (char *)key, class, (char *)volume, (char *)comment, (char **)&response) == SOAP_OK) {
         *URI = xmalloc(strlen((char *)response.result));
         strcpy(*URI, (char *)response.result);
@@ -170,5 +170,5 @@
 }
 
-int nebLock(nebServer *server, char *key, rw flag )
+int nebLock(nebServer *server, const char *key, rw flag)
 {
 
@@ -176,5 +176,5 @@
 }
 
-int nebUnlock(nebServer *server, char *key, rw flag )
+int nebUnlock(nebServer *server, const char *key, rw flag)
 {
 
@@ -182,5 +182,5 @@
 }
 
-int nebFindInstances(nebServer *server, char *key, char *volume, char ***locations)
+int nebFindInstances(nebServer *server, const char *key, const char *volume, char ***locations)
 {
     struct ns1__find_USCOREinstancesResponse response;
@@ -191,5 +191,5 @@
 
     // FIXME is this leaking memory when response goes out of scope?
-    if (soap_call_ns1__find_USCOREinstances(server->soap, NULL, NULL, key, volume, &response) == SOAP_OK) {
+    if (soap_call_ns1__find_USCOREinstances(server->soap, NULL, NULL, (char *)key, (char *)volume, &response) == SOAP_OK) {
 
         resultElements = response.result->__size;
@@ -213,5 +213,5 @@
 }
 
-int nebFind(nebServer *server, char *key )
+int nebFind(nebServer *server, const char *key)
 {
 
@@ -283,5 +283,5 @@
 }
 
-int nebCopy(nebServer *server, char *key, char *newKey )
+int nebCopy(nebServer *server, const char *key, const char *newKey)
 {
 
@@ -289,5 +289,5 @@
 }
 
-int nebMove(nebServer *server, char *key, char *newKey )
+int nebMove(nebServer *server, const char *key, const char *newKey)
 {
 
@@ -324,5 +324,5 @@
 }
 
-int nebStat(nebServer *server, char *key )
+int nebStat(nebServer *server, const char *key)
 {
 
@@ -333,4 +333,8 @@
 {
     return server->err_buf;
+}
+
+void nebFree(void *ptr) {
+    xfree(ptr);
 }
 
@@ -374,4 +378,94 @@
 
     return nebSetErr(server, "%s - %s", *code, *string);
+}
+
+static off_t nebCopyFile(const char *source, const char *dest)
+{
+    int             sourceFH;
+    int             destFH; 
+    off_t           bytesCopied;
+
+    sourceFH = open(source, O_RDONLY);
+    if (sourceFH == -1) {
+        fprintf(stderr, "can not open %s: %s\n", source, strerror(errno));
+
+        return -1;
+    }
+
+    destFH = open(dest, O_WRONLY|O_CREAT|O_CREAT, 0600);
+    if (destFH == -1) {
+        fprintf(stderr, "can not open %s: %s\n", dest, strerror(errno));
+
+        return -1;
+    }
+
+    bytesCopied = nebCopyFilehandle(sourceFH, destFH);
+    if (bytesCopied < 0) {
+        return -1;
+    }
+
+    if (close(sourceFH) == -1) {
+        fprintf(stderr, "can not close %s: %s", source, strerror(errno));
+
+        return -1;
+    }
+
+    if (close(destFH) == -1) {
+        fprintf(stderr, "can not close %s: %s", dest, strerror(errno));
+
+        return -1;
+    }
+
+    return bytesCopied;
+}
+
+static off_t nebCopyFilehandle(int sourceFH, int destFH)
+{
+    off_t           bytesTotal;
+    off_t           bytesRemaining;
+    off_t           writeSize;
+    char            writeBuf[64 * 1024];
+    struct stat     sourceStat;
+
+    if(fstat(sourceFH, &sourceStat)) {
+        fprintf(stderr, "can not stat filehandles: %s\n", strerror(errno));
+
+        return -1;
+    }
+
+    // the size of the file to copied
+    bytesTotal = sourceStat.st_size;
+
+    /*
+     * If the file size is <= the buffer size call write(2) with the
+     * file size.  If the file size is > the buffer call write with the
+     * buffer size and loop until file size <= buffer size is true.
+    */
+
+    bytesRemaining = bytesTotal;
+
+    while (bytesRemaining) {
+        if (bytesRemaining <= sizeof(writeBuf)) {
+            writeSize = bytesRemaining;
+        } else {
+            writeSize = sizeof(writeBuf);
+        }
+
+        if (read(sourceFH, writeBuf, writeSize) != writeSize) {
+            fprintf(stderr, "can not read filehandle: %s", strerror(errno));
+
+            return -1;
+        }
+
+        if (write(destFH, writeBuf, writeSize) != writeSize) {
+            fprintf(stderr, "can not write filehandles: %s", strerror(errno));
+
+            return -1;
+        }
+
+        bytesRemaining -= writeSize;
+    }
+
+    return bytesTotal;
 }
 
@@ -423,98 +517,4 @@
 }
 
-void nebFree(void *ptr) {
-    xfree(ptr);
-}
-
-static off_t nebCopyFile(char *source, char *dest)
-{
-    int             sourceFH;
-    int             destFH; 
-    off_t           bytesCopied;
-
-    sourceFH = open(source, O_RDONLY);
-    if (sourceFH == -1) {
-        fprintf(stderr, "can not open %s: %s\n", source, strerror(errno));
-
-        return -1;
-    }
-
-    destFH = open(dest, O_WRONLY|O_CREAT|O_CREAT, 0600);
-    if (destFH == -1) {
-        fprintf(stderr, "can not open %s: %s\n", dest, strerror(errno));
-
-        return -1;
-    }
-
-    bytesCopied = nebCopyFilehandle(sourceFH, destFH);
-    if (bytesCopied < 0) {
-        return -1;
-    }
-
-    if (close(sourceFH) == -1) {
-        fprintf(stderr, "can not close %s: %s", source, strerror(errno));
-
-        return -1;
-    }
-
-    if (close(destFH) == -1) {
-        fprintf(stderr, "can not close %s: %s", dest, strerror(errno));
-
-        return -1;
-    }
-
-    return bytesCopied;
-}
-
-static off_t nebCopyFilehandle(int sourceFH, int destFH)
-{
-    off_t           bytesTotal;
-    off_t           bytesRemaining;
-    off_t           writeSize;
-    char            writeBuf[64 * 1024];
-    struct stat     sourceStat;
-
-    if(fstat(sourceFH, &sourceStat)) {
-        fprintf(stderr, "can not stat filehandles: %s\n", strerror(errno));
-
-        return -1;
-    }
-
-    // the size of the file to copied
-    bytesTotal = sourceStat.st_size;
-
-    /*
-     * If the file size is <= the buffer size call write(2) with the
-     * file size.  If the file size is > the buffer call write with the
-     * buffer size and loop until file size <= buffer size is true.
-    */
-
-    bytesRemaining = bytesTotal;
-
-    while (bytesRemaining) {
-        if (bytesRemaining <= sizeof(writeBuf)) {
-            writeSize = bytesRemaining;
-        } else {
-            writeSize = sizeof(writeBuf);
-        }
-
-        if (read(sourceFH, writeBuf, writeSize) != writeSize) {
-            fprintf(stderr, "can not read filehandle: %s", strerror(errno));
-
-            return -1;
-        }
-
-        if (write(destFH, writeBuf, writeSize) != writeSize) {
-            fprintf(stderr, "can not write filehandles: %s", strerror(errno));
-
-            return -1;
-        }
-
-        bytesRemaining -= writeSize;
-    }
-
-    return bytesTotal;
-}
-
 static bool nebNukeFile(const char *filename)
 {
Index: trunk/Nebulous/nebclient/src/nebclient.h
===================================================================
--- trunk/Nebulous/nebclient/src/nebclient.h	(revision 4506)
+++ trunk/Nebulous/nebclient/src/nebclient.h	(revision 4507)
@@ -4,5 +4,5 @@
  * Copyright (C) 2005  Joshua Hoblitt
  *
- * $Id: nebclient.h,v 1.14 2005-07-07 22:47:40 jhoblitt Exp $
+ * $Id: nebclient.h,v 1.15 2005-07-07 22:57:40 jhoblitt Exp $
  */
 
@@ -14,4 +14,5 @@
 
 typedef enum { NEB_READ, NEB_WRITE } rw;
+
 typedef struct {
     struct soap     *soap;
@@ -20,10 +21,9 @@
 }nebServer;
 
-//void nebServerInit(nebServer *server);
 nebServer *nebServerAlloc(void);
 
 void nebServerCleanup(nebServer *server);
 
-int nebCreate(nebServer *server, char *key, unsigned int class, char *volume, char *comment, char **URI);
+int nebCreate(nebServer *server, const char *key, unsigned int class, const char *volume, const char *comment, char **URI);
 
 bool nebReplicate(nebServer *server, const char *key, const char *volume, char **URI);
@@ -31,11 +31,11 @@
 bool nebCull(nebServer *server, const char *key);
 
-int nebLock(nebServer *server, char *key, rw flag);
+int nebLock(nebServer *server, const char *key, rw flag);
 
-int nebUnlock(nebServer *server, char *key, rw flag);
+int nebUnlock(nebServer *server, const char *key, rw flag);
 
-int nebFindInstances(nebServer *server, char *key, char *volume, char ***locations);
+int nebFindInstances(nebServer *server, const char *key, const char *volume, char ***locations);
 
-int nebFind(nebServer *server, char *key);
+int nebFind(nebServer *server, const char *key);
 
 int nebOpen(nebServer *server, const char *key, rw flag);
@@ -43,11 +43,11 @@
 bool nebDelete(nebServer *server, const char *key);
 
-int nebCopy(nebServer *server, char *key, char *newKey);
+int nebCopy(nebServer *server, const char *key, const char *newKey);
 
-int nebMove(nebServer *server, char *key, char *newKey);
+int nebMove(nebServer *server, const char *key, const char *newKey);
 
 bool nebDeleteInstance(nebServer *server, const char *URI);
 
-int nebStat(nebServer *server, char *key);
+int nebStat(nebServer *server, const char *key);
 
 char *nebErr(nebServer *server);
