Added SFTMsgReader and SFTMsgWriter classes to the rfb project.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@462 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfb/SFTMsgReader.cxx b/rfb/SFTMsgReader.cxx
new file mode 100644
index 0000000..2ff437b
--- /dev/null
+++ b/rfb/SFTMsgReader.cxx
@@ -0,0 +1,104 @@
+/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
+ *    
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This software 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 General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ *
+ * TightVNC distribution homepage on the Web: http://www.tightvnc.com/
+ *
+ */
+
+// -=- SFTMsgReader.cxx
+
+#include <rfb/SFTMsgReader.h>
+
+using namespace rfb;
+
+SFTMsgReader::SFTMsgReader(rdr::InStream *pIS)
+{
+  m_pIS = pIS;
+}
+
+SFTMsgReader::~SFTMsgReader()
+{
+}
+    
+bool 
+SFTMsgReader::readFileListRqst(unsigned int *pDirNameSize, char *pDirName, 
+                               unsigned int *pFlags, bool *bDirOnly)
+{
+  return false;
+}
+    
+bool 
+SFTMsgReader::readFileDownloadRqst(unsigned int *pFilenameSize, char *pFilename, 
+                                   unsigned int *pPosition)
+{
+  return false;
+}
+
+bool 
+SFTMsgReader::readFileUploadRqst(unsigned int *pFilenameSize, char *pFilename, 
+                                 unsigned int *pPosition)
+{
+  return false;
+}
+    
+void *
+SFTMsgReader::readFileUploadData(unsigned int *pDataSize, unsigned int *pModTime)
+{
+  return NULL;
+}
+    
+bool 
+SFTMsgReader::readFileCreateDirRqst(unsigned int *pDirNameSize, char *pDirName)
+{
+  return false;
+}
+
+bool 
+SFTMsgReader::readFileDirSizeRqst(unsigned int *pDirNameSize, char *pDirName)
+{
+  return false;
+}
+
+bool 
+SFTMsgReader::readFileDeleteRqst(unsigned int *pNameSize, char *pName)
+{
+  return false;
+}
+    
+bool readFileRenameRqst(unsigned int *pOldNameSize, unsigned int *pNewNameSize,
+                        char *pOldName, char *pNewName)
+{
+  return false;
+}
+
+char *
+SFTMsgReader::readFileDownloadCancel(unsigned int *pReasonSize)
+{
+  return NULL;
+}
+
+char *
+SFTMsgReader::readFileUploadFailed(unsigned int *pReasonSize)
+{
+  return NULL;
+}
+
+bool 
+SFTMsgReader::readU8U16StringMsg(unsigned int *pReasonSize, char *pReason)
+{
+  return false;
+}
diff --git a/rfb/SFTMsgReader.h b/rfb/SFTMsgReader.h
new file mode 100644
index 0000000..d253645
--- /dev/null
+++ b/rfb/SFTMsgReader.h
@@ -0,0 +1,66 @@
+/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
+ *    
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This software 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 General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ *
+ * TightVNC distribution homepage on the Web: http://www.tightvnc.com/
+ *
+ */
+
+// -=- SFTMsgReader.h
+
+#ifndef __RFB_SFTMSGREADER_H__
+#define __RFB_SFTMSGREADER_H__
+
+#include <rdr/InStream.h>
+
+namespace rfb {
+  class SFTMsgReader
+  {
+  public:
+    SFTMsgReader(rdr::InStream *pIS);
+    ~SFTMsgReader();
+    
+    bool readFileListRqst(unsigned int *pDirNameSize, char *pDirName, 
+                          unsigned int *pFlags, bool *bDirOnly);
+    
+    
+    bool readFileDownloadRqst(unsigned int *pFilenameSize, char *pFilename, 
+                              unsigned int *pPosition);
+
+    bool readFileUploadRqst(unsigned int *pFilenameSize, char *pFilename, 
+                            unsigned int *pPosition);
+    
+    void *readFileUploadData(unsigned int *pDataSize, unsigned int *pModTime);
+
+    
+    bool readFileCreateDirRqst(unsigned int *pDirNameSize, char *pDirName);
+    bool readFileDirSizeRqst(unsigned int *pDirNameSize, char *pDirName);
+    bool readFileDeleteRqst(unsigned int *pNameSize, char *pName);
+    
+    bool readFileRenameRqst(unsigned int *pOldNameSize, unsigned int *pNewNameSize,
+                            char *pOldName, char *pNewName);
+
+    char *readFileDownloadCancel(unsigned int *pReasonSize);
+    char *readFileUploadFailed(unsigned int *pReasonSize);
+
+  private:
+    rdr::InStream *m_pIS;
+
+    bool readU8U16StringMsg(unsigned int *pReasonSize, char *pReason);
+  };
+}
+
+#endif // __RFB_SFTMSGREADER_H__
diff --git a/rfb/SFTMsgWriter.cxx b/rfb/SFTMsgWriter.cxx
new file mode 100644
index 0000000..e74775e
--- /dev/null
+++ b/rfb/SFTMsgWriter.cxx
@@ -0,0 +1,86 @@
+/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
+ *    
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This software 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 General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ *
+ * TightVNC distribution homepage on the Web: http://www.tightvnc.com/
+ *
+ */
+
+// -=- SFTMsgWriter.cxx
+
+#include <rfb/SFTMsgWriter.h>
+
+using namespace rfb;
+
+SFTMsgWriter::SFTMsgWriter(rdr::OutStream *pOS)
+{
+  m_pOS = pOS;
+}
+
+SFTMsgWriter::~SFTMsgWriter()
+{
+}
+    
+bool 
+SFTMsgWriter::writeFileListData(unsigned char flags, rfb::FileInfo *pFileInfo)
+{
+  return false;
+}
+
+bool 
+SFTMsgWriter::writeFileDownloadData(unsigned int dataSize, void *pData)
+{
+  return false;
+}
+
+bool 
+SFTMsgWriter::writeFileDownloadData(unsigned int modTime)
+{
+  return false;
+}
+
+bool
+SFTMsgWriter::writeFileUploadCancel(unsigned int reasonLen, char *pReason)
+{
+  return false;
+}
+
+bool 
+SFTMsgWriter::writeFileDownloadFailed(unsigned int reasonLen, char *pReason)
+{
+  return false;
+}
+
+bool 
+SFTMsgWriter::writeFileDirSizeData(unsigned int dirSizeLow, 
+                                   unsigned short dirSizeHigh)
+{
+  return false;
+}
+
+bool 
+SFTMsgWriter::writeFileLastRqstFailed(unsigned char lastRequest, 
+                                      unsigned short reasonLen,
+                                      char *pReason)
+{
+  return false;
+}
+
+bool
+SFTMsgWriter::writeU8U16StringMsg(unsigned char p1, unsigned short p2, char *pP3)
+{
+  return false;
+}
diff --git a/rfb/SFTMsgWriter.h b/rfb/SFTMsgWriter.h
new file mode 100644
index 0000000..ba5bf1c
--- /dev/null
+++ b/rfb/SFTMsgWriter.h
@@ -0,0 +1,53 @@
+/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
+ *    
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This software 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 General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ *
+ * TightVNC distribution homepage on the Web: http://www.tightvnc.com/
+ *
+ */
+
+// -=- SFTMsgWriter.h
+
+#ifndef __RFB_SFTMSGWRITER_H__
+#define __RFB_SFTMSGWRITER_H__
+
+#include <rdr/OutStream.h>
+#include <rfb/FileInfo.h>
+
+namespace rfb {
+  class SFTMsgWriter
+  {
+  public:
+    SFTMsgWriter(rdr::OutStream *pOS);
+    ~SFTMsgWriter();
+    
+    bool writeFileListData(unsigned char flags, rfb::FileInfo *pFileInfo);
+    bool writeFileDownloadData(unsigned int dataSize, void *pData);
+    bool writeFileDownloadData(unsigned int modTime);
+    bool writeFileUploadCancel(unsigned int reasonLen, char *pReason);
+    bool writeFileDownloadFailed(unsigned int reasonLen, char *pReason);
+    bool writeFileDirSizeData(unsigned int dirSizeLow, unsigned short dirSizeHigh);
+    bool writeFileLastRqstFailed(unsigned char lastRequest, unsigned short reasonLen, 
+                                 char *pReason);
+
+  private:
+    rdr::OutStream *m_pOS;
+
+    bool writeU8U16StringMsg(unsigned char p1, unsigned short p2, char *pP3);
+  };
+}
+
+#endif // __RFB_SFTMSGWRITER_H__
diff --git a/rfb/rfb.dsp b/rfb/rfb.dsp
index 15f75af..42da641 100644
--- a/rfb/rfb.dsp
+++ b/rfb/rfb.dsp
@@ -262,6 +262,14 @@
 # End Source File

 # Begin Source File

 

+SOURCE=.\SFTMsgReader.cxx

+# End Source File

+# Begin Source File

+

+SOURCE=.\SFTMsgWriter.cxx

+# End Source File

+# Begin Source File

+

 SOURCE=.\SMsgHandler.cxx

 # End Source File

 # Begin Source File

@@ -584,6 +592,14 @@
 # End Source File

 # Begin Source File

 

+SOURCE=.\SFTMsgReader.h

+# End Source File

+# Begin Source File

+

+SOURCE=.\SFTMsgWriter.h

+# End Source File

+# Begin Source File

+

 SOURCE=.\SMsgHandler.h

 # End Source File

 # Begin Source File