From 193af441a127a0daabbd17c512e34817ddbcadfd Mon Sep 17 00:00:00 2001 From: Fritz Elfert Date: Sat, 16 Mar 2002 23:10:52 +0000 Subject: - ncpd now works with both Series 3 and Series 5 - ncpd now has autobaud feature (default on), which cycles baudrate - lib: added getSpeed() for retrieving current speed of connection - plpftp: Use getSpeed() - plpbackup: Ongoing work - configure stuff: removed several entries from acconfig.h comments now defined as 3rd arg to AC_DEFINE... --- lib/rfsv.cc | 16 ++++++++++++++++ lib/rfsv.h | 7 +++++++ lib/rfsv16.cc | 19 +++++++++++++++---- lib/rpcs.h | 4 ++-- lib/rpcs32.cc | 28 ++++++++++++++++++++++++---- lib/rpcs32.h | 4 ++-- 6 files changed, 66 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/rfsv.cc b/lib/rfsv.cc index 25bf91c..310d7c4 100644 --- a/lib/rfsv.cc +++ b/lib/rfsv.cc @@ -167,6 +167,22 @@ attr2String(const u_int32_t attr) return tmp; } +int rfsv:: +getSpeed() +{ + bufferStore a; + a.addStringT("NCP$GSPD"); + if (!skt->sendBufferStore(a)) + return -1; + if (skt->getBufferStore(a) != 1) + return -1; + if (a.getLen() != 5) + return -1; + if (a.getByte(0) != E_PSI_GEN_NONE) + return -1; + return a.getDWord(1); +} + /* * Local variables: * c-basic-offset: 4 diff --git a/lib/rfsv.h b/lib/rfsv.h index 2a445ef..312c1b8 100644 --- a/lib/rfsv.h +++ b/lib/rfsv.h @@ -600,6 +600,13 @@ public: */ static string convertSlash(const string &name); + /** + * Retrieve speed of serial link. + * + * @returns The speed of the serial link in baud or -1 on error. + */ + int getSpeed(); + protected: /** * Retrieves the PLP protocol name. Mainly internal use. diff --git a/lib/rfsv16.cc b/lib/rfsv16.cc index 2474060..773a5c1 100644 --- a/lib/rfsv16.cc +++ b/lib/rfsv16.cc @@ -222,10 +222,21 @@ fgetmtime(const char * const name, PsiTime &mtime) Enum rfsv16:: fsetmtime(const char *name, PsiTime mtime) { - cerr << "rfsv16::fsetmtime ***" << endl; - // I don't think there's a protocol frame that allows us to set the - // modification time. SFDATE allows setting of creation time... - return E_PSI_NOT_SIBO; + // According to Alexander's protocol doc, SFDATE sets the modification + // time - and as far as I can see SIBO only keeps a modification + // time. So call SFDATE here. + bufferStore a; + string realName = convertSlash(name); + a.addDWord(mtime.getTime()); + a.addStringT(realName.c_str()); + // and this needs sending in the length word. + if (!sendCommand(SFDATE, a)) + return E_PSI_FILE_DISC; + + Enum res = getResponse(a); + if (res != E_PSI_GEN_NONE) + cerr << "fsetmtime: Error " << res << " on file " << name << endl; + return res; } Enum rfsv16:: diff --git a/lib/rpcs.h b/lib/rpcs.h index 2b40fa9..5a64013 100644 --- a/lib/rpcs.h +++ b/lib/rpcs.h @@ -338,8 +338,8 @@ public: */ virtual Enum getMachineInfo(machineInfo &) { return rfsv::E_PSI_NOT_SIBO;} virtual Enum closeHandle(int) { return rfsv::E_PSI_NOT_SIBO;} - virtual Enum regOpenIter(void) { return rfsv::E_PSI_NOT_SIBO;} - virtual Enum regReadIter(void) { return rfsv::E_PSI_NOT_SIBO;} + virtual Enum regOpenIter(u_int32_t, char *, u_int16_t &) { return rfsv::E_PSI_NOT_SIBO;} + virtual Enum regReadIter(u_int16_t) { return rfsv::E_PSI_NOT_SIBO;} virtual Enum regWrite(void) { return rfsv::E_PSI_NOT_SIBO;} virtual Enum regRead(void) { return rfsv::E_PSI_NOT_SIBO;} virtual Enum regDelete(void) { return rfsv::E_PSI_NOT_SIBO;} diff --git a/lib/rpcs32.cc b/lib/rpcs32.cc index 38d7933..ebb4f9c 100644 --- a/lib/rpcs32.cc +++ b/lib/rpcs32.cc @@ -169,18 +169,38 @@ getMachineInfo(machineInfo &mi) static unsigned long hhh; Enum rpcs32:: -regOpenIter(void) +regOpenIter(u_int32_t uid, char *match, u_int16_t &handle) { bufferStore a; Enum res; - a.addStringT("HKLM\\"); + cout << "Oiter" << endl; + a.addDWord(uid); + a.addDWord(strlen(match)); + a.addStringT(match); if (!sendCommand(rpcs::REG_OPEN_ITER, a)) return rfsv::E_PSI_FILE_DISC; res = getResponse(a, true); cout << "ro: r=" << res << " a=" << a << endl; - if (a.getLen() > 0) - hhh = a.getDWord(0); + if (a.getLen() == 2) + handle = a.getWord(0); + return rfsv::E_PSI_GEN_NONE; +} + +Enum rpcs32:: +regReadIter(u_int16_t handle) +{ + bufferStore a; + Enum res; + + cout << "Riter" << endl; + a.addWord(handle); + if (!sendCommand(rpcs::REG_READ_ITER, a)) + return rfsv::E_PSI_FILE_DISC; + res = getResponse(a, true); + cout << "ro: r=" << res << " a=" << a << endl; + if ((a.getLen() == 3) && (a.getByte(2) == 0xff)) + return rfsv::E_PSI_FILE_EOF; return rfsv::E_PSI_GEN_NONE; } diff --git a/lib/rpcs32.h b/lib/rpcs32.h index 0256b66..70644da 100644 --- a/lib/rpcs32.h +++ b/lib/rpcs32.h @@ -48,9 +48,9 @@ class rpcs32 : public rpcs { #if 0 Enum closeHandle(int); #endif - Enum regOpenIter(void); + Enum regOpenIter(u_int32_t uid, char *match, u_int16_t &handle); + Enum regReadIter(u_int16_t handle); #if 0 - Enum regReadIter(void); Enum regWrite(void); Enum regRead(void); Enum regDelete(void); -- cgit v1.2.3