Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsNetModule.cpp File Reference
#include "necko-config.h"
#include "nsCOMPtr.h"
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsICategoryManager.h"
#include "nsSocketProviderService.h"
#include "nscore.h"
#include "nsSimpleURI.h"
#include "nsLoadGroup.h"
#include "nsStreamLoader.h"
#include "nsUnicharStreamLoader.h"
#include "nsAsyncStreamListener.h"
#include "nsFileStreams.h"
#include "nsBufferedStreams.h"
#include "nsMIMEInputStream.h"
#include "nsSOCKSSocketProvider.h"
#include "nsCacheService.h"
#include "nsIOThreadPool.h"
#include "nsMimeTypes.h"
#include "nsNetStrings.h"
#include "nsNetCID.h"
#include "nsIOService.h"
#include "nsDNSService2.h"
#include "nsProtocolProxyService.h"
#include "nsStreamTransportService.h"
#include "nsSocketTransportService2.h"
#include "nsServerSocket.h"
#include "nsAsyncStreamCopier.h"
#include "nsInputStreamPump.h"
#include "nsInputStreamChannel.h"
#include "nsDownloader.h"
#include "nsSyncStreamListener.h"
#include "nsStreamConverterService.h"
#include "nsMIMEHeaderParamImpl.h"
#include "nsRequestObserverProxy.h"
#include "nsSimpleStreamListener.h"
#include "nsDirIndexParser.h"
#include "nsDirIndex.h"
#include "nsStreamListenerTee.h"
#include "nsAboutProtocolHandler.h"
#include "nsAboutBlank.h"
#include "nsURIChecker.h"
#include "nsURLParsers.h"
#include "nsStandardURL.h"
#include "nsIDNService.h"
#include "nsMultiMixedConv.h"
#include "nsHTTPCompressConv.h"
#include "mozTXTToHTMLConv.h"
#include "nsUnknownDecoder.h"
#include "nsTXTToHTMLConv.h"
#include "nsIndexedToHTML.h"
#include "nsBinHexDecoder.h"

Go to the source code of this file.

Defines

#define BUILD_BINHEX_DECODER   1
#define NS_INCREMENTALDOWNLOAD_CLASSNAME   "nsIncrementalDownload"
#define NS_INCREMENTALDOWNLOAD_CID
#define FTP_TO_INDEX   "?from=text/ftp-dir&to=application/http-index-format"
#define GOPHER_TO_INDEX   "?from=text/gopher-dir&to=application/http-index-format"
#define INDEX_TO_HTML   "?from=application/http-index-format&to=text/html"
#define MULTI_MIXED_X   "?from=multipart/x-mixed-replace&to=*/*"
#define MULTI_MIXED   "?from=multipart/mixed&to=*/*"
#define MULTI_BYTERANGES   "?from=multipart/byteranges&to=*/*"
#define UNKNOWN_CONTENT   "?from=" UNKNOWN_CONTENT_TYPE "&to=*/*"
#define MAYBE_TEXT   "?from=" APPLICATION_MAYBE_TEXT "&to=*/*"
#define GZIP_TO_UNCOMPRESSED   "?from=gzip&to=uncompressed"
#define XGZIP_TO_UNCOMPRESSED   "?from=x-gzip&to=uncompressed"
#define COMPRESS_TO_UNCOMPRESSED   "?from=compress&to=uncompressed"
#define XCOMPRESS_TO_UNCOMPRESSED   "?from=x-compress&to=uncompressed"
#define DEFLATE_TO_UNCOMPRESSED   "?from=deflate&to=uncompressed"
#define PLAIN_TO_HTML   "?from=text/plain&to=text/html"
#define BINHEX_TO_WILD   "?from=application/mac-binhex40&to=*/*"

Functions

NS_METHOD net_NewIncrementalDownload (nsISupports *, const nsIID &, void **)
nsresult NS_NewMultiMixedConv (nsMultiMixedConv **result)
nsresult MOZ_NewTXTToHTMLConv (mozTXTToHTMLConv **result)
nsresult NS_NewHTTPCompressConv (nsHTTPCompressConv **result)
nsresult NS_NewNSTXTToHTMLConv (nsTXTToHTMLConv **result)
nsresult NS_NewStreamConv (nsStreamConverterService **aStreamConv)
static NS_METHOD RegisterStreamConverters (nsIComponentManager *aCompMgr, nsIFile *aPath, const char *registryLocation, const char *componentType, const nsModuleComponentInfo *info)
static NS_METHOD UnregisterStreamConverters (nsIComponentManager *aCompMgr, nsIFile *aPath, const char *registryLocation, const nsModuleComponentInfo *info)
static NS_IMETHODIMP CreateNewStreamConvServiceFactory (nsISupports *aOuter, REFNSIID aIID, void **aResult)
static NS_IMETHODIMP CreateNewMultiMixedConvFactory (nsISupports *aOuter, REFNSIID aIID, void **aResult)
static NS_IMETHODIMP CreateNewTXTToHTMLConvFactory (nsISupports *aOuter, REFNSIID aIID, void **aResult)
static NS_IMETHODIMP CreateNewHTTPCompressConvFactory (nsISupports *aOuter, REFNSIID aIID, void **aResult)
static NS_IMETHODIMP CreateNewUnknownDecoderFactory (nsISupports *aOuter, REFNSIID aIID, void **aResult)
static NS_IMETHODIMP CreateNewBinaryDetectorFactory (nsISupports *aOuter, REFNSIID aIID, void **aResult)
static NS_IMETHODIMP CreateNewNSTXTToHTMLConvFactory (nsISupports *aOuter, REFNSIID aIID, void **aResult)
 PR_STATIC_CALLBACK (nsresult) nsNetStartup(nsIModule *neckoModule)
static void PR_CALLBACK nsNetShutdown (nsIModule *neckoModule)

Variables

static const char *const g_StreamConverterArray []
static PRUint32 g_StreamConverterCount = sizeof(g_StreamConverterCount)/sizeof(const char*)
static const nsModuleComponentInfo gNetModuleInfo []

Define Documentation

#define BINHEX_TO_WILD   "?from=application/mac-binhex40&to=*/*"

Definition at line 288 of file nsNetModule.cpp.

Definition at line 69 of file nsNetModule.cpp.

#define COMPRESS_TO_UNCOMPRESSED   "?from=compress&to=uncompressed"

Definition at line 282 of file nsNetModule.cpp.

#define DEFLATE_TO_UNCOMPRESSED   "?from=deflate&to=uncompressed"

Definition at line 284 of file nsNetModule.cpp.

#define FTP_TO_INDEX   "?from=text/ftp-dir&to=application/http-index-format"

Definition at line 272 of file nsNetModule.cpp.

#define GOPHER_TO_INDEX   "?from=text/gopher-dir&to=application/http-index-format"

Definition at line 273 of file nsNetModule.cpp.

#define GZIP_TO_UNCOMPRESSED   "?from=gzip&to=uncompressed"

Definition at line 280 of file nsNetModule.cpp.

#define INDEX_TO_HTML   "?from=application/http-index-format&to=text/html"

Definition at line 274 of file nsNetModule.cpp.

#define MAYBE_TEXT   "?from=" APPLICATION_MAYBE_TEXT "&to=*/*"

Definition at line 279 of file nsNetModule.cpp.

#define MULTI_BYTERANGES   "?from=multipart/byteranges&to=*/*"

Definition at line 277 of file nsNetModule.cpp.

#define MULTI_MIXED   "?from=multipart/mixed&to=*/*"

Definition at line 276 of file nsNetModule.cpp.

#define MULTI_MIXED_X   "?from=multipart/x-mixed-replace&to=*/*"

Definition at line 275 of file nsNetModule.cpp.

Value:
{ /* a62af1ba-79b3-4896-8aaf-b148bfce4280 */         \
    0xa62af1ba,                                      \
    0x79b3,                                          \
    0x4896,                                          \
    {0x8a, 0xaf, 0xb1, 0x48, 0xbf, 0xce, 0x42, 0x80} \
}

Definition at line 118 of file nsNetModule.cpp.

#define NS_INCREMENTALDOWNLOAD_CLASSNAME   "nsIncrementalDownload"

Definition at line 116 of file nsNetModule.cpp.

#define PLAIN_TO_HTML   "?from=text/plain&to=text/html"

Definition at line 285 of file nsNetModule.cpp.

#define UNKNOWN_CONTENT   "?from=" UNKNOWN_CONTENT_TYPE "&to=*/*"

Definition at line 278 of file nsNetModule.cpp.

#define XCOMPRESS_TO_UNCOMPRESSED   "?from=x-compress&to=uncompressed"

Definition at line 283 of file nsNetModule.cpp.

#define XGZIP_TO_UNCOMPRESSED   "?from=x-gzip&to=uncompressed"

Definition at line 281 of file nsNetModule.cpp.


Function Documentation

static NS_IMETHODIMP CreateNewBinaryDetectorFactory ( nsISupports *  aOuter,
REFNSIID  aIID,
void **  aResult 
) [static]

Definition at line 543 of file nsNetModule.cpp.

{
  nsresult rv;

  if (!aResult) {
    return NS_ERROR_NULL_POINTER;
  }
  *aResult = nsnull;

  if (aOuter) {
    return NS_ERROR_NO_AGGREGATION;
  }

  nsBinaryDetector* inst = new nsBinaryDetector();
  if (!inst) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  NS_ADDREF(inst);
  rv = inst->QueryInterface(aIID, aResult);
  NS_RELEASE(inst);

  return rv;
}

Here is the call graph for this function:

static NS_IMETHODIMP CreateNewHTTPCompressConvFactory ( nsISupports *  aOuter,
REFNSIID  aIID,
void **  aResult 
) [static]

Definition at line 492 of file nsNetModule.cpp.

{
    if (!aResult) {                                                  
        return NS_ERROR_INVALID_POINTER;                             
    }
    if (aOuter) {                                                    
        *aResult = nsnull;                                           
        return NS_ERROR_NO_AGGREGATION;                              
    }   
    nsHTTPCompressConv* inst = nsnull;
    nsresult rv = NS_NewHTTPCompressConv (&inst);
    if (NS_FAILED(rv)) {                                             
        *aResult = nsnull;                                           
        return rv;                                                   
    } 
    rv = inst->QueryInterface(aIID, aResult);
    if (NS_FAILED(rv)) {                                             
        *aResult = nsnull;                                           
    }                                                                
    NS_RELEASE(inst);             /* get rid of extra refcnt */      
    return rv;              
}

Here is the call graph for this function:

static NS_IMETHODIMP CreateNewMultiMixedConvFactory ( nsISupports *  aOuter,
REFNSIID  aIID,
void **  aResult 
) [static]

Definition at line 444 of file nsNetModule.cpp.

{
    if (!aResult) {                                                  
        return NS_ERROR_INVALID_POINTER;                             
    }
    if (aOuter) {                                                    
        *aResult = nsnull;                                           
        return NS_ERROR_NO_AGGREGATION;                              
    }   
    nsMultiMixedConv* inst = nsnull;
    nsresult rv = NS_NewMultiMixedConv(&inst);
    if (NS_FAILED(rv)) {                                             
        *aResult = nsnull;                                           
        return rv;                                                   
    } 
    rv = inst->QueryInterface(aIID, aResult);
    if (NS_FAILED(rv)) {                                             
        *aResult = nsnull;                                           
    }                                                                
    NS_RELEASE(inst);             /* get rid of extra refcnt */      
    return rv;              
}

Here is the call graph for this function:

static NS_IMETHODIMP CreateNewNSTXTToHTMLConvFactory ( nsISupports *  aOuter,
REFNSIID  aIID,
void **  aResult 
) [static]

Definition at line 568 of file nsNetModule.cpp.

{
  nsresult rv;

  if (!aResult) {
    return NS_ERROR_NULL_POINTER;
  }
  *aResult = nsnull;

  if (aOuter) {
    return NS_ERROR_NO_AGGREGATION;
  }

  nsTXTToHTMLConv *inst;
  
  inst = new nsTXTToHTMLConv();
  if (!inst) return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(inst);
  rv = inst->Init();
  if (NS_FAILED(rv)) {
    delete inst;
    return rv;
  }
  rv = inst->QueryInterface(aIID, aResult);
  NS_RELEASE(inst);

  return rv;
}

Here is the call graph for this function:

static NS_IMETHODIMP CreateNewStreamConvServiceFactory ( nsISupports *  aOuter,
REFNSIID  aIID,
void **  aResult 
) [static]

Definition at line 368 of file nsNetModule.cpp.

{
    if (!aResult) {                                                  
        return NS_ERROR_INVALID_POINTER;                             
    }
    if (aOuter) {                                                    
        *aResult = nsnull;                                           
        return NS_ERROR_NO_AGGREGATION;                              
    }   
    nsStreamConverterService* inst = nsnull;
    nsresult rv = NS_NewStreamConv(&inst);
    if (NS_FAILED(rv)) {                                             
        *aResult = nsnull;                                           
        return rv;                                                   
    } 
    rv = inst->QueryInterface(aIID, aResult);
    if (NS_FAILED(rv)) {                                             
        *aResult = nsnull;                                           
    }                                                                
    NS_RELEASE(inst);             /* get rid of extra refcnt */      
    return rv;              
}

Here is the call graph for this function:

static NS_IMETHODIMP CreateNewTXTToHTMLConvFactory ( nsISupports *  aOuter,
REFNSIID  aIID,
void **  aResult 
) [static]

Definition at line 468 of file nsNetModule.cpp.

{
    if (!aResult) {                                                  
        return NS_ERROR_INVALID_POINTER;                             
    }
    if (aOuter) {                                                    
        *aResult = nsnull;                                           
        return NS_ERROR_NO_AGGREGATION;                              
    }   
    mozTXTToHTMLConv* inst = nsnull;
    nsresult rv = MOZ_NewTXTToHTMLConv(&inst);
    if (NS_FAILED(rv)) {                                             
        *aResult = nsnull;                                           
        return rv;                                                   
    } 
    rv = inst->QueryInterface(aIID, aResult);
    if (NS_FAILED(rv)) {                                             
        *aResult = nsnull;                                           
    }                                                                
    NS_RELEASE(inst);             /* get rid of extra refcnt */      
    return rv;              
}

Here is the call graph for this function:

static NS_IMETHODIMP CreateNewUnknownDecoderFactory ( nsISupports *  aOuter,
REFNSIID  aIID,
void **  aResult 
) [static]

Definition at line 516 of file nsNetModule.cpp.

{
  nsresult rv;

  if (!aResult) {
    return NS_ERROR_NULL_POINTER;
  }
  *aResult = nsnull;

  if (aOuter) {
    return NS_ERROR_NO_AGGREGATION;
  }

  nsUnknownDecoder *inst;
  
  inst = new nsUnknownDecoder();
  if (!inst) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  NS_ADDREF(inst);
  rv = inst->QueryInterface(aIID, aResult);
  NS_RELEASE(inst);

  return rv;
}

Here is the call graph for this function:

Definition at line 1394 of file mozTXTToHTMLConv.cpp.

{
    NS_PRECONDITION(aConv != nsnull, "null ptr");
    if (!aConv)
      return NS_ERROR_NULL_POINTER;

    *aConv = new mozTXTToHTMLConv();
    if (!*aConv)
      return NS_ERROR_OUT_OF_MEMORY;

    NS_ADDREF(*aConv);
    //    return (*aConv)->Init();
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_METHOD net_NewIncrementalDownload ( nsISupports *  ,
const nsIID ,
void **   
)

Definition at line 797 of file nsIncrementalDownload.cpp.

{
  if (outer)
    return NS_ERROR_NO_AGGREGATION;

  nsIncrementalDownload *d = new nsIncrementalDownload();
  if (!d)
    return NS_ERROR_OUT_OF_MEMORY;
  
  NS_ADDREF(d);
  nsresult rv = d->QueryInterface(iid, result);
  NS_RELEASE(d);
  return rv;
}

Here is the call graph for this function:

Definition at line 548 of file nsHTTPCompressConv.cpp.

{
    NS_PRECONDITION(aHTTPCompressConv != nsnull, "null ptr");

    if (!aHTTPCompressConv)
        return NS_ERROR_NULL_POINTER;

    *aHTTPCompressConv = new nsHTTPCompressConv();

    if (!*aHTTPCompressConv)
        return NS_ERROR_OUT_OF_MEMORY;

    NS_ADDREF(*aHTTPCompressConv);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 992 of file nsMultiMixedConv.cpp.

{
    NS_PRECONDITION(aMultiMixedConv != nsnull, "null ptr");
    if (! aMultiMixedConv)
        return NS_ERROR_NULL_POINTER;

    *aMultiMixedConv = new nsMultiMixedConv();
    if (! *aMultiMixedConv)
        return NS_ERROR_OUT_OF_MEMORY;

    NS_ADDREF(*aMultiMixedConv);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 662 of file nsStreamConverterService.cpp.

{
    NS_PRECONDITION(aStreamConv != nsnull, "null ptr");
    if (!aStreamConv) return NS_ERROR_NULL_POINTER;

    *aStreamConv = new nsStreamConverterService();
    if (!*aStreamConv) return NS_ERROR_OUT_OF_MEMORY;

    NS_ADDREF(*aStreamConv);
    nsresult rv = (*aStreamConv)->Init();
    if (NS_FAILED(rv))
        NS_RELEASE(*aStreamConv);

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void PR_CALLBACK nsNetShutdown ( nsIModule neckoModule) [static]

Definition at line 610 of file nsNetModule.cpp.

{
    // Release the url parser that the stdurl is holding.
    nsStandardURL::ShutdownGlobalObjects();

    // Release buffer cache
    NS_IF_RELEASE(nsIOService::gBufferCache);

    // Release global state used by the URL helper module.
    net_ShutdownURLHelper();

    // Release necko strings
    delete gNetStrings;
    gNetStrings = nsnull;
}

Here is the call graph for this function:

Definition at line 602 of file nsNetModule.cpp.

{
    gNetStrings = new nsNetStrings();
    return gNetStrings ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
static NS_METHOD RegisterStreamConverters ( nsIComponentManager aCompMgr,
nsIFile aPath,
const char *  registryLocation,
const char *  componentType,
const nsModuleComponentInfo info 
) [static]

Definition at line 320 of file nsNetModule.cpp.

                                                            {
    nsresult rv;
    nsCOMPtr<nsICategoryManager> catmgr =
        do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
    if (NS_FAILED(rv)) return rv;
    nsXPIDLCString previous;

    PRUint32 count = 0;
    while (count < g_StreamConverterCount) {
        (void) catmgr->AddCategoryEntry(NS_ISTREAMCONVERTER_KEY, g_StreamConverterArray[count],
                                      "", PR_TRUE, PR_TRUE, getter_Copies(previous));
        if (NS_FAILED(rv)) NS_ASSERTION(0, "adding a cat entry failed");
        count++;
    }
    
    return rv;
}

Here is the call graph for this function:

static NS_METHOD UnregisterStreamConverters ( nsIComponentManager aCompMgr,
nsIFile aPath,
const char *  registryLocation,
const nsModuleComponentInfo info 
) [static]

Definition at line 343 of file nsNetModule.cpp.

                                                              {
    nsresult rv;
    nsCOMPtr<nsICategoryManager> catmgr =
        do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
    if (NS_FAILED(rv)) return rv;


    PRUint32 count = 0;
    while (count < g_StreamConverterCount) {
        rv = catmgr->DeleteCategoryEntry(NS_ISTREAMCONVERTER_KEY, 
                                         g_StreamConverterArray[count], 
                                         PR_TRUE);
        if (NS_FAILED(rv)) return rv;
        count++;
    }
    return rv;
}

Here is the call graph for this function:


Variable Documentation

PRUint32 g_StreamConverterCount = sizeof(g_StreamConverterCount)/sizeof(const char*) [static]

Definition at line 311 of file nsNetModule.cpp.

Definition at line 626 of file nsNetModule.cpp.