LCOV - code coverage report
Current view: top level - netwerk/protocol/ftp - nsFtpProtocolHandler.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 12 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #ifndef nsFtpProtocolHandler_h__
       7             : #define nsFtpProtocolHandler_h__
       8             : 
       9             : #include "nsFtpControlConnection.h"
      10             : #include "nsIProxiedProtocolHandler.h"
      11             : #include "nsTArray.h"
      12             : #include "nsITimer.h"
      13             : #include "nsIObserver.h"
      14             : #include "nsWeakReference.h"
      15             : 
      16             : //-----------------------------------------------------------------------------
      17             : 
      18             : class nsFtpProtocolHandler final : public nsIProxiedProtocolHandler
      19             :                                  , public nsIObserver
      20             :                                  , public nsSupportsWeakReference
      21             : {
      22             : public:
      23             :     NS_DECL_THREADSAFE_ISUPPORTS
      24             :     NS_DECL_NSIPROTOCOLHANDLER
      25             :     NS_DECL_NSIPROXIEDPROTOCOLHANDLER
      26             :     NS_DECL_NSIOBSERVER
      27             : 
      28             :     nsFtpProtocolHandler();
      29             : 
      30             :     nsresult Init();
      31             : 
      32             :     // FTP Connection list access
      33             :     nsresult InsertConnection(nsIURI *aKey, nsFtpControlConnection *aConn);
      34             :     nsresult RemoveConnection(nsIURI *aKey, nsFtpControlConnection **aConn);
      35           0 :     uint32_t GetSessionId() { return mSessionId; }
      36             : 
      37           0 :     uint8_t GetDataQoSBits() { return mDataQoSBits; }
      38           0 :     uint8_t GetControlQoSBits() { return mControlQoSBits; }
      39             : 
      40             : private:
      41             :     virtual ~nsFtpProtocolHandler();
      42             : 
      43             :     // Stuff for the timer callback function
      44             :     struct timerStruct {
      45             :         nsCOMPtr<nsITimer> timer;
      46             :         RefPtr<nsFtpControlConnection> conn;
      47             :         char *key;
      48             : 
      49           0 :         timerStruct() : key(nullptr) {}
      50             : 
      51           0 :         ~timerStruct() {
      52           0 :             if (timer)
      53           0 :                 timer->Cancel();
      54           0 :             if (key)
      55           0 :                 free(key);
      56           0 :             if (conn) {
      57           0 :                 conn->Disconnect(NS_ERROR_ABORT);
      58             :             }
      59           0 :         }
      60             :     };
      61             : 
      62             :     static void Timeout(nsITimer *aTimer, void *aClosure);
      63             :     void ClearAllConnections();
      64             : 
      65             :     nsTArray<timerStruct*> mRootConnectionList;
      66             : 
      67             :     int32_t mIdleTimeout;
      68             : 
      69             :     // When "clear active logins" is performed, all idle connection are dropped
      70             :     // and mSessionId is incremented. When nsFtpState wants to insert idle
      71             :     // connection we refuse to cache if its mSessionId is different (i.e.
      72             :     // control connection had been created before last "clear active logins" was
      73             :     // performed.
      74             :     uint32_t mSessionId;
      75             : 
      76             :     uint8_t mControlQoSBits;
      77             :     uint8_t mDataQoSBits;
      78             : };
      79             : 
      80             : //-----------------------------------------------------------------------------
      81             : 
      82             : extern nsFtpProtocolHandler *gFtpHandler;
      83             : 
      84             : #include "mozilla/Logging.h"
      85             : extern mozilla::LazyLogModule gFTPLog;
      86             : 
      87             : #endif // !nsFtpProtocolHandler_h__

Generated by: LCOV version 1.13