aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>2002-03-20 02:18:51 +0000
committerFritz Elfert <felfert@to.com>2002-03-20 02:18:51 +0000
commit1d9b2e0e156f9a58bd642b9f9e8b2a08e768f5ed (patch)
tree580f6fa06ce0d114f3861c709203af4c3d86237a /lib
parentbedd0177bc1ec1bf3c425e034958209554c20171 (diff)
downloadplptools-1d9b2e0e156f9a58bd642b9f9e8b2a08e768f5ed.tar.gz
plptools-1d9b2e0e156f9a58bd642b9f9e8b2a08e768f5ed.tar.bz2
plptools-1d9b2e0e156f9a58bd642b9f9e8b2a08e768f5ed.zip
- rpcs: Implemented scratch RAM access.
- Updated spec file (not complete) - Updated KDE translations - kioslave and property-dialog now translate correctly - ppsocket: Added a patch for FreeBSD - plpftp: Some experimental code for testing
Diffstat (limited to 'lib')
-rw-r--r--lib/plpintl.h4
-rw-r--r--lib/ppsocket.cc7
-rw-r--r--lib/rpcs.h98
-rw-r--r--lib/rpcs32.cc72
-rw-r--r--lib/rpcs32.h15
5 files changed, 156 insertions, 40 deletions
diff --git a/lib/plpintl.h b/lib/plpintl.h
index 79f3359..e28fde0 100644
--- a/lib/plpintl.h
+++ b/lib/plpintl.h
@@ -20,8 +20,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-#ifndef _INTL_H_
-#define _INTL_H_
+#ifndef _PLPINTL_H_
+#define _PLPINTL_H_
#ifdef HAVE_CONFIG_H
#include <config.h>
diff --git a/lib/ppsocket.cc b/lib/ppsocket.cc
index 8f52988..0053436 100644
--- a/lib/ppsocket.cc
+++ b/lib/ppsocket.cc
@@ -204,6 +204,13 @@ accept(string *Peer, IOWatch *iow)
#ifdef sun
int len;
#else
+# ifdef __FreeBSD__
+# if __FreeBSD_version >= 400000
+ socklen_t len;
+# else
+ unsigned len;
+# endif
+# endif
socklen_t len;
#endif
ppsocket *accepted;
diff --git a/lib/rpcs.h b/lib/rpcs.h
index 9c77656..2cb276a 100644
--- a/lib/rpcs.h
+++ b/lib/rpcs.h
@@ -350,22 +350,72 @@ public:
* machines, returns always an error code E_PSI_NOT_SIBO.
*
* @param machineInfo The struct holding all information on return.
- * @return Psion error code. 0 = Ok.
+ *
+ * @returns Psion error code. 0 = Ok.
*/
virtual Enum<rfsv::errs> getMachineInfo(machineInfo &) { return rfsv::E_PSI_NOT_SIBO;}
- virtual Enum<rfsv::errs> closeHandle(int) { return rfsv::E_PSI_NOT_SIBO;}
- virtual Enum<rfsv::errs> regOpenIter(u_int32_t, char *, u_int16_t &) { return rfsv::E_PSI_NOT_SIBO;}
- virtual Enum<rfsv::errs> regReadIter(u_int16_t) { return rfsv::E_PSI_NOT_SIBO;}
- virtual Enum<rfsv::errs> regWrite(void) { return rfsv::E_PSI_NOT_SIBO;}
- virtual Enum<rfsv::errs> regRead(void) { return rfsv::E_PSI_NOT_SIBO;}
- virtual Enum<rfsv::errs> regDelete(void) { return rfsv::E_PSI_NOT_SIBO;}
- virtual Enum<rfsv::errs> setTime(void) { return rfsv::E_PSI_NOT_SIBO;}
- virtual Enum<rfsv::errs> configOpen(void) { return rfsv::E_PSI_NOT_SIBO;}
- virtual Enum<rfsv::errs> configRead(void) { return rfsv::E_PSI_NOT_SIBO;}
- virtual Enum<rfsv::errs> configWrite(void) { return rfsv::E_PSI_NOT_SIBO;}
- virtual Enum<rfsv::errs> queryOpen(void) { return rfsv::E_PSI_NOT_SIBO;}
- virtual Enum<rfsv::errs> queryRead(void) { return rfsv::E_PSI_NOT_SIBO;}
+ /**
+ * Release an rpcs handle.
+ *
+ * This function works with EPOC only. Using it with SIBO
+ * machines, returns always an error code E_PSI_NOT_SIBO.
+ * It releases a handle, obtained by a previous call to
+ * @ref rpcs::configOpen .
+ *
+ * @param handle The handle to close.
+ *
+ * @returns A psion error code. 0 = Ok.
+ */
+ virtual Enum<rfsv::errs> closeHandle(u_int32_t handle)
+ { return rfsv::E_PSI_NOT_SIBO; }
+
+ virtual Enum<rfsv::errs> regOpenIter(u_int32_t, char *, u_int16_t &)
+ { return rfsv::E_PSI_NOT_SIBO;}
+ virtual Enum<rfsv::errs> regReadIter(u_int16_t)
+ { return rfsv::E_PSI_NOT_SIBO;}
+ virtual Enum<rfsv::errs> regWrite(void)
+ { return rfsv::E_PSI_NOT_SIBO;}
+ virtual Enum<rfsv::errs> regRead(void)
+ { return rfsv::E_PSI_NOT_SIBO;}
+ virtual Enum<rfsv::errs> regDelete(void)
+ { return rfsv::E_PSI_NOT_SIBO;}
+ virtual Enum<rfsv::errs> setTime(void)
+ { return rfsv::E_PSI_NOT_SIBO;}
+
+ /**
+ * Read from Series 5 scratch RAM
+ *
+ * This function works with EPOC only. Using it with SIBO
+ * machines, returns always an error code E_PSI_NOT_SIBO.
+ * It reads raw data from the scatch RAM of the Series 5.
+ *
+ * @param size The amount of data to me read.
+ * @param data The content of the scratch RAM is returned here.
+ *
+ * @returns A psion error code. 0 = Ok.
+ */
+ virtual Enum<rfsv::errs> configRead(u_int32_t size, bufferStore &data)
+ { return rfsv::E_PSI_NOT_SIBO; }
+
+ /**
+ * Write to Series 5 scratch RAM
+ *
+ * This function works with EPOC only. Using it with SIBO
+ * machines, returns always an error code E_PSI_NOT_SIBO.
+ * It writes raw data to the scatch RAM of the Series 5.
+ *
+ * @param data The data to be written to the scratch RAM.
+ *
+ * @returns A psion error code. 0 = Ok.
+ */
+ virtual Enum<rfsv::errs> configWrite(bufferStore data)
+ { return rfsv::E_PSI_NOT_SIBO;}
+
+ virtual Enum<rfsv::errs> queryOpen(void)
+ { return rfsv::E_PSI_NOT_SIBO;}
+ virtual Enum<rfsv::errs> queryRead(void)
+ { return rfsv::E_PSI_NOT_SIBO;}
protected:
/**
@@ -396,6 +446,7 @@ protected:
GET_CMDLINE = 0x0a,
FUSER = 0x0b,
GET_MACHINE_INFO = 0x64,
+ CLOSE_HANDLE = 0x65,
REG_OPEN_ITER = 0x66,
REG_READ_ITER = 0x67,
REG_WRITE = 0x68,
@@ -416,6 +467,27 @@ protected:
*/
int mtCacheS5mx;
+ /**
+ * Prepare scratch RAM in Series 5 for read/write
+ *
+ * This function works with EPOC only. Using it with SIBO
+ * machines, returns always an error code E_PSI_NOT_SIBO.
+ * It prepares a scratch area on the EPOC machine for a following
+ * use from within @ref rpcs::configRead or @ref rpcs::configWrite .
+ * These functions call @ref rpcs::closeHandle on exit. The contents
+ * of the scratch area is stored in RAM of the Series 5, therefore it
+ * gets lost when the Series 5 is switched off.
+ *
+ * @param handle The handle to be used in @ref rpcs::configRead ,
+ * @ref rpcs::configWrite and @ref rpcs::closeHandle is
+ * returned here.
+ * @param size The number of bytes you want to use.
+ *
+ * @returns A psion error code. 0 = Ok.
+ */
+ virtual Enum<rfsv::errs> configOpen(u_int16_t &handle, u_int32_t size)
+ { return rfsv::E_PSI_NOT_SIBO; }
+
/**
* Sends a command to the remote side.
*
diff --git a/lib/rpcs32.cc b/lib/rpcs32.cc
index 64ac5b4..b1cbe49 100644
--- a/lib/rpcs32.cc
+++ b/lib/rpcs32.cc
@@ -169,45 +169,83 @@ regReadIter(u_int16_t handle)
}
Enum<rfsv::errs> rpcs32::
-configOpen(void)
+configOpen(u_int16_t &handle, u_int32_t size)
{
bufferStore a;
Enum<rfsv::errs> res;
+ a.addDWord(size);
if (!sendCommand(rpcs::CONFIG_OPEN, a))
return rfsv::E_PSI_FILE_DISC;
res = getResponse(a, true);
- cout << "co: r=" << res << " a=" << a << endl;
- if (a.getLen() > 0)
- hhh = a.getDWord(0);
- return rfsv::E_PSI_GEN_NONE;
+ if (res == rfsv::E_PSI_GEN_NONE && (a.getLen() >= 2))
+ handle = a.getWord(0);
+ return res;
}
Enum<rfsv::errs> rpcs32::
-configRead(void)
+configRead(u_int32_t size, bufferStore &ret)
{
bufferStore a;
+ u_int16_t handle;
Enum<rfsv::errs> res;
- int l;
- FILE *f;
- f = fopen("blah", "w");
+ ret.init();
+ if ((res = configOpen(handle, size)) != rfsv::E_PSI_GEN_NONE)
+ return res;
do {
a.init();
- a.addDWord(hhh);
+ a.addWord(handle);
+ a.addDWord(2047);
if (!sendCommand(rpcs::CONFIG_READ, a))
return rfsv::E_PSI_FILE_DISC;
- if ((res = getResponse(a, true)) != rfsv::E_PSI_GEN_NONE)
+ if ((res = getResponse(a, true)) != rfsv::E_PSI_GEN_NONE) {
+ closeHandle(handle);
+ return res;
+ }
+ if (a.getLen() > 0)
+ ret.addBuff(a);
+ } while (a.getLen() > 0);
+ return rfsv::E_PSI_GEN_NONE;
+}
+
+Enum<rfsv::errs> rpcs32::
+configWrite(bufferStore data)
+{
+ bufferStore a;
+ u_int16_t handle;
+ Enum<rfsv::errs> res;
+
+ return rfsv::E_PSI_GEN_NONE;
+ if ((res = configOpen(handle, data.getLen())) != rfsv::E_PSI_GEN_NONE)
+ return res;
+ do {
+ a.init();
+ long l = (data.getLen() > 2047) ? 2047 : data.getLen();
+ a.addWord(handle);
+ a.addBuff(data, l);
+ data.discardFirstBytes(l);
+ if (!sendCommand(rpcs::CONFIG_WRITE, a))
+ return rfsv::E_PSI_FILE_DISC;
+ if ((res = getResponse(a, true)) != rfsv::E_PSI_GEN_NONE) {
+ closeHandle(handle);
return res;
- l = a.getLen();
- cout << "cr: " << l << endl;
- fwrite(a.getString(0), 1, l, f);
- } while (l > 0);
- fclose(f);
-//cout << "cr: r=" << res << " a=" << a << endl;
+ }
+ } while (data.getLen() > 0);
return rfsv::E_PSI_GEN_NONE;
}
+Enum<rfsv::errs> rpcs32::
+closeHandle(u_int16_t handle)
+{
+ bufferStore a;
+
+ a.addWord(handle);
+ if (!sendCommand(rpcs::CLOSE_HANDLE, a))
+ return rfsv::E_PSI_FILE_DISC;
+ return getResponse(a, true);
+}
+
/*
* Local variables:
* c-basic-offset: 4
diff --git a/lib/rpcs32.h b/lib/rpcs32.h
index 9fc9ebb..5adf829 100644
--- a/lib/rpcs32.h
+++ b/lib/rpcs32.h
@@ -42,11 +42,9 @@ class rpcs32 : public rpcs {
public:
Enum<rfsv::errs> getCmdLine(const char *, string &);
Enum<rfsv::errs> getMachineInfo(machineInfo &);
- Enum<rfsv::errs> configOpen(void);
- Enum<rfsv::errs> configRead(void);
-#if 0
- Enum<rfsv::errs> closeHandle(int);
-#endif
+ Enum<rfsv::errs> configRead(u_int32_t, bufferStore &);
+ Enum<rfsv::errs> configWrite(bufferStore);
+ Enum<rfsv::errs> closeHandle(u_int16_t);
Enum<rfsv::errs> regOpenIter(u_int32_t uid, char *match, u_int16_t &handle);
Enum<rfsv::errs> regReadIter(u_int16_t handle);
#if 0
@@ -54,13 +52,14 @@ class rpcs32 : public rpcs {
Enum<rfsv::errs> regRead(void);
Enum<rfsv::errs> regDelete(void);
Enum<rfsv::errs> setTime(void);
- Enum<rfsv::errs> configOpen(void);
- Enum<rfsv::errs> configRead(void);
- Enum<rfsv::errs> configWrite(void);
Enum<rfsv::errs> queryOpen(void);
Enum<rfsv::errs> queryRead(void);
Enum<rfsv::errs> quitServer(void);
#endif
+
+protected:
+ Enum<rfsv::errs> configOpen(u_int16_t &, u_int32_t);
+
private:
rpcs32(ppsocket *);
};