1998-12-16 05:40:20 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
1998-05-22 23:38:40 +00:00
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
1998-09-19 07:08:09 +00: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-22 23:38:40 +00:00
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
1998-09-19 07:08:09 +00: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-22 23:38:40 +00:00
|
|
|
*
|
1998-09-19 07:08:09 +00: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-22 23:38:40 +00:00
|
|
|
*/
|
|
|
|
|
1998-09-19 07:08:09 +00:00
|
|
|
#ifndef nsNetService_h___
|
|
|
|
#define nsNetService_h___
|
1998-05-22 23:38:40 +00:00
|
|
|
|
1999-06-04 21:51:57 +00:00
|
|
|
#include "nsString.h"
|
1998-05-22 23:38:40 +00:00
|
|
|
#include "nspr.h"
|
1998-07-13 23:43:13 +00:00
|
|
|
#include "nsIPref.h"
|
1999-01-28 01:57:30 +00:00
|
|
|
#include "nsITransport.h"
|
1999-01-05 09:51:28 +00:00
|
|
|
#include "nsIEventQueueService.h"
|
1998-05-22 23:38:40 +00:00
|
|
|
#include "nsINetService.h"
|
1998-09-19 07:08:09 +00:00
|
|
|
#include "nsNetThread.h"
|
1998-12-16 05:40:20 +00:00
|
|
|
#include "nsHashtable.h"
|
1998-09-16 00:35:32 +00:00
|
|
|
#include "net.h"
|
1998-05-22 23:38:40 +00:00
|
|
|
|
1998-07-29 06:01:11 +00:00
|
|
|
class nsITimer;
|
1998-07-01 23:56:20 +00:00
|
|
|
|
1999-04-02 19:05:52 +00:00
|
|
|
// The chrome registry interface
|
|
|
|
class nsIChromeRegistry;
|
|
|
|
|
1998-05-22 23:38:40 +00:00
|
|
|
class nsNetlibService : public nsINetService {
|
|
|
|
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
1998-10-07 23:19:39 +00:00
|
|
|
nsNetlibService();
|
1998-05-22 23:38:40 +00:00
|
|
|
|
|
|
|
/* Implementation of the nsINetService interface */
|
1999-06-23 03:29:44 +00:00
|
|
|
NS_IMETHOD OpenStream(nsIURI *aUrl,
|
1998-12-16 05:40:20 +00:00
|
|
|
nsIStreamListener *aConsumer);
|
1999-06-23 03:29:44 +00:00
|
|
|
NS_IMETHOD OpenBlockingStream(nsIURI *aUrl,
|
1998-05-22 23:38:40 +00:00
|
|
|
nsIStreamListener *aConsumer,
|
|
|
|
nsIInputStream **aNewStream);
|
1998-10-16 22:44:20 +00:00
|
|
|
|
1999-06-23 03:29:44 +00:00
|
|
|
NS_IMETHOD InterruptStream(nsIURI* aURL);
|
1998-05-22 23:38:40 +00:00
|
|
|
|
1999-06-23 03:29:44 +00:00
|
|
|
NS_IMETHOD GetCookieString(nsIURI *aURL, nsString& aCookie);
|
|
|
|
NS_IMETHOD SetCookieString(nsIURI *aURL, const nsString& aCookie);
|
1998-07-25 00:32:32 +00:00
|
|
|
|
1999-06-04 21:51:57 +00: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 00:20:46 +00:00
|
|
|
|
1998-09-22 22:41:27 +00:00
|
|
|
NS_IMETHOD GetProxyHTTP(nsString& aProxyHTTP);
|
|
|
|
NS_IMETHOD SetProxyHTTP(nsString& aProxyHTTP);
|
1998-09-29 22:43:32 +00:00
|
|
|
NS_IMETHOD GetHTTPOneOne(PRBool& aOneOne);
|
|
|
|
NS_IMETHOD SetHTTPOneOne(PRBool aSendOneOne);
|
1998-09-22 22:41:27 +00:00
|
|
|
|
1998-10-07 23:19:39 +00: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-28 21:12:50 +00:00
|
|
|
NS_IMETHOD GetUserAgent(nsString& aUA);
|
1998-10-07 23:19:39 +00:00
|
|
|
NS_IMETHOD SetCustomUserAgent(nsString aCustom);
|
1998-12-16 05:40:20 +00: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 03:29:44 +00:00
|
|
|
NS_IMETHOD CreateURL(nsIURI* *aURL,
|
1998-12-16 05:40:20 +00:00
|
|
|
const nsString& aSpec,
|
1999-06-23 03:29:44 +00:00
|
|
|
const nsIURI* aContextURL = nsnull,
|
1998-12-16 05:40:20 +00:00
|
|
|
nsISupports* aContainer = nsnull,
|
1999-06-25 02:17:37 +00:00
|
|
|
nsILoadGroup* aGroup = nsnull);
|
1999-01-05 21:11:42 +00:00
|
|
|
NS_IMETHOD AreThereActiveConnections(void);
|
1998-10-07 23:19:39 +00:00
|
|
|
|
1999-01-28 01:57:30 +00:00
|
|
|
NS_IMETHOD CreateSocketTransport(nsITransport **aTransport, PRUint32 aPortToUse, const char * aHostName);
|
|
|
|
|
1999-02-11 02:59:53 +00:00
|
|
|
NS_IMETHOD CreateFileSocketTransport(nsITransport **aTransport, const char * aFileName);
|
|
|
|
|
1998-05-22 23:38:40 +00:00
|
|
|
protected:
|
|
|
|
virtual ~nsNetlibService();
|
|
|
|
|
1998-09-19 07:08:09 +00:00
|
|
|
nsresult StartNetlibThread(void);
|
|
|
|
nsresult StopNetlibThread(void);
|
|
|
|
|
1998-07-29 06:01:11 +00:00
|
|
|
void SchedulePollingTimer();
|
|
|
|
void CleanupPollingTimer(nsITimer* aTimer);
|
|
|
|
static void NetPollSocketsCallback(nsITimer* aTimer, void* aClosure);
|
|
|
|
|
1998-09-19 07:08:09 +00:00
|
|
|
#if defined(NETLIB_THREAD)
|
|
|
|
static void NetlibThreadMain(void *aParam);
|
|
|
|
#endif /* NETLIB_THREAD */
|
|
|
|
|
1999-04-02 19:05:52 +00:00
|
|
|
// Chrome Registry static variables
|
|
|
|
static nsIChromeRegistry* gChromeRegistry;
|
|
|
|
static int gRefCnt;
|
|
|
|
|
1998-05-22 23:38:40 +00:00
|
|
|
private:
|
1999-06-23 03:29:44 +00:00
|
|
|
void SetupURLStruct(nsIURI *aURL, URL_Struct *aURL_s);
|
1998-05-22 23:38:40 +00:00
|
|
|
/* XXX: This is temporary until bamwrap.cpp is removed... */
|
|
|
|
void *m_stubContext;
|
1998-07-13 23:43:13 +00:00
|
|
|
nsIPref *mPref;
|
1998-07-29 06:01:11 +00:00
|
|
|
|
|
|
|
nsITimer* mPollingTimer;
|
1998-09-19 07:08:09 +00:00
|
|
|
|
|
|
|
nsNetlibThread* mNetlibThread;
|
1999-01-05 09:51:28 +00:00
|
|
|
nsIEventQueueService* mEventQService;
|
1998-12-16 05:40:20 +00:00
|
|
|
|
|
|
|
nsHashtable* mProtocols;
|
1998-05-22 23:38:40 +00:00
|
|
|
};
|
|
|
|
|
1998-12-30 16:01:54 +00:00
|
|
|
extern "C" void net_ReleaseContext(MWContext *context);
|
|
|
|
|
1998-05-22 23:38:40 +00:00
|
|
|
|
1998-09-19 07:08:09 +00:00
|
|
|
#endif /* nsNetService_h___ */
|