1998-12-16 08:40:20 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
1998-05-23 03:38:40 +04:00
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
1998-09-19 11:08:09 +04:00
|
|
|
* Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
1998-05-23 03:38:40 +04:00
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
1998-09-19 11:08:09 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS"
|
|
|
|
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
|
|
|
* the License for the specific language governing rights and limitations
|
|
|
|
* under the License.
|
1998-05-23 03:38:40 +04:00
|
|
|
*
|
1998-09-19 11:08:09 +04:00
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
|
|
|
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
|
|
|
* Netscape Communications Corporation. All Rights Reserved.
|
1998-05-23 03:38:40 +04:00
|
|
|
*/
|
|
|
|
|
1998-09-19 11:08:09 +04:00
|
|
|
#ifndef nsNetService_h___
|
|
|
|
#define nsNetService_h___
|
1998-05-23 03:38:40 +04:00
|
|
|
|
1999-06-05 01:51:57 +04:00
|
|
|
#include "nsString.h"
|
1998-05-23 03:38:40 +04:00
|
|
|
#include "nspr.h"
|
1998-07-14 03:43:13 +04:00
|
|
|
#include "nsIPref.h"
|
1999-01-28 04:57:30 +03:00
|
|
|
#include "nsITransport.h"
|
1999-01-05 12:51:28 +03:00
|
|
|
#include "nsIEventQueueService.h"
|
1998-05-23 03:38:40 +04:00
|
|
|
#include "nsINetService.h"
|
1998-09-19 11:08:09 +04:00
|
|
|
#include "nsNetThread.h"
|
1998-12-16 08:40:20 +03:00
|
|
|
#include "nsHashtable.h"
|
1998-09-16 04:35:32 +04:00
|
|
|
#include "net.h"
|
1998-05-23 03:38:40 +04:00
|
|
|
|
1998-07-29 10:01:11 +04:00
|
|
|
class nsITimer;
|
1998-07-02 03:56:20 +04:00
|
|
|
|
1999-04-02 23:05:52 +04:00
|
|
|
// The chrome registry interface
|
|
|
|
class nsIChromeRegistry;
|
|
|
|
|
1998-05-23 03:38:40 +04:00
|
|
|
class nsNetlibService : public nsINetService {
|
|
|
|
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
1998-10-08 03:19:39 +04:00
|
|
|
nsNetlibService();
|
1998-05-23 03:38:40 +04:00
|
|
|
|
|
|
|
/* Implementation of the nsINetService interface */
|
1999-06-23 07:29:44 +04:00
|
|
|
NS_IMETHOD OpenStream(nsIURI *aUrl,
|
1998-12-16 08:40:20 +03:00
|
|
|
nsIStreamListener *aConsumer);
|
1999-06-23 07:29:44 +04:00
|
|
|
NS_IMETHOD OpenBlockingStream(nsIURI *aUrl,
|
1998-05-23 03:38:40 +04:00
|
|
|
nsIStreamListener *aConsumer,
|
|
|
|
nsIInputStream **aNewStream);
|
1998-10-17 02:44:20 +04:00
|
|
|
|
1999-06-23 07:29:44 +04:00
|
|
|
NS_IMETHOD InterruptStream(nsIURI* aURL);
|
1998-05-23 03:38:40 +04:00
|
|
|
|
1999-06-23 07:29:44 +04:00
|
|
|
NS_IMETHOD GetCookieString(nsIURI *aURL, nsString& aCookie);
|
|
|
|
NS_IMETHOD SetCookieString(nsIURI *aURL, const nsString& aCookie);
|
1998-07-25 04:32:32 +04:00
|
|
|
|
1999-06-05 01:51:57 +04:00
|
|
|
NS_IMETHOD Cookie_DisplayCookieInfoAsHTML();
|
|
|
|
NS_IMETHOD Cookie_CookieViewerReturn(nsAutoString results);
|
|
|
|
NS_IMETHOD Cookie_GetCookieListForViewer(nsString& aCookieList);
|
|
|
|
NS_IMETHOD Cookie_GetPermissionListForViewer(nsString& aPermissionList);
|
1998-12-30 03:20:46 +03:00
|
|
|
|
1998-09-23 02:41:27 +04:00
|
|
|
NS_IMETHOD GetProxyHTTP(nsString& aProxyHTTP);
|
|
|
|
NS_IMETHOD SetProxyHTTP(nsString& aProxyHTTP);
|
1998-09-30 02:43:32 +04:00
|
|
|
NS_IMETHOD GetHTTPOneOne(PRBool& aOneOne);
|
|
|
|
NS_IMETHOD SetHTTPOneOne(PRBool aSendOneOne);
|
1998-09-23 02:41:27 +04:00
|
|
|
|
1998-10-08 03:19:39 +04:00
|
|
|
NS_IMETHOD GetAppCodeName(nsString& aAppCodeName);
|
|
|
|
NS_IMETHOD GetAppVersion(nsString& aAppVersion);
|
|
|
|
NS_IMETHOD GetAppName(nsString& aAppName);
|
|
|
|
NS_IMETHOD GetLanguage(nsString& aLanguage);
|
|
|
|
NS_IMETHOD GetPlatform(nsString& aPlatform);
|
1998-10-29 00:12:50 +03:00
|
|
|
NS_IMETHOD GetUserAgent(nsString& aUA);
|
1998-10-08 03:19:39 +04:00
|
|
|
NS_IMETHOD SetCustomUserAgent(nsString aCustom);
|
1998-12-16 08:40:20 +03:00
|
|
|
NS_IMETHOD RegisterProtocol(const nsString& aName,
|
|
|
|
nsIProtocolURLFactory* aProtocolURLFactory,
|
|
|
|
nsIProtocol* aProtocol);
|
|
|
|
NS_IMETHOD UnregisterProtocol(const nsString& aName);
|
|
|
|
NS_IMETHOD GetProtocol(const nsString& aName,
|
|
|
|
nsIProtocolURLFactory* *aProtocolURLFactory,
|
|
|
|
nsIProtocol* *aProtocol);
|
1999-06-23 07:29:44 +04:00
|
|
|
NS_IMETHOD CreateURL(nsIURI* *aURL,
|
1998-12-16 08:40:20 +03:00
|
|
|
const nsString& aSpec,
|
1999-06-23 07:29:44 +04:00
|
|
|
const nsIURI* aContextURL = nsnull,
|
1998-12-16 08:40:20 +03:00
|
|
|
nsISupports* aContainer = nsnull,
|
1999-06-25 06:17:37 +04:00
|
|
|
nsILoadGroup* aGroup = nsnull);
|
1999-01-06 00:11:42 +03:00
|
|
|
NS_IMETHOD AreThereActiveConnections(void);
|
1998-10-08 03:19:39 +04:00
|
|
|
|
1999-01-28 04:57:30 +03:00
|
|
|
NS_IMETHOD CreateSocketTransport(nsITransport **aTransport, PRUint32 aPortToUse, const char * aHostName);
|
|
|
|
|
1999-02-11 05:59:53 +03:00
|
|
|
NS_IMETHOD CreateFileSocketTransport(nsITransport **aTransport, const char * aFileName);
|
|
|
|
|
1998-05-23 03:38:40 +04:00
|
|
|
protected:
|
|
|
|
virtual ~nsNetlibService();
|
|
|
|
|
1998-09-19 11:08:09 +04:00
|
|
|
nsresult StartNetlibThread(void);
|
|
|
|
nsresult StopNetlibThread(void);
|
|
|
|
|
1998-07-29 10:01:11 +04:00
|
|
|
void SchedulePollingTimer();
|
|
|
|
void CleanupPollingTimer(nsITimer* aTimer);
|
|
|
|
static void NetPollSocketsCallback(nsITimer* aTimer, void* aClosure);
|
|
|
|
|
1998-09-19 11:08:09 +04:00
|
|
|
#if defined(NETLIB_THREAD)
|
|
|
|
static void NetlibThreadMain(void *aParam);
|
|
|
|
#endif /* NETLIB_THREAD */
|
|
|
|
|
1999-04-02 23:05:52 +04:00
|
|
|
// Chrome Registry static variables
|
|
|
|
static nsIChromeRegistry* gChromeRegistry;
|
|
|
|
static int gRefCnt;
|
|
|
|
|
1998-05-23 03:38:40 +04:00
|
|
|
private:
|
1999-06-23 07:29:44 +04:00
|
|
|
void SetupURLStruct(nsIURI *aURL, URL_Struct *aURL_s);
|
1998-05-23 03:38:40 +04:00
|
|
|
/* XXX: This is temporary until bamwrap.cpp is removed... */
|
|
|
|
void *m_stubContext;
|
1998-07-14 03:43:13 +04:00
|
|
|
nsIPref *mPref;
|
1998-07-29 10:01:11 +04:00
|
|
|
|
|
|
|
nsITimer* mPollingTimer;
|
1998-09-19 11:08:09 +04:00
|
|
|
|
|
|
|
nsNetlibThread* mNetlibThread;
|
1999-01-05 12:51:28 +03:00
|
|
|
nsIEventQueueService* mEventQService;
|
1998-12-16 08:40:20 +03:00
|
|
|
|
|
|
|
nsHashtable* mProtocols;
|
1998-05-23 03:38:40 +04:00
|
|
|
};
|
|
|
|
|
1998-12-30 19:01:54 +03:00
|
|
|
extern "C" void net_ReleaseContext(MWContext *context);
|
|
|
|
|
1998-05-23 03:38:40 +04:00
|
|
|
|
1998-09-19 11:08:09 +04:00
|
|
|
#endif /* nsNetService_h___ */
|