1998-05-22 23:38:40 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
#include "nspr.h"
|
1998-09-19 07:08:09 +00:00
|
|
|
#include "plevent.h"
|
1998-07-13 23:43:13 +00:00
|
|
|
#include "nsIPref.h"
|
1998-05-22 23:38:40 +00:00
|
|
|
#include "nsINetService.h"
|
1998-09-19 07:08:09 +00:00
|
|
|
#include "nsNetThread.h"
|
1998-09-16 00:35:32 +00:00
|
|
|
#include "net.h"
|
1998-05-22 23:38:40 +00:00
|
|
|
|
1998-07-01 23:56:20 +00:00
|
|
|
class nsINetContainerApplication;
|
1998-07-29 06:01:11 +00:00
|
|
|
class nsITimer;
|
1998-07-01 23:56:20 +00:00
|
|
|
|
1998-05-22 23:38:40 +00:00
|
|
|
class nsNetlibService : public nsINetService {
|
|
|
|
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
1998-07-01 23:56:20 +00:00
|
|
|
nsNetlibService(nsINetContainerApplication *aContainer);
|
1998-05-22 23:38:40 +00:00
|
|
|
|
|
|
|
/* Implementation of the nsINetService interface */
|
|
|
|
NS_IMETHOD OpenStream(nsIURL *aUrl, nsIStreamListener *aConsumer);
|
|
|
|
NS_IMETHOD OpenBlockingStream(nsIURL *aUrl,
|
|
|
|
nsIStreamListener *aConsumer,
|
|
|
|
nsIInputStream **aNewStream);
|
|
|
|
|
1998-07-01 23:56:20 +00:00
|
|
|
NS_IMETHOD GetContainerApplication(nsINetContainerApplication **aContainer);
|
|
|
|
nsresult SetContainerApplication(nsINetContainerApplication *aContainer);
|
|
|
|
|
1998-07-25 00:32:32 +00:00
|
|
|
NS_IMETHOD GetCookieString(nsIURL *aURL, nsString& aCookie);
|
|
|
|
NS_IMETHOD SetCookieString(nsIURL *aURL, const nsString& aCookie);
|
|
|
|
|
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 */
|
|
|
|
|
1998-05-22 23:38:40 +00:00
|
|
|
private:
|
1998-09-16 00:35:32 +00:00
|
|
|
void SetupURLStruct(nsIURL *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-01 23:56:20 +00:00
|
|
|
nsINetContainerApplication *mContainer;
|
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;
|
1998-05-22 23:38:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1998-09-19 07:08:09 +00:00
|
|
|
#endif /* nsNetService_h___ */
|