From 4aed2c8219774f5d797760606b8489a92ddc5163 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kioslave/nfs/kio_nfs.h | 109 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 kioslave/nfs/kio_nfs.h (limited to 'kioslave/nfs/kio_nfs.h') diff --git a/kioslave/nfs/kio_nfs.h b/kioslave/nfs/kio_nfs.h new file mode 100644 index 000000000..23eb0b467 --- /dev/null +++ b/kioslave/nfs/kio_nfs.h @@ -0,0 +1,109 @@ +/* This file is part of the KDE project + Copyright (C) 2000 Alexander Neundorf + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KIO_NFS_H +#define KIO_NFS_H + +#include +#include + +#include +#include +#include +#include +#include + +#define PORTMAP //this seems to be required to compile on Solaris +#include +#include +#include +#include + +class NFSFileHandle +{ + public: + NFSFileHandle(); + NFSFileHandle(const NFSFileHandle & handle); + ~NFSFileHandle(); + NFSFileHandle& operator= (const NFSFileHandle& src); + NFSFileHandle& operator= (const char* src); + operator const char* () const {return m_handle;} + bool isInvalid() const {return m_isInvalid;} + void setInvalid() {m_isInvalid=TRUE;} +// time_t age() const; + protected: + char m_handle[NFS_FHSIZE+1]; + bool m_isInvalid; +// time_t m_detectTime; +}; + +//ostream& operator<<(ostream&, const NFSFileHandle&); + +typedef QMap NFSFileHandleMap; + + +class NFSProtocol : public KIO::SlaveBase +{ + public: + NFSProtocol (const QCString &pool, const QCString &app ); + virtual ~NFSProtocol(); + + virtual void openConnection(); + virtual void closeConnection(); + + virtual void setHost( const QString& host, int port, const QString& user, const QString& pass ); + + virtual void put( const KURL& url, int _mode,bool _overwrite, bool _resume ); + virtual void get( const KURL& url ); + virtual void listDir( const KURL& url); + virtual void symlink( const QString &target, const KURL &dest, bool ); + virtual void stat( const KURL & url); + virtual void mkdir( const KURL& url, int permissions ); + virtual void del( const KURL& url, bool isfile); + virtual void chmod(const KURL& url, int permissions ); + virtual void rename(const KURL &src, const KURL &dest, bool overwrite); + virtual void copy( const KURL& src, const KURL &dest, int mode, bool overwrite ); + protected: +// void createVirtualDirEntry(KIO::UDSEntry & entry); + bool checkForError(int clientStat, int nfsStat, const QString& text); + bool isExportedDir(const QString& path); + void completeUDSEntry(KIO::UDSEntry& entry, fattr& attributes); + void completeBadLinkUDSEntry(KIO::UDSEntry& entry, fattr& attributes); + void completeAbsoluteLinkUDSEntry(KIO::UDSEntry& entry, const QCString& path); + bool isValidLink(const QString& parentDir, const QString& linkDest); +// bool isAbsoluteLink(const QString& path); + + NFSFileHandle getFileHandle(QString path); + + NFSFileHandleMap m_handleCache; + QIntDict m_usercache; // maps long ==> QString * + QIntDict m_groupcache; + + QStringList m_exportedDirs; + QString m_currentHost; + CLIENT *m_client; + CLIENT *m_nfsClient; + timeval total_timeout; + timeval pertry_timeout; + int m_sock; + time_t m_lastCheck; + void checkForOldFHs(); +}; + +#endif -- cgit v1.2.1