LCOV - code coverage report
Current view: top level - netwerk/protocol/ftp - nsFtpControlConnection.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 2 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 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             : /* vim:set et ts=4 sts=4 sw=4 cin: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef nsFtpControlConnection_h___
       8             : #define nsFtpControlConnection_h___
       9             : 
      10             : #include "nsCOMPtr.h"
      11             : 
      12             : #include "nsISocketTransport.h"
      13             : #include "nsIAsyncInputStream.h"
      14             : #include "nsAutoPtr.h"
      15             : #include "nsString.h"
      16             : #include "mozilla/Attributes.h"
      17             : 
      18             : class nsIOutputStream;
      19             : class nsIProxyInfo;
      20             : class nsITransportEventSink;
      21             : 
      22           0 : class nsFtpControlConnectionListener : public nsISupports {
      23             : public:
      24             :     /**
      25             :      * Called when a chunk of data arrives on the control connection.
      26             :      * @param data
      27             :      *        The new data or null if an error occurred.
      28             :      * @param dataLen
      29             :      *        The data length in bytes.
      30             :      */
      31             :     virtual void OnControlDataAvailable(const char *data, uint32_t dataLen) = 0;
      32             : 
      33             :     /**
      34             :      * Called when an error occurs on the control connection.
      35             :      * @param status
      36             :      *        A failure code providing more info about the error.
      37             :      */
      38             :     virtual void OnControlError(nsresult status) = 0;
      39             : };
      40             : 
      41             : class nsFtpControlConnection final : public nsIInputStreamCallback
      42             : {
      43             :     ~nsFtpControlConnection();
      44             : 
      45             : public:
      46             :     NS_DECL_ISUPPORTS
      47             :     NS_DECL_NSIINPUTSTREAMCALLBACK
      48             : 
      49             :     nsFtpControlConnection(const nsACString& host, uint32_t port);
      50             : 
      51             :     nsresult Connect(nsIProxyInfo* proxyInfo, nsITransportEventSink* eventSink);
      52             :     nsresult Disconnect(nsresult status);
      53             :     nsresult Write(const nsACString& command);
      54             : 
      55             :     bool IsAlive();
      56             : 
      57           0 :     nsITransport *Transport()   { return mSocket; }
      58             : 
      59             :     /**
      60             :      * Call this function to be notified asynchronously when there is data
      61             :      * available for the socket.  The listener passed to this method replaces
      62             :      * any existing listener, and the listener can be null to disconnect the
      63             :      * previous listener.
      64             :      */
      65             :     nsresult WaitData(nsFtpControlConnectionListener *listener);
      66             : 
      67             :     uint32_t         mServerType;           // what kind of server is it.
      68             :     nsString         mPassword;
      69             :     int32_t          mSuspendedWrite;
      70             :     nsCString        mPwd;
      71             :     uint32_t         mSessionId;
      72             :     bool             mUseUTF8;
      73             : 
      74             : private:
      75             :     nsCString mHost;
      76             :     uint32_t  mPort;
      77             : 
      78             :     nsCOMPtr<nsISocketTransport>     mSocket;
      79             :     nsCOMPtr<nsIOutputStream>        mSocketOutput;
      80             :     nsCOMPtr<nsIAsyncInputStream>    mSocketInput;
      81             : 
      82             :     RefPtr<nsFtpControlConnectionListener> mListener;
      83             : };
      84             : 
      85             : #endif

Generated by: LCOV version 1.13