diff --git a/mozilla/lib/libnet/bamwrap.cpp b/mozilla/lib/libnet/bamwrap.cpp new file mode 100755 index 00000000000..4532a54d512 --- /dev/null +++ b/mozilla/lib/libnet/bamwrap.cpp @@ -0,0 +1,342 @@ +/* -*- 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 + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + + +#include "net.h" +#include "structs.h" +#include "ctxtfunc.h" + +#include "nsIStreamNotification.h" +#include "net_strm.h" + +/****************************************************************************/ +/* Beginning of MWContext Evil!!! */ +/* ------------------------------- */ +/* */ +/* Define a dummy MWContext where all of the upcalls are stubbed out. */ +/* */ +/****************************************************************************/ + +PRIVATE int +stub_noop(int x, ...) +{ +#ifdef XP_MAC +#pragma unused (x) +#endif +/* DebugBreak(); */ + return 0; +} + +#define MAKE_FE_TYPES_PREFIX(func) func##_t +#define MAKE_FE_FUNCS_TYPES +#include "mk_cx_fn.h" +#undef MAKE_FE_FUNCS_TYPES + +#define stub_CreateNewDocWindow (CreateNewDocWindow_t)stub_noop +#define stub_LayoutNewDocument (LayoutNewDocument_t)stub_noop +#define stub_SetDocTitle (SetDocTitle_t)stub_noop +#define stub_FinishedLayout (FinishedLayout_t)stub_noop +#define stub_TranslateISOText (TranslateISOText_t)stub_noop +#define stub_GetTextInfo (GetTextInfo_t)stub_noop +#define stub_MeasureText (MeasureText_t)stub_noop +#define stub_GetEmbedSize (GetEmbedSize_t)stub_noop +#define stub_GetJavaAppSize (GetJavaAppSize_t)stub_noop +#define stub_GetFormElementInfo (GetFormElementInfo_t)stub_noop +#define stub_GetFormElementValue (GetFormElementValue_t)stub_noop +#define stub_ResetFormElement (ResetFormElement_t)stub_noop +#define stub_SetFormElementToggle (SetFormElementToggle_t)stub_noop +#define stub_FreeFormElement (FreeFormElement_t)stub_noop +#define stub_FreeImageElement (FreeImageElement_t)stub_noop +#define stub_FreeEmbedElement (FreeEmbedElement_t)stub_noop +#define stub_FreeJavaAppElement (FreeJavaAppElement_t)stub_noop +#define stub_CreateEmbedWindow (CreateEmbedWindow_t)stub_noop +#define stub_SaveEmbedWindow (SaveEmbedWindow_t)stub_noop +#define stub_RestoreEmbedWindow (RestoreEmbedWindow_t)stub_noop +#define stub_DestroyEmbedWindow (DestroyEmbedWindow_t)stub_noop +#define stub_HideJavaAppElement (HideJavaAppElement_t)stub_noop +#define stub_FreeEdgeElement (FreeEdgeElement_t)stub_noop +#define stub_FormTextIsSubmit (FormTextIsSubmit_t)stub_noop +#define stub_DisplaySubtext (DisplaySubtext_t)stub_noop +#define stub_DisplayText (DisplayText_t)stub_noop +#define stub_DisplayImage (DisplayImage_t)stub_noop +#define stub_DisplayEmbed (DisplayEmbed_t)stub_noop +#define stub_DisplayJavaApp (DisplayJavaApp_t)stub_noop +#define stub_DisplaySubImage (DisplaySubImage_t)stub_noop +#define stub_DisplayEdge (DisplayEdge_t)stub_noop +#define stub_DisplayTable (DisplayTable_t)stub_noop +#define stub_DisplayCell (DisplayCell_t)stub_noop +#define stub_InvalidateEntireTableOrCell (InvalidateEntireTableOrCell_t)stub_noop +#define stub_DisplayAddRowOrColBorder (DisplayAddRowOrColBorder_t)stub_noop +#define stub_DisplaySubDoc (DisplaySubDoc_t)stub_noop +#define stub_DisplayLineFeed (DisplayLineFeed_t)stub_noop +#define stub_DisplayHR (DisplayHR_t)stub_noop +#define stub_DisplayBullet (DisplayBullet_t)stub_noop +#define stub_DisplayFormElement (DisplayFormElement_t)stub_noop +#define stub_DisplayBorder (DisplayBorder_t)stub_noop +#define stub_UpdateEnableStates (UpdateEnableStates_t)stub_noop +#define stub_DisplayFeedback (DisplayFeedback_t)stub_noop +#define stub_ClearView (ClearView_t)stub_noop +#define stub_SetDocDimension (SetDocDimension_t)stub_noop +#define stub_SetDocPosition (SetDocPosition_t)stub_noop +#define stub_GetDocPosition (GetDocPosition_t)stub_noop +#define stub_BeginPreSection (BeginPreSection_t)stub_noop +#define stub_EndPreSection (EndPreSection_t)stub_noop +#define stub_SetProgressBarPercent (SetProgressBarPercent_t)stub_noop +#define stub_SetBackgroundColor (SetBackgroundColor_t)stub_noop +#define stub_Progress (Progress_t)stub_noop +#define stub_Alert (Alert_t)stub_noop +#define stub_SetCallNetlibAllTheTime (SetCallNetlibAllTheTime_t)stub_noop +#define stub_ClearCallNetlibAllTheTime (ClearCallNetlibAllTheTime_t)stub_noop +#define stub_GraphProgressInit (GraphProgressInit_t)stub_noop +#define stub_GraphProgressDestroy (GraphProgressDestroy_t)stub_noop +#define stub_GraphProgress (GraphProgress_t)stub_noop +#define stub_UseFancyFTP (UseFancyFTP_t)stub_noop +#define stub_UseFancyNewsgroupListing (UseFancyNewsgroupListing_t)stub_noop +#define stub_FileSortMethod (FileSortMethod_t)stub_noop +#define stub_ShowAllNewsArticles (ShowAllNewsArticles_t)stub_noop +#define stub_Confirm (Confirm_t)stub_noop +#define stub_Prompt (Prompt_t)stub_noop +#define stub_PromptWithCaption (PromptWithCaption_t)stub_noop +#define stub_PromptUsernameAndPassword (PromptUsernameAndPassword_t)stub_noop +#define stub_PromptPassword (PromptPassword_t)stub_noop +#define stub_EnableClicking (EnableClicking_t)stub_noop +#define stub_AllConnectionsComplete (AllConnectionsComplete_t)stub_noop +#define stub_ImageSize (ImageSize_t)stub_noop +#define stub_ImageData (ImageData_t)stub_noop +#define stub_ImageIcon (ImageIcon_t)stub_noop +#define stub_ImageOnScreen (ImageOnScreen_t)stub_noop +#define stub_SetColormap (SetColormap_t)stub_noop +#ifdef LAYERS +#define stub_EraseBackground (EraseBackground_t)stub_noop +#define stub_SetDrawable (SetDrawable_t)stub_noop +#define stub_GetTextFrame (GetTextFrame_t)stub_noop +#define stub_SetClipRegion (SetClipRegion_t)stub_noop +#define stub_SetOrigin (SetOrigin_t)stub_noop +#define stub_GetOrigin (GetOrigin_t)stub_noop +#define stub_GetTextFrame (GetTextFrame_t)stub_noop +#endif + +#define stub_GetDefaultBackgroundColor (GetDefaultBackgroundColor_t)stub_noop +#define stub_LoadFontResource (LoadFontResource_t)stub_noop + +#define stub_DrawJavaApp (DrawJavaApp_t)stub_noop +#define stub_HandleClippingView (HandleClippingView_t)stub_noop + +/* Just reuse the same set of context functions: */ +ContextFuncs stub_context_funcs; + +MWContext *new_stub_context() +{ + static int funcsInitialized = 0; + MWContext *context; + + if (!funcsInitialized) { +#define MAKE_FE_FUNCS_PREFIX(f) stub_##f +#define MAKE_FE_FUNCS_ASSIGN stub_context_funcs. +#include "mk_cx_fn.h" + + funcsInitialized = 1; + } + + context = (MWContext *)calloc(sizeof(struct MWContext_), 1); + + context->funcs = &stub_context_funcs; + context->type = MWContextBrowser; + + return context; +} + +void free_stub_context(MWContext *window_id) +{ + TRACEMSG(("Freeing stub context...\n")); + free(window_id); +} + + +/****************************************************************************/ +/* End of MWContext Evil!!! */ +/****************************************************************************/ + +#if 0 + +typedef struct NetlibEvent_OnDataAvailable { + PREvent ce; + stream_connection_t *pStreamInfo; +} NetlibEvent_OnDataAvailable; + +PR_STATIC_CALLBACK(void) +bam_HandleEvent_OnDataAvailable(NetlibEvent_OnDataAvailable* e) +{ + pStreamInfo->pConsumer->OnDataAvailable(pStreamInfo->pNetStream); +} + +PRIVATE void +bam_OnDataAvailable(stream_connection_t *stream_info) +{ + NetlibEvent_OnDataAvailable* event; + + event = PR_NEW(NetlibEvent_OnDataAvailable); + if (event == NULL) goto done; + PL_InitEvent(&event->ce, stream_info, + (PLHandleEventProc)bam_HandleEvent_OnDataAvailable, + (PLDestroyEventProc)bam_DestroyEvent_GenericEvent); + event->pStreamInfo = stream_info; + PL_PostEvent(netlib_event_queue, &event->ce); + + done: +} + + +#endif /* 0 */ + + +/* + * Define a NET_StreamClass which pushes its data into an nsIStream + * and fires off notifications through the nsIStreamNotification interface + */ + +void stub_complete(NET_StreamClass *stream) +{ + nsConnectionInfo *pConn = (nsConnectionInfo *)stream->data_object; + + TRACEMSG(("+++ stream complete.\n")); + + pConn->pNetStream->Close(); + + /* Notify the Data Consumer that the Binding has completed... */ + if (pConn->pConsumer) { + pConn->pConsumer->OnStopBinding(); + pConn->pConsumer->Release(); + pConn->pConsumer = NULL; + } + + /* Free the nsConnectionInfo object hanging off of the data_object */ + pConn->pNetStream->Release(); + pConn->pNetStream = NULL; + pConn->Release(); + stream->data_object = NULL; +} + +void stub_abort(NET_StreamClass *stream, int status) +{ + TRACEMSG(("+++ stream abort. Status = %d\n", status)); +} + +int stub_put_block(NET_StreamClass *stream, const char *buffer, int32 length) +{ + PRInt32 bytesWritten; + nsConnectionInfo *pConn = (nsConnectionInfo *)stream->data_object; + + TRACEMSG(("+++ stream put_block. Length = %d\n", length)); + + bytesWritten = pConn->pNetStream->Write(buffer, length); + + /* XXX: check return value to abort connection if necessary */ + if (pConn->pConsumer) { + pConn->pConsumer->OnDataAvailable(pConn->pNetStream); + } + + PR_ASSERT(bytesWritten == length); + return (bytesWritten == length); +} + +unsigned int stub_is_write_ready(NET_StreamClass *stream) +{ + unsigned int free_space = 0; + nsConnectionInfo *pConn = (nsConnectionInfo *)stream->data_object; + + free_space = (unsigned int)pConn->pNetStream->GetAvailableSpace(); + + TRACEMSG(("+++ stream is_write_ready. Returning %d\n", free_space)); + return free_space; +} + + +extern "C" { + +/* + *Find a converter routine to create a stream and return the stream struct + */ +PUBLIC NET_StreamClass * +NET_StreamBuilder (FO_Present_Types format_out, + URL_Struct *URL_s, + MWContext *context) +{ +// MOZ_FUNCTION_STUB; + NET_StreamClass *stream = NULL; + PRBool bSuccess = PR_TRUE; + + /* + * Only create a stream if an nsConnectionInfo object is + * available from the fe_data... + */ + if (NULL != URL_s->fe_data) { + stream = (NET_StreamClass *)calloc(sizeof(NET_StreamClass), 1); + + if (NULL != stream) { + nsConnectionInfo *pConn; + + /* + * Initialize the NET_StreamClass instance... + */ + stream->name = "Stub Stream"; + stream->window_id = context; + + stream->complete = stub_complete; + stream->abort = stub_abort; + stream->put_block = stub_put_block; + stream->is_write_ready = stub_is_write_ready; + + /* + * Create a stream_connection struct to hold the information + * about the connection progress... + * + * Remember to AddRef() the objects because we are storing + * references to them... + */ + pConn = (nsConnectionInfo *)URL_s->fe_data; + + /* + * Create an Async stream unless a blocking stream is already + * available in the ConnectionInfo... + */ + if (NULL == pConn->pNetStream) { + pConn->pNetStream = new nsAsyncStream(8192); + if (NULL == pConn->pNetStream) { + free(stream); + return NULL; + } + pConn->pNetStream->AddRef(); + } + + /* Hang the stream_connection off of the NET_StreamClass */ + stream->data_object = pConn; + pConn->AddRef(); + + /* Notify the data consumer that Binding is beginning...*/ + /* XXX: check result to terminate connection if necessary */ + if (pConn->pConsumer) { + pConn->pConsumer->OnStartBinding(); + } + } + } + + return stream; +} + +}; /* extern "C" */ diff --git a/mozilla/lib/libnet/depend.c b/mozilla/lib/libnet/depend.c new file mode 100755 index 00000000000..cb642aa370e --- /dev/null +++ b/mozilla/lib/libnet/depend.c @@ -0,0 +1,1761 @@ +/* -*- 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 + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/* + * + * This file provides stubs for all external APIs used by Netlib + * which are not client specific (ie. MOZILLA_CLIENT). + * + */ + +/* #define USE_SECURITY_STUBS */ +/* #define USE_JS_STUBS */ +/* #define USE_PREF_STUBS */ +#include "depend.h" + + +#include "nspr.h" +#include "net.h" +#include "pwcacapi.h" +#include "prefapi.h" +#include "xp_file.h" + +#if defined(USE_SECURITY_STUBS) +#include "key.h" +#else +#include "secnav.h" +#endif + +#include "xp_reg.h" +#include "libi18n.h" +#include "libevent.h" +// #include "layout.h" +#include "mkgeturl.h" + +/* + *--------------------------------------------------------------------------- + * These protocol initialization routines are stubs for the protocols which + * could be cleanly removed... (see makefile.win) + *--------------------------------------------------------------------------- + */ + +MODULE_PRIVATE void +NET_InitGopherProtocol(void) +{ +} + +MODULE_PRIVATE void +NET_InitFTPProtocol(void) +{ +} + +MODULE_PRIVATE void +NET_InitMochaProtocol(void) +{ +} + +MODULE_PRIVATE void +NET_InitRemoteProtocol(void) +{ +} + +MODULE_PRIVATE void +NET_InitDataURLProtocol(void) +{ +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libmisc/glhist.c + *--------------------------------------------------------------------------- + */ + +PUBLIC void +GH_UpdateGlobalHistory(URL_Struct * URL_s) +{ + MOZ_FUNCTION_STUB; +} + + +/* clear the global history list + */ +PUBLIC void +GH_ClearGlobalHistory(void) +{ + MOZ_FUNCTION_STUB; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libmisc/shist.c + *--------------------------------------------------------------------------- + */ + + +PUBLIC History_entry * +SHIST_GetCurrent(History * hist) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libpwcac/pwcacapi.c + *--------------------------------------------------------------------------- + */ + +/* returns value for a given name + */ +char * +PC_FindInNameValueArray(PCNameValueArray *array, char *name) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* returns a PCNameValueArray from serialized char data. + * + * returns NULL on error + */ +PUBLIC PCNameValueArray * +PC_CharToNameValueArray(char *data, int32 len) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +PUBLIC int +PC_PromptUsernameAndPassword(MWContext *context, + char *prompt, + char **username, + char **password, + XP_Bool *remember, + XP_Bool is_secure) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +PUBLIC char * +PC_PromptPassword(MWContext *context, + char *prompt, + XP_Bool *remember, + XP_Bool is_secure) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* takes a key string as input and returns a name value array + * + * A module name is also passed in to guarentee that a key from + * another module is never returned by an accidental key match. + */ +PUBLIC PCNameValueArray * +PC_CheckForStoredPasswordArray(char *module, char *key) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* stores a name value array in the password database + * returns 0 on success + */ +PUBLIC int +PC_StorePasswordNameValueArray(char *module, char *key, PCNameValueArray *array) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +/* adds to end of name value array + * + * Possible to add duplicate names with this + */ +PUBLIC int +PC_AddToNameValueArray(PCNameValueArray *array, char *name, char *value) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +PUBLIC PCNameValueArray * +PC_NewNameValueArray() +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +PUBLIC void +PC_FreeNameValueArray(PCNameValueArray *array) +{ + MOZ_FUNCTION_STUB; +} + + + +/* returns 0 on success else -1 + */ +PUBLIC int +PC_DeleteStoredPassword(char *module, char *key) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +/* returns 0 on success -1 on error */ +PUBLIC int +PC_RegisterDataInterpretFunc(char *module, PCDataInterpretFunc *func) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + + +#if defined(USE_PREF_STUBS) +/* + *--------------------------------------------------------------------------- + * From ns/modules/libpref/src/prefapi.c + *--------------------------------------------------------------------------- + */ + +PR_IMPLEMENT(int) +PREF_GetIntPref(const char *pref_name,int32 * return_int) +{ + MOZ_FUNCTION_STUB; + return PREF_ERROR; +} + + +PR_IMPLEMENT(int) +PREF_GetBoolPref(const char *pref_name, XP_Bool * return_value) +{ + MOZ_FUNCTION_STUB; + return PREF_ERROR; +} + + +PR_IMPLEMENT(int) +PREF_GetCharPref(const char *pref_name, char * return_buffer, int * length) +{ + MOZ_FUNCTION_STUB; + return PREF_ERROR; +} + + +PR_IMPLEMENT(int) +PREF_SetIntPref(const char *pref_name, int32 value) +{ + MOZ_FUNCTION_STUB; + return PREF_NOT_INITIALIZED; +} + + +/* Adds a node to the beginning of the callback list. */ +PR_IMPLEMENT(void) +PREF_RegisterCallback(const char *pref_node, + PrefChangedFunc callback, + void * instance_data) +{ + MOZ_FUNCTION_STUB; +} + + +PR_IMPLEMENT(int) +PREF_GetConfigInt(const char *obj_name, int32 *return_int) +{ + MOZ_FUNCTION_STUB; + return PREF_ERROR; +} + + +PR_IMPLEMENT(int) +PREF_GetConfigContext(JSContext **js_context) +{ + MOZ_FUNCTION_STUB; + return FALSE; +} + + +/* + * Administration Kit support + */ +PR_IMPLEMENT(int) +PREF_CopyConfigString(const char *obj_name, char **return_buffer) +{ + MOZ_FUNCTION_STUB; + return PREF_ERROR; +} + + +PR_IMPLEMENT(int) +PREF_CopyCharPref(const char *pref_name, char ** return_buffer) +{ + MOZ_FUNCTION_STUB; + return PREF_ERROR; +} + + +PR_IMPLEMENT(int) +PREF_GetGlobalConfigObject(JSObject **js_object) +{ + MOZ_FUNCTION_STUB; + return FALSE; +} + + +PR_IMPLEMENT(char *) +PREF_AboutConfig() +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +PR_IMPLEMENT(int) +PREF_EvaluateJSBuffer(const char * js_buffer, size_t length) +{ + MOZ_FUNCTION_STUB; + return 0; /* really a JSBool */ +} + +#endif /* USE_PREF_STUBS */ + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/fegui.cpp + *--------------------------------------------------------------------------- + */ + +// +// Open a file with the given name +// If a special file type is provided we might need to get the name +// out of the preferences list +// +PUBLIC XP_File +XP_FileOpen(const char * name, XP_FileType type, const XP_FilePerm perm) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +// +// Return 0 on success, -1 on failure. Silly unix weenies +// +PUBLIC int +XP_FileRemove(const char * name, XP_FileType type) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +// +// Mimic unix stat call +// Return -1 on error +// +PUBLIC int +XP_Stat(const char * name, XP_StatStruct * info, XP_FileType type) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +// The caller is responsible for XP_FREE()ing the return string +PUBLIC char * +WH_FileName (const char *name, XP_FileType type) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +char * +WH_TempName(XP_FileType type, const char * prefix) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +PUBLIC XP_Dir +XP_OpenDir(const char * name, XP_FileType type) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +// +// Close the directory +// +PUBLIC void +XP_CloseDir(XP_Dir dir) +{ + MOZ_FUNCTION_STUB; +} + + +PUBLIC XP_DirEntryStruct * +XP_ReadDir(XP_Dir dir) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + + +PUBLIC void * +FE_AboutData (const char *which, + char **data_ret, int32 *length_ret, char **content_type_ret) +{ + MOZ_FUNCTION_STUB; + + *data_ret = NULL; + *length_ret = 0; + *content_type_ret = NULL; + + return NULL; +} + + +PUBLIC void +FE_FreeAboutData (void * data, const char* which2) +{ + MOZ_FUNCTION_STUB; +} + + +PUBLIC void +FE_Trace(const char * msg) +{ + /* This used to be just TRACE(msg), but that's a mistake -- + * if msg happens to have a '%' in it, TRACE will + * interpret the '%' as the beginning of an argument to be + * printf'd and look up the stack and try to + * interpret random data as the argument. At a minimum this + * leads to corrupt trace info. Usually it causes bus errors. + */ + printf("%s", msg); +// MOZ_FUNCTION_STUB; +} + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/fenet.cpp + *--------------------------------------------------------------------------- + */ + +int FE_AsyncDNSLookup(MWContext *context, char * host_port, PRHostEnt ** hoststruct_ptr_ptr, PRFileDesc *socket) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +// INTL_ResourceCharSet(void) +// +char *INTL_ResourceCharSet(void) +{ + MOZ_FUNCTION_STUB; + + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/cfe.cpp + *--------------------------------------------------------------------------- + */ + +void FE_Alert(MWContext *pContext, const char *pMsg) +{ + MOZ_FUNCTION_STUB; +} + + +int32 FE_GetContextID(MWContext *pContext) +{ + MOZ_FUNCTION_STUB; + return 0; +} + + +XP_Bool FE_IsNetcasterInstalled(void) +{ + MOZ_FUNCTION_STUB; + return FALSE; +} + + +// A Url has changed context. +// We need to mark it in the new context if it has ncapi_data (which we use +// to track such things under windows). +void FE_UrlChangedContext(URL_Struct *pUrl, MWContext *pOldContext, MWContext *pNewContext) +{ + MOZ_FUNCTION_STUB; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/urlecho.cpp + *--------------------------------------------------------------------------- + */ +void FE_URLEcho(URL_Struct *pURL, int iStatus, MWContext *pContext) { +// Purpose: Echo the URL to all appropriately registered applications that are monitoring such URL traffic. +// Arguments: pURL The URL which is being loaded. +// iStatus The status of the load. +// pContext The context in which the load occurred. +// Returns: void +// Comments: Well, sometimes there isn't a window in which the load occurred, what to do then? +// Just don't report. +// Revision History: +// 01-18-95 created GAB +// + MOZ_FUNCTION_STUB; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/edview2.cpp + *--------------------------------------------------------------------------- + */ + +// Note: This is used by Navigator's HTP UPLOAD as well as Composer's file saving +// DON'T ASSUME ANY EDITOR FUNCTIONALITY! +// Dialog to give feedback and allow canceling, overwrite protection +// when downloading remote files +// +void FE_SaveDialogCreate( MWContext *pMWContext, int iFileCount, ED_SaveDialogType saveType ) +{ + MOZ_FUNCTION_STUB; +} + + +void FE_SaveDialogSetFilename( MWContext *pMWContext, char *pFilename ) +{ + MOZ_FUNCTION_STUB; +} + + +void FE_SaveDialogDestroy( MWContext *pMWContext, int status, char *pFileURL ) +{ + MOZ_FUNCTION_STUB; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/compmapi.cpp + *--------------------------------------------------------------------------- + */ +void FE_AlternateCompose( + char * from, char * reply_to, char * to, char * cc, char * bcc, + char * fcc, char * newsgroups, char * followup_to, + char * organization, char * subject, char * references, + char * other_random_headers, char * priority, + char * attachment, char * newspost_url, char * body) +{ + MOZ_FUNCTION_STUB; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/nethelp.cpp + *--------------------------------------------------------------------------- + */ +MWContext *FE_GetNetHelpContext() +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +// Called from mkhelp.c to get the standard location of the NetHelp folder as a URL +char * FE_GetNetHelpDir() +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/femess.cpp + *--------------------------------------------------------------------------- + */ +int FE_GetURL(MWContext *pContext, URL_Struct *pUrl) +{ + MOZ_FUNCTION_STUB; + + return -1; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/fmabstra.cpp + *--------------------------------------------------------------------------- + */ +void FE_RaiseWindow(MWContext *pContext) +{ + MOZ_FUNCTION_STUB; +} + + + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/fegrid.cpp + *--------------------------------------------------------------------------- + */ +// Create a new window. +// If pChrome is NULL, do a FE_MakeBlankWindow.... +// pChrome specifies the attributes of a window. +// If you use this call, Toolbar information will not be saved in the preferences. +MWContext *FE_MakeNewWindow(MWContext *pOldContext, URL_Struct *pUrl, char *pContextName, Chrome *pChrome) +{ + MOZ_FUNCTION_STUB; + + return NULL; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/timer.cpp + *--------------------------------------------------------------------------- + */ +/* this function should register a function that will + * be called after the specified interval of time has + * elapsed. This function should return an id + * that can be passed to FE_ClearTimeout to cancel + * the Timeout request. + * + * A) Timeouts never fail to trigger, and + * B) Timeouts don't trigger *before* their nominal timestamp expires, and + * C) Timeouts trigger in the same ordering as their timestamps + * + * After the function has been called it is unregistered + * and will not be called again unless re-registered. + * + * func: The function to be invoked upon expiration of + * the Timeout interval + * closure: Data to be passed as the only argument to "func" + * msecs: The number of milli-seconds in the interval + */ +PUBLIC void * +FE_SetTimeout(TimeoutCallbackFunction func, void * closure, uint32 msecs) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libmocha/et_moz.c + *--------------------------------------------------------------------------- + */ + +JSBool +ET_PostMessageBox(MWContext* context, char* szMessage, JSBool bConfirm) +{ + MOZ_FUNCTION_STUB; + return JS_FALSE; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libmocha/et_mocha.c + *--------------------------------------------------------------------------- + */ +/* + * A mocha stream from netlib has compeleted, eveluate the contents + * and pass them up our stream. We will take ownership of the + * buf argument and are responsible for freeing it + */ +void +ET_MochaStreamComplete(MWContext * pContext, void * buf, int len, + char *content_type, Bool isUnicode) +{ + MOZ_FUNCTION_STUB; +} + + +/* + * A mocha stream from netlib has aborted + */ +void +ET_MochaStreamAbort(MWContext * context, int status) +{ + MOZ_FUNCTION_STUB; +} + + +/* + * Evaluate the given script. I'm sure this is going to need a + * callback or compeletion routine + */ +void +ET_EvaluateScript(MWContext * pContext, char * buffer, ETEvalStuff * stuff, + ETEvalAckFunc fn) +{ + MOZ_FUNCTION_STUB; +} + + +void +ET_SetDecoderStream(MWContext * pContext, NET_StreamClass *stream, + URL_Struct *url_struct, JSBool free_stream_on_close) +{ + MOZ_FUNCTION_STUB; +} + + +/* + * Tell the backend about a new load event. + */ +void +ET_SendLoadEvent(MWContext * pContext, int32 type, ETVoidPtrFunc fnClosure, + NET_StreamClass *stream, int32 layer_id, Bool resize_reload) +{ + MOZ_FUNCTION_STUB; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libmocha/lm_init.c + *--------------------------------------------------------------------------- + */ + +void +LM_PutMochaDecoder(MochaDecoder *decoder) +{ + MOZ_FUNCTION_STUB; +} + + +MochaDecoder * +LM_GetMochaDecoder(MWContext *context) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + * Release the JSLock + */ +void PR_CALLBACK +LM_UnlockJS() +{ + MOZ_FUNCTION_STUB; +} + + +/* + * Try to get the JSLock but just return JS_FALSE if we can't + * get it, don't wait since we could deadlock + */ +JSBool PR_CALLBACK +LM_AttemptLockJS(JSLockReleaseFunc fn, void * data) +{ + MOZ_FUNCTION_STUB; + return JS_FALSE; +} + + +JSBool PR_CALLBACK +LM_ClearAttemptLockJS(JSLockReleaseFunc fn, void * data) +{ + MOZ_FUNCTION_STUB; + return JS_FALSE; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libmocha/lm_doc.c + *--------------------------------------------------------------------------- + */ + +NET_StreamClass * +LM_WysiwygCacheConverter(MWContext *context, URL_Struct *url_struct, + const char * wysiwyg_url, const char * base_href) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libmocha/lm_win.c + *--------------------------------------------------------------------------- + */ +/* + * Entry point for front-ends to notify JS code of help events. + */ +void +LM_SendOnHelp(MWContext *context) +{ + MOZ_FUNCTION_STUB; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libmocha/lm_taint.c + *--------------------------------------------------------------------------- + */ +char lm_unknown_origin_str[] = "[unknown origin]"; + +JSPrincipals * +LM_NewJSPrincipals(URL_Struct *archive, char *id, const char *codebase) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +#if defined(USE_SECURITY_STUBS) +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/util/alg1113.c + *--------------------------------------------------------------------------- + */ + +char * +BTOA_DataToAscii(const unsigned char *anything, unsigned int ilen) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +unsigned char * +ATOB_AsciiToData(const char *anything, unsigned int *olenp) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + +#endif /* USE_SECURITY_STUBS */ + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/util/algrand.c + *--------------------------------------------------------------------------- + */ +SECStatus +RNG_GenerateGlobalRandomBytes(void *data, size_t bytes) +{ + MOZ_FUNCTION_STUB; + return SECFailure; +} + + +#if defined(USE_SECURITY_STUBS) +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/util/secalg.c + *--------------------------------------------------------------------------- + */ + +SECOidTag +SECOID_GetAlgorithmTag(SECAlgorithmID *id) +{ + MOZ_FUNCTION_STUB; + return SEC_OID_UNKNOWN; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/key/seckey.c + *--------------------------------------------------------------------------- + */ + +void +SECKEY_DestroyPrivateKey(SECKEYPrivateKey *privk) +{ + MOZ_FUNCTION_STUB; +} + +#endif /* USE_SECURITY_STUBS */ + + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/cert/pcertdb.c + *--------------------------------------------------------------------------- + */ + +void +CERT_DestroyCertificate(CERTCertificate *cert) +{ + MOZ_FUNCTION_STUB; +} + + +CERTCertificate * +CERT_DupCertificate(CERTCertificate *c) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/cert/certdb.c + *--------------------------------------------------------------------------- + */ + +CERTCertDBHandle * +CERT_GetDefaultCertDB(void) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +#if defined(USE_SECURITY_STUBS) +/* +** CERT_CertChainFromCert +** +** Construct a CERTCertificateList consisting of the given certificate and all +** of the issuer certs until we either get to a self-signed cert or can't find +** an issuer. Since we don't know how many certs are in the chain we have to +** build a linked list first as we count them. +*/ + +CERTCertificateList * +CERT_CertChainFromCert(CERTCertDBHandle *handle, CERTCertificate *cert) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +void +CERT_DestroyCertificateList(CERTCertificateList *list) +{ + MOZ_FUNCTION_STUB; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/cypto/secsign.c + *--------------------------------------------------------------------------- + */ + + +/* +** Sign a block of data returning in result a bunch of bytes that are the +** signature. Returns zero on success, an error code on failure. +*/ +SECStatus +SEC_SignData(SECItem *res, unsigned char *buf, int len, + SECKEYPrivateKey *pk, SECOidTag algid) +{ + MOZ_FUNCTION_STUB; + return SECFailure; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/hash/algsha.c + *--------------------------------------------------------------------------- + */ + +SHA1Context * +SHA1_NewContext(void) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +void +SHA1_DestroyContext(SHA1Context *cx, PRBool freeit) +{ + MOZ_FUNCTION_STUB; +} + + +void +SHA1_Begin(SHA1Context *ctx) +{ + MOZ_FUNCTION_STUB; +} + + +void +SHA1_Update(SHA1Context *ctx, const unsigned char *dataIn, unsigned len) +{ + MOZ_FUNCTION_STUB; +} + + +void +SHA1_End(SHA1Context *ctx, unsigned char *hashout, + unsigned int *pDigestLen, unsigned int maxDigestLen) +{ + MOZ_FUNCTION_STUB; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/pkcs11/pk11slot.c + *--------------------------------------------------------------------------- + */ + + +SECStatus +PK11_GenerateRandom(unsigned char *data,int len) { + MOZ_FUNCTION_STUB; + return SECFailure; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/pkcs11/pk11cert.c + *--------------------------------------------------------------------------- + */ + +SECKEYPrivateKey * +PK11_FindKeyByAnyCert(CERTCertificate *cert, void *wincx) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +CERTCertificate * +PK11_FindCertFromNickname(char *nickname, void *wincx) { + MOZ_FUNCTION_STUB; + return NULL; +} + + + + +/* + *--------------------------------------------------------------------------- + * From ns/modules/security/nav/secmoz.c + *--------------------------------------------------------------------------- + */ + +SECStatus +SECNAV_GetDefProxyCert(char **proxycertname) +{ + MOZ_FUNCTION_STUB; + + *proxycertname = NULL; + return SECSuccess; +} + +#endif /* USE_SECURITY_STUBS */ + +PRBool +SECNAV_SecurityDialog(MWContext *context, int state) +{ + MOZ_FUNCTION_STUB; + return FALSE; +} + + +/* + *--------------------------------------------------------------------------- + * From ??? + *--------------------------------------------------------------------------- + */ + +SECStatus +SECNAV_ComputeFortezzaProxyChallengeResponse(MWContext *context, + char *asciiChallenge, + char **signature_out, + char **clientRan_out, + char **certChain_out) +{ + return(SECFailure); +} + +#if defined(USE_SECURITY_STUBS) +/* + *--------------------------------------------------------------------------- + * From ns/modules/security/nav/premime.c + *--------------------------------------------------------------------------- + */ + +/* + * set the fd in our object to access SSLSocket if needed + */ +void +SECNAV_SetPreencryptedSocket(void *data, PRFileDesc *fd) +{ + MOZ_FUNCTION_STUB; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/ssl/sslsock.c + *--------------------------------------------------------------------------- + */ +int +SSL_Enable(PRFileDesc *s, int which, int on) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +PRFileDesc * +SSL_ImportFD(PRFileDesc *model, PRFileDesc *fd) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/ssl/sslsocks.c + *--------------------------------------------------------------------------- + */ +int +SSL_ConfigSockd(PRFileDesc *s, unsigned long host, short port) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/ssl/sslsecur.c + *--------------------------------------------------------------------------- + */ +int +SSL_ForceHandshake(PRFileDesc *fd) +{ + MOZ_FUNCTION_STUB; + return 0; +} +#endif /* USE_SECURITY_STUBS */ + + +#if defined(USE_JS_STUBS) +/* + *--------------------------------------------------------------------------- + * From ns/js/src/jsapi.c + *--------------------------------------------------------------------------- + */ +PR_IMPLEMENT(JSBool) +JS_PropertyStub(JSContext *cx, JSObject *obj, jsval id, jsval *vp) +{ + MOZ_FUNCTION_STUB; + return JS_TRUE; +} + + +PR_IMPLEMENT(JSBool) +JS_EnumerateStub(JSContext *cx, JSObject *obj) +{ + MOZ_FUNCTION_STUB; + return JS_TRUE; +} + + +PR_IMPLEMENT(JSBool) +JS_ResolveStub(JSContext *cx, JSObject *obj, jsval id) +{ + MOZ_FUNCTION_STUB; + return JS_TRUE; +} + + +PR_IMPLEMENT(JSBool) +JS_ConvertStub(JSContext *cx, JSObject *obj, JSType type, jsval *vp) +{ + MOZ_FUNCTION_STUB; + return JS_FALSE; +} + + +PR_IMPLEMENT(void) +JS_FinalizeStub(JSContext *cx, JSObject *obj) +{ + MOZ_FUNCTION_STUB; +} + + +PR_IMPLEMENT(JSBool) +JS_CallFunctionName(JSContext *cx, JSObject *obj, const char *name, uintN argc, + jsval *argv, jsval *rval) +{ + MOZ_FUNCTION_STUB; + return FALSE; +} + + +PR_IMPLEMENT(JSBool) +JS_EvaluateScript(JSContext *cx, JSObject *obj, + const char *bytes, uintN length, + const char *filename, uintN lineno, + jsval *rval) +{ + MOZ_FUNCTION_STUB; + return JS_FALSE; +} + + +PR_IMPLEMENT(JSObject *) +JS_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +PR_IMPLEMENT(JSObject *) +JS_DefineObject(JSContext *cx, JSObject *obj, const char *name, JSClass *clasp, + JSObject *proto, uintN flags) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +PR_IMPLEMENT(JSBool) +JS_DefineFunctions(JSContext *cx, JSObject *obj, JSFunctionSpec *fs) +{ + MOZ_FUNCTION_STUB; + return JS_FALSE; +} + + +PR_IMPLEMENT(JSBool) +JS_DefineProperties(JSContext *cx, JSObject *obj, JSPropertySpec *ps) +{ + MOZ_FUNCTION_STUB; + return JS_FALSE; +} + + +PR_IMPLEMENT(JSBool) +JS_AddRoot(JSContext *cx, void *rp) +{ + MOZ_FUNCTION_STUB; + return JS_FALSE; +} + + +PR_IMPLEMENT(JSBool) +JS_RemoveRoot(JSContext *cx, void *rp) +{ + MOZ_FUNCTION_STUB; + return JS_FALSE; +} + + +PR_IMPLEMENT(char *) +JS_GetStringBytes(JSString *str) +{ + MOZ_FUNCTION_STUB; + return ""; +} + + +PR_IMPLEMENT(JSString *) +JS_NewString(JSContext *cx, char *bytes, size_t length) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +PR_IMPLEMENT(JSString *) +JS_NewStringCopyZ(JSContext *cx, const char *s) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +PR_IMPLEMENT(void *) +JS_GetPrivate(JSContext *cx, JSObject *obj) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +PR_IMPLEMENT(JSBool) +JS_SetPrivate(JSContext *cx, JSObject *obj, void *data) +{ + MOZ_FUNCTION_STUB; + return FALSE; +} + + +PR_IMPLEMENT(void *) +JS_GetInstancePrivate(JSContext *cx, JSObject *obj, JSClass *clasp, + jsval *argv) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +PR_IMPLEMENT(JSBool) +JS_ValueToBoolean(JSContext *cx, jsval v, JSBool *bp) +{ + MOZ_FUNCTION_STUB; + return FALSE; +} + + +PR_IMPLEMENT(JSBool) +JS_ValueToInt32(JSContext *cx, jsval v, int32 *ip) +{ + MOZ_FUNCTION_STUB; + return FALSE; +} + + +PR_IMPLEMENT(JSString *) +JS_ValueToString(JSContext *cx, jsval v) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +PR_IMPLEMENT(JSErrorReporter) +JS_SetErrorReporter(JSContext *cx, JSErrorReporter er) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +PR_IMPLEMENT(JSBool) +JS_InitStandardClasses(JSContext *cx, JSObject *obj) +{ + MOZ_FUNCTION_STUB; + return FALSE; +} + + +PR_IMPLEMENT(void) +JS_GC(JSContext *cx) +{ + MOZ_FUNCTION_STUB; +} + +#endif /* !USE_JS_STUBS */ + +/* + *--------------------------------------------------------------------------- + * From ns/lib/xp/xp_reg.c + *--------------------------------------------------------------------------- + */ + + +PUBLIC int +XP_RegExpMatch(char *str, char *xp, Bool case_insensitive) +{ + MOZ_FUNCTION_STUB; + return 1; +} + + +PUBLIC int +XP_RegExpValid(char *exp) +{ + MOZ_FUNCTION_STUB; + return INVALID_SXP; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/xp/xp_trace.c + *--------------------------------------------------------------------------- + */ + +/* Trace with trailing newline */ +void XP_Trace (const char* message, ...) +{ + MOZ_FUNCTION_STUB; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/xp/xplocale.c + *--------------------------------------------------------------------------- + */ + +const char* INTL_ctime(MWContext* context, time_t *date) +{ + static char result[40]; + + MOZ_FUNCTION_STUB; + *result = '\0'; + return result; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/xp/xp_cntxt.c + *--------------------------------------------------------------------------- + */ + +/* + * Finds a context that should be loaded with the URL, given + * a name and current (refering) context. + * + * If the context returned is not NULL, name is already assigned to context + * structure. You should load the URL into this context. + * + * If you get back a NULL, you should create a new window + * + * Both context and current context can be null. + * Once the grids are in, there should be some kind of a logic that searches + * siblings first. + */ + +MWContext * XP_FindNamedContextInList(MWContext * context, char *name) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +MWContext* +XP_FindSomeContext() +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/xp/xp_time.c + *--------------------------------------------------------------------------- + */ +/* This parses a time/date string into a time_t + (seconds after "1-Jan-1970 00:00:00 GMT") + If it can't be parsed, 0 is returned. + + Many formats are handled, including: + + 14 Apr 89 03:20:12 + 14 Apr 89 03:20 GMT + Fri, 17 Mar 89 4:01:33 + Fri, 17 Mar 89 4:01 GMT + Mon Jan 16 16:12 PDT 1989 + Mon Jan 16 16:12 +0130 1989 + 6 May 1992 16:41-JST (Wednesday) + 22-AUG-1993 10:59:12.82 + 22-AUG-1993 10:59pm + 22-AUG-1993 12:59am + 22-AUG-1993 12:59 PM + Friday, August 04, 1995 3:54 PM + 06/21/95 04:24:34 PM + 20/06/95 21:07 + 95-06-08 19:32:48 EDT + + If the input string doesn't contain a description of the timezone, + we consult the `default_to_gmt' to decide whether the string should + be interpreted relative to the local time zone (FALSE) or GMT (TRUE). + The correct value for this argument depends on what standard specified + the time string which you are parsing. + */ +time_t +XP_ParseTimeString (const char *string, XP_Bool default_to_gmt) +{ + MOZ_FUNCTION_STUB; + return 0; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/plugin/npglue.c + *--------------------------------------------------------------------------- + */ + +/* + * This exit routine is used for all streams requested by the + * plug-in: byterange request streams, NPN_GetURL streams, and + * NPN_PostURL streams. NOTE: If the exit routine gets called + * in the course of a context switch, we must NOT delete the + * URL_Struct. Example: FTP post with result from server + * displayed in new window -- the exit routine will be called + * when the upload completes, but before the new context to + * display the result is created, since the display of the + * results in the new context gets its own completion routine. + */ +void +NPL_URLExit(URL_Struct *urls, int status, MWContext *cx) +{ + MOZ_FUNCTION_STUB; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/layout/layedit.c + *--------------------------------------------------------------------------- + */ + +void LO_SetBaseURL( MWContext *context, char *pURL ) +{ + MOZ_FUNCTION_STUB; +} + + +#if 0 +/* + *--------------------------------------------------------------------------- + * From ns/lib/layout/laysel.c + *--------------------------------------------------------------------------- + */ +/* + get first(last) if current element is NULL. +*/ +Bool +LO_getNextTabableElement( MWContext *context, LO_TabFocusData *pCurrentFocus, int forward ) +{ + MOZ_FUNCTION_STUB; + return FALSE; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/layout/laygrid.c + *--------------------------------------------------------------------------- + */ +lo_GridCellRec * +lo_ContextToCell(MWContext *context, Bool reconnect, lo_GridRec **grid_ptr) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + +#endif + +/* + *--------------------------------------------------------------------------- + * From ns/modules/libfont/src/wfStream.cpp + *--------------------------------------------------------------------------- + */ + +char * +/*ARGSUSED*/ +NF_AboutFonts(MWContext *context, const char *which) +{ + MOZ_FUNCTION_STUB; + + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libi18n/csnamefn.c + *--------------------------------------------------------------------------- + */ +int16 +INTL_CharSetNameToID(char *charset) +{ + MOZ_FUNCTION_STUB; + return 0; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libi18n/ucs2.c + *--------------------------------------------------------------------------- + */ +uint32 INTL_TextToUnicode( + INTL_Encoding_ID encoding, + unsigned char* src, + uint32 srclen, + INTL_Unicode* ustr, + uint32 ubuflen +) +{ + MOZ_FUNCTION_STUB; + return 0; +} + + +uint32 INTL_TextToUnicodeLen( + INTL_Encoding_ID encoding, + unsigned char* src, + uint32 srclen +) +{ + MOZ_FUNCTION_STUB; + return 0; +} + + + + + +/* + * Random libnet functions... + */ +#ifdef DEBUG +MODULE_PRIVATE void +NET_DisplayStreamInfoAsHTML(ActiveEntry *cur_entry) +{ + MOZ_FUNCTION_STUB; +} +#endif /* DEBUG */ + + + +PUBLIC int +NET_ParseNetHelpURL(URL_Struct *URL_s) +{ + MOZ_FUNCTION_STUB; +/* return MK_OUT_OF_MEMORY; */ + return -207; +} + + +/* Enable or disable the prefetching, called from NET_SetupPrefs in mkgeturl.c */ +PUBLIC void +PRE_Enable(XP_Bool enabled) +{ + MOZ_FUNCTION_STUB; +} + + + +CERTCertificate * +SSL_PeerCertificate(PRFileDesc *fd) +{ + MOZ_FUNCTION_STUB; + return(NULL); +} + + +int +SSL_SetSockPeerID(PRFileDesc *fd, char *peerID) +{ + MOZ_FUNCTION_STUB; + return(0); +} + + +int +SSL_SecurityStatus(PRFileDesc *fd, int *on, char **cipher, + int *keySize, int *secretKeySize, + char **issuer, char **subject) +{ + MOZ_FUNCTION_STUB; + return(0); +} + + +void +SECNAV_HTTPHead(PRFileDesc *fd) +{ + MOZ_FUNCTION_STUB; +} + + +void +SECNAV_Posting(PRFileDesc *fd) +{ + MOZ_FUNCTION_STUB; +} + + +PRBool +CERT_CompareCertsForRedirection(CERTCertificate *c1, CERTCertificate *c2) +{ + MOZ_FUNCTION_STUB; + return(PR_FALSE); +} + + + + +void HACK_SetAppCodeName(char *name) +{ + XP_AppCodeName = strdup(name); +} + +void HACK_SetAppVersion(char *ver) +{ + XP_AppVersion = strdup(ver); +} diff --git a/mozilla/lib/libnet/depend.h b/mozilla/lib/libnet/depend.h new file mode 100755 index 00000000000..08f9be7bdea --- /dev/null +++ b/mozilla/lib/libnet/depend.h @@ -0,0 +1,24 @@ +/* -*- 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 + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#if 0 +#define MOZ_FUNCTION_STUB \ + DebugBreak(); +#else +#define MOZ_FUNCTION_STUB +#endif diff --git a/mozilla/lib/libnet/makefile.win b/mozilla/lib/libnet/makefile.win new file mode 100644 index 00000000000..7646b6d27c8 --- /dev/null +++ b/mozilla/lib/libnet/makefile.win @@ -0,0 +1,124 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +NODEPEND=1 +IGNORE_MANIFEST = 1 + +#//------------------------------------------------------------------------ +#// +# New build system where zip dll is build indepenant of java stubs. +#// +#//------------------------------------------------------------------------ +MODULE = netlib +EXPORTS = nsIStreamNotification.h \ + nsINetService.h \ + $(NULL) + + +#//------------------------------------------------------------------------ +#// +#// Specify the depth of the current directory relative to the +#// root of NS +#// +#//------------------------------------------------------------------------ +DEPTH= ..\..\ + +MAKE_OBJ_TYPE=DLL +#//------------------------------------------------------------------------ +#// +#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...) +#// +#//------------------------------------------------------------------------ +DLLNAME=netlib.dll +PDBFILE=netlib.pdb +MAPFILE=netlib.map +DEFFILE=net.def + +#//------------------------------------------------------------------------ +#// +#// Define the files necessary to build the target (ie. OBJS) +#// +#//------------------------------------------------------------------------ +OBJS= \ + .\$(OBJDIR)\bamwrap.obj \ + .\$(OBJDIR)\net_serv.obj \ + .\$(OBJDIR)\net_strm.obj \ + .\$(OBJDIR)\depend.obj \ + .\$(OBJDIR)\moz_depend.obj \ + .\$(OBJDIR)\mkgeturl.obj \ + .\$(OBJDIR)\mkconect.obj \ + .\$(OBJDIR)\mksockrw.obj \ + .\$(OBJDIR)\mkselect.obj \ + .\$(OBJDIR)\mkcache.obj \ + .\$(OBJDIR)\mkmemcac.obj \ + .\$(OBJDIR)\extcache.obj \ + .\$(OBJDIR)\mkextcac.obj \ + .\$(OBJDIR)\mkpadpac.obj \ + .\$(OBJDIR)\mkautocf.obj \ + .\$(OBJDIR)\mkaccess.obj \ + .\$(OBJDIR)\mkformat.obj \ + .\$(OBJDIR)\jscookie.obj \ + .\$(OBJDIR)\mkparse.obj \ + .\$(OBJDIR)\mkutils.obj \ + .\$(OBJDIR)\mkfsort.obj \ + .\$(OBJDIR)\mksort.obj \ + .\$(OBJDIR)\mkmessag.obj \ + .\$(OBJDIR)\mktrace.obj \ + .\$(OBJDIR)\mkhttp.obj \ + .\$(OBJDIR)\mkfile.obj \ + $(NULL) +#//------------------------------------------------------------------------ +#// +#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...) +#// (these must be defined before the common makefiles are included) +#// +#//------------------------------------------------------------------------ + +DLL=.\$(OBJDIR)\$(DLLNAME) + +#//------------------------------------------------------------------------ +#// +#// Define any local options for the make tools +#// (ie. LCFLAGS, LLFLAGS, LLIBS, LINCS) +#// +#//------------------------------------------------------------------------ +LCFLAGS=-DNETSCAPE -DB1M +LLIBS=$(LLIBS) $(LIBNSPR) \ + $(DIST)\lib\js3240.lib \ + $(DIST)\lib\xppref32.lib \ + $(DIST)\lib\xpcom32.lib \ + $(DIST)\lib\xplib.lib +LINCS=$(LINCS) -I. \ + -I$(DEPTH)\raptor\base\src \ + -I$(PUBLIC)\security \ + -I$(PUBLIC)\pref \ + -I$(PUBLIC)\js \ + -I$(PUBLIC)\xpcom \ + $(NULL) + +# clobber and clobber_all will remove the following garbage: +GARBAGE = $(GARBAGE) _gen + + +#//------------------------------------------------------------------------ +#// +#// Include the common makefile rules +#// +#//------------------------------------------------------------------------ +include <$(DEPTH)/config/rules.mak> + +export:: $(DLL) + $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME) $(DIST)\bin + $(MAKE_INSTALL) .\$(OBJDIR)\netlib.lib $(DIST)\lib diff --git a/mozilla/lib/libnet/moz_depend.cpp b/mozilla/lib/libnet/moz_depend.cpp new file mode 100755 index 00000000000..6074401ccef --- /dev/null +++ b/mozilla/lib/libnet/moz_depend.cpp @@ -0,0 +1,1240 @@ +/* -*- 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 + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "depend.h" + +#include "nspr.h" +#include "libi18n.h" +#if 0 +#include "key.h" +#else +#include "secnav.h" +#endif +#include "xp_hash.h" +#include "libimg.h" +#include "il_strm.h" +#include "jsapi.h" + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libi18n/intl_csi.c + *--------------------------------------------------------------------------- + */ + +extern "C" { + +/* Meta charset is weakest. Only set doc_csid if no http or override */ +void +INTL_SetCSIDocCSID (INTL_CharSetInfo c, int16 doc_csid) +{ + MOZ_FUNCTION_STUB; +} + + +int16 +INTL_GetCSIDocCSID(INTL_CharSetInfo c) +{ + MOZ_FUNCTION_STUB; + return 0; +} + + +void +INTL_SetCSIWinCSID(INTL_CharSetInfo c, int16 win_csid) +{ + MOZ_FUNCTION_STUB; +} + + +int16 +INTL_GetCSIWinCSID(INTL_CharSetInfo c) +{ + MOZ_FUNCTION_STUB; + return 0; +} + + +INTL_CharSetInfo +LO_GetDocumentCharacterSetInfo(MWContext *context) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libi18n/acptlang.c + *--------------------------------------------------------------------------- + */ + +/* INTL_GetAcceptCharset() */ +/* return the AcceptCharset from XP Preference */ +/* this should be a C style NULL terminated string */ +char* INTL_GetAcceptCharset() +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* INTL_GetAcceptLanguage() */ +/* return the AcceptLanguage from XP Preference */ +/* this should be a C style NULL terminated string */ +char* INTL_GetAcceptLanguage() +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libi18n/net_junk.c + *--------------------------------------------------------------------------- + */ +PUBLIC Stream * +INTL_ConvCharCode (int format_out, + void *data_obj, + URL_Struct *URL_s, + MWContext *mwcontext) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libi18n/cvchcode.c + *--------------------------------------------------------------------------- + */ + +/* INTL_GetCharCodeConverter: + * RETURN: 1 if converter found, else 0 + * Also, sets: + * obj->cvtfunc: function handle for chararcter + * code set streams converter + * obj->cvtflag: (Optional) flag to converter + * function + * obj->from_csid: Code set converting from + * obj->to_csid: Code set converting to + * If the arg to_csid==0, then use the the conversion for the + * first conversion entry that matches the from_csid. + */ +int +INTL_GetCharCodeConverter(register int16 from_csid, + register int16 to_csid, + CCCDataObject obj) +{ + MOZ_FUNCTION_STUB; + return 0; +} + + +CCCDataObject +INTL_CreateCharCodeConverter() +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +unsigned char * +INTL_CallCharCodeConverter(CCCDataObject obj, const unsigned char *buf, + int32 bufsz) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +void +INTL_DestroyCharCodeConverter(CCCDataObject obj) +{ + MOZ_FUNCTION_STUB; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libi18n/fe_ccc.c + *--------------------------------------------------------------------------- + */ +/* + INTL_DocToWinCharSetID, + Based on DefaultDocCSID, it determines which Win CSID to use for Display +*/ +/* + + To Do: (ftang) + + We should seperate the DocToWinCharSetID logic from the cscvt_t table + for Cyrillic users. + +*/ +int16 INTL_DocToWinCharSetID(int16 csid) +{ + MOZ_FUNCTION_STUB; + return CS_FE_ASCII; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libi18n/doc_ccc.c + *--------------------------------------------------------------------------- + */ + +PUBLIC void INTL_CCCReportMetaCharsetTag(MWContext *context, char *charset_tag) +{ + MOZ_FUNCTION_STUB; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libi18n/intl_csi.c + *--------------------------------------------------------------------------- + */ +/* ----------- Mime CSID ----------- */ +char * +INTL_GetCSIMimeCharset (INTL_CharSetInfo c) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libparse/pa_hash.c + *--------------------------------------------------------------------------- + */ + +/************************************* + * Function: pa_tokenize_tag + * + * Description: This function maps the passed in string + * to one of the valid tag element tokens, or to + * the UNKNOWN token. + * + * Params: Takes a \0 terminated string. + * + * Returns: a 32 bit token to describe this tag element. On error, + * which means it was not passed an unknown tag element string, + * it returns the token P_UNKNOWN. + * + * Performance Notes: + * Profiling on mac revealed this routine as a big (5%) time sink. + * This function was stolen from pa_mdl.c and merged with the perfect + * hashing code and the tag comparison code so it would be flatter (fewer + * function calls) since those are still expensive on 68K and x86 machines. + *************************************/ + +intn +pa_tokenize_tag(char *str) +{ + MOZ_FUNCTION_STUB; + return -1; /* P_UNKNOWN */; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libparse/pa_parse.c + *--------------------------------------------------------------------------- + */ + +/************************************* + * Function: PA_BeginParseMDL + * + * Description: The outside world's main access to the parser. + * call this when you are going to start parsing + * a new document to set up the parsing stream. + * This function cannot be called successfully + * until PA_ParserInit() has been called. + * + * Params: Takes lots of document information that is all + * ignored right now, just used the window_id to create + * a unique document id. + * + * Returns: a pointer to a new NET_StreamClass structure, set up to + * give the caller a parsing stream into the parser. + * Returns NULL on error. + *************************************/ +NET_StreamClass * +PA_BeginParseMDL(FO_Present_Types format_out, + void *init_data, URL_Struct *anchor, MWContext *window_id) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +#if 0 +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/cert/certdb.c + *--------------------------------------------------------------------------- + */ +PRBool +CERT_CompareCertsForRedirection(CERTCertificate *c1, CERTCertificate *c2) +{ + MOZ_FUNCTION_STUB; + return PR_FALSE; +} + +#endif /* 0 */ + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/cert/pcertdb.c + *--------------------------------------------------------------------------- + */ + +/* + * Decode a certificate and enter it into the temporary certificate database. + * Deal with nicknames correctly + * + * nickname is only used if isperm == PR_TRUE + */ +CERTCertificate * +CERT_NewTempCertificate(CERTCertDBHandle *handle, SECItem *derCert, + char *nickname, PRBool isperm, PRBool copyDER) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/cert/certhtml.c + *--------------------------------------------------------------------------- + */ +char * +CERT_HTMLCertInfo(CERTCertificate *cert, PRBool showImages, PRBool showIssuer) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/security/lib/hash/algmd5.c + *--------------------------------------------------------------------------- + */ +SECStatus +MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length) +{ + MOZ_FUNCTION_STUB; + return SECFailure; +} + + +#if 0 +/* + *--------------------------------------------------------------------------- + * From ns/modules/security/nav/secmoz.c + *--------------------------------------------------------------------------- + */ +int +SECNAV_SetupSecureSocket(PRFileDesc *fd, char *url, MWContext *cx) +{ + MOZ_FUNCTION_STUB; + return -1; +} + +#endif /* 0 */ + +void +SECNAV_HandleInternalSecURL(URL_Struct *url, MWContext *cx) +{ + MOZ_FUNCTION_STUB; +} + + +char * +SECNAV_MakeCertButtonString(CERTCertificate *cert) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/modules/security/nav/securl.c + *--------------------------------------------------------------------------- + */ + + /* + * send the data for the given about:security url to the given stream + */ +int +SECNAV_SecURLData(char *which, NET_StreamClass *stream, MWContext *cx) +{ + MOZ_FUNCTION_STUB; + return SECFailure; +} + + +char * +SECNAV_SecURLContentType(char *which) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +int +SECNAV_SecHandleSecurityAdvisorURL(MWContext *cx, const char *which) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +#if 0 +/* + *--------------------------------------------------------------------------- + * From ns/modules/security/nav/premime.c + *--------------------------------------------------------------------------- + */ + +/* + * set up a stream for reading in preencrypted files + */ +NET_StreamClass * +SECNAV_MakePreencryptedStream(FO_Present_Types format_out, void *data, + URL_Struct *url, MWContext *window_id) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/modules/security/nav/certmime.c + *--------------------------------------------------------------------------- + */ + +/* + * set up a stream for downloading certificates + */ +NET_StreamClass * +SECNAV_CrlStream(FO_Present_Types format_out, void *data, + URL_Struct *urls, MWContext *cx) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + + +/* + * set up a stream for downloading revocation information + */ +NET_StreamClass * +SECNAV_RevocationStream(FO_Present_Types format_out, void *data, + URL_Struct *urls, MWContext *cx) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + + +/* + * set up a stream for downloading certificates + */ +NET_StreamClass * +SECNAV_CertificateStream(FO_Present_Types format_out, void *data, + URL_Struct *urls, MWContext *cx) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + +#endif /* 0 */ + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/authdll.cpp + *--------------------------------------------------------------------------- + */ +char * WFE_BuildCompuserveAuthString(URL_Struct *URL_s) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +int +WFE_DoCompuserveAuthenticate(MWContext *context, + URL_Struct *URL_s, + char *authenticate_header_value) +{ + MOZ_FUNCTION_STUB; + return NET_AUTH_FAILED_DONT_DISPLAY; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/regproto.cpp + *--------------------------------------------------------------------------- + */ + +// Purpose: See if we're supposed to handle a specific protocol differently. +// Arguments: pContext The context. +// iFormatOut The format out (possibly saving). +// pURL The URL to load. +// pExitFunc The URL exit routine. If we handle the protocol, we use the function. +//Returns: BOOL TRUE We want to handle the protocol here. +// FALSE Netlib continues to handle the protocol. +//Comments: To work with certain DDE topics which can cause URLs of a specific protocol type to be handled by another +// application. +//Revision History: +// 01-17-95 created GAB +// + +XP_Bool FE_UseExternalProtocolModule(MWContext *pContext, FO_Present_Types iFormatOut, URL_Struct *pURL, + Net_GetUrlExitFunc *pExitFunc) +{ + MOZ_FUNCTION_STUB; + return FALSE; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/femess.cpp + *--------------------------------------------------------------------------- + */ +// +// Prompt the user for a local file name +// +int FE_PromptForFileName(MWContext *context, + const char *prompt_string, + const char *default_path, + XP_Bool file_must_exist_p, + XP_Bool directories_allowed_p, + ReadFileNameCallbackFunction fn, + void *closure) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/fegui.cpp + *--------------------------------------------------------------------------- + */ +// Return some spanked out full path on the mac. +// For windows, we just return what was passed in. +// We must provide it in a seperate buffer, otherwise they might change +// the original and change also what they believe to be saved. +char *WH_FilePlatformName(const char *pName) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +// Purpose: Set a delayed load timer for a window for a particular URL. +// Arguments: pContext The context that we're in. We are only interested on wether or not there appears to be a Frame/hence document. +// ulSeconds The number of seconds that will pass before we attempt the reload. +// Returns: void +// Comments: +// Revision History: +// 02-17-95 created GAB +// 07-22-95 modified to use new context. +// 05-03-96 modified to use new API outside of idle loop. +// + +void FE_SetRefreshURLTimer(MWContext *pContext, uint32 ulSeconds, char *pRefreshUrl) +{ + MOZ_FUNCTION_STUB; +} + + +PUBLIC void +FE_ConnectToRemoteHost(MWContext * context, int url_type, char * + hostname, char * port, char * username) +{ + MOZ_FUNCTION_STUB; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/feutil.cpp + *--------------------------------------------------------------------------- + */ + +// The purpose of FEU_AhAhAhAhStayingAlive is to house the one and only +// saturday night fever function; named after Chouck's idol. +// This function will attempt to do all that is necessary in order +// to keep the application's messages flowing and idle loops +// going when we need to finish an asynchronous operation +// synchronously. +// The current cases that cause this are RPC calls into the +// application where we need to return a value or produce output +// from only one entry point before returning to the caller. +// +// If and when you modify this function, get your changes reviewed. +// It is too vital that this work, always. +// +// The function only attempts to look at one message at a time, or +// propigate one idle call at a time, keeping it's own idle count. +// This is not a loop. YOU must provide the loop which calls this function. +// +// Due to the nature and order of which we process windows messages, this +// can seriously mess with the flow of control through the client. +// If there is any chance at all that you can ensure that you are at the +// bottom of the message queue before doing this, then please take those +// measures. +void FEU_StayingAlive() +{ + MOZ_FUNCTION_STUB; +} + + + + +/* + *--------------------------------------------------------------------------- + * From ns/cmd/winfe/cfe.cpp + *--------------------------------------------------------------------------- + */ +void FE_RunNetcaster(MWContext *context) +{ + MOZ_FUNCTION_STUB; +} + + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libdbm/db.c + *--------------------------------------------------------------------------- + */ +DB * +dbopen(const char *fname, int flags,int mode, DBTYPE type, const void *openinfo) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/xp/xp_hash.c + *--------------------------------------------------------------------------- + */ + +/* create a hash list, which isn't really a table. + */ +PUBLIC XP_HashList * +XP_HashListNew (int size, + XP_HashingFunction hash_func, + XP_HashCompFunction comp_func) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + + /* free a hash list, which isn't really a table. + */ +PUBLIC void +XP_HashListDestroy (XP_HashList * hash_struct) +{ + MOZ_FUNCTION_STUB; +} + + +/* add an element to a hash list, which isn't really a table. + * + * returns positive on success and negative on failure + * + * ERROR return codes + * + * XP_HASH_DUPLICATE_OBJECT + */ +PUBLIC int +XP_HashListAddObject (XP_HashList * hash_struct, void * new_ele) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +/* removes an object by name from the hash list, which isn't really a table, + * and returns the object if found + */ +PUBLIC void * +XP_HashListRemoveObject (XP_HashList * hash_struct, void * ele) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* finds an object by name in the hash list, which isn't really a table. + */ +PUBLIC void * +XP_HashListFindObject (XP_HashList * hash_struct, void * ele) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* derived from Dragon book, p436 */ +PUBLIC uint32 +XP_StringHash (const void *xv) +{ + MOZ_FUNCTION_STUB; + return 0; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/xp/xp_cntxt.c + *--------------------------------------------------------------------------- + */ + + /* + * Finds a context that should be loaded with the URL, given + * a type and current (refering) context. Return NULL if there is none. + */ +MWContext * XP_FindContextOfType (MWContext * context, MWContextType type) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + * if the passed context is in the global context list + * TRUE is returned. Otherwise false + */ +Bool XP_IsContextInList(MWContext *context) +{ + MOZ_FUNCTION_STUB; + return FALSE; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/xp/xplocale.c + *--------------------------------------------------------------------------- + */ + +size_t XP_StrfTime(MWContext* context, char *result, size_t maxsize, int format, + const struct tm *timeptr) +{ + MOZ_FUNCTION_STUB; + return 0; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/xp/xp_sec.c + *--------------------------------------------------------------------------- + */ + + /* +** Take basic security key information and return an allocated string +** that contains a "pretty printed" version. +*/ +char *XP_PrettySecurityStatus(int level, char *cipher, int keySize, + int secretKeySize) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/layout/layutil.c + *--------------------------------------------------------------------------- + */ + + /* + * Return the width of the window for this context in chars in the default + * fixed width font. Return -1 on error. + */ +int16 +LO_WindowWidthInFixedChars(MWContext *context) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/layout/layinfo.c + *--------------------------------------------------------------------------- + */ + +/* + * Prepare a bunch of information about the content of this + * document and prints the information as HTML down + * the passed in stream. + * + * Returns: + * -1 If the context passed does not correspond to any currently + * laid out document. + * 0 If the context passed corresponds to a document that is + * in the process of being laid out. + * 1 If the context passed corresponds to a document that is + * completly laid out and info can be found. + */ +PUBLIC intn +LO_DocumentInfo(MWContext *context, NET_StreamClass *stream) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/layout/layobj.c + *--------------------------------------------------------------------------- + */ + +/* + * Create a new stream handler for dealing with a stream of + * object data. We don't really want to do anything with + * the data, we just need to check the type to see if this + * is some kind of object we can handle. If it is, we can + * format the right kind of object, clear the layout blockage, + * and connect this stream up to its rightful owner. + * NOTE: Plug-ins are the only object type supported here now. + */ +NET_StreamClass* +LO_NewObjectStream(FO_Present_Types format_out, void* type, + URL_Struct* urls, MWContext* context) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/layout/editor.cpp + *--------------------------------------------------------------------------- + */ + +// +// Hooked into the GetURL state machine. We do intermitent processing to +// let the layout engine to the initial processing and fetch all the nested +// images. +// +// Returns: 1 - Done ok, continuing. +// 0 - Done ok, stopping. +// -1 - not done, error. +// +intn EDT_ProcessTag(void *data_object, PA_Tag *tag, intn status) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/modules/libimg/src/if.c + *--------------------------------------------------------------------------- + */ + +/* + * determine what kind of image data we are dealing with + */ +int +IL_Type(const char *buf, int32 len) +{ + MOZ_FUNCTION_STUB; + return IL_NOTFOUND; +} + + +PRBool +IL_PreferredStream(URL_Struct *urls) +{ + MOZ_FUNCTION_STUB; + return PR_FALSE; +} + + +NET_StreamClass * +IL_NewStream (FO_Present_Types format_out, + void *type, + URL_Struct *urls, + OPAQUE_CONTEXT *cx) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/modules/libimg/src/ilclient.c + *--------------------------------------------------------------------------- + */ + +/* + * Create an HTML stream and generate HTML describing + * the image cache. Use "about:memory-cache" URL to acess. + */ +int +IL_DisplayMemCacheInfoAsHTML(FO_Present_Types format_out, URL_Struct *urls, + OPAQUE_CONTEXT *cx) +{ + MOZ_FUNCTION_STUB; + return 0; +} + + +char * +IL_HTMLImageInfo(char *url_address) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* Set limit on approximate size, in bytes, of all pixmap storage used + by the imagelib. */ +void +IL_SetCacheSize(uint32 new_size) +{ + MOZ_FUNCTION_STUB; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/modules/libimg/src/external.c + *--------------------------------------------------------------------------- + */ +NET_StreamClass * +IL_ViewStream(FO_Present_Types format_out, void *newshack, URL_Struct *urls, + OPAQUE_CONTEXT *cx) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libmisc/glhist.c + *--------------------------------------------------------------------------- + */ + +PUBLIC void +NET_RegisterEnableUrlMatchCallback(void) +{ + MOZ_FUNCTION_STUB; +} + + +/* start global history tracking + */ +PUBLIC void +GH_InitGlobalHistory(void) +{ + MOZ_FUNCTION_STUB; +} + + +/* save the global history to a file while leaving the object in memory + */ +PUBLIC void +GH_SaveGlobalHistory(void) +{ + MOZ_FUNCTION_STUB; +} + + + +/* create an HTML stream and push a bunch of HTML about + * the global history + */ +MODULE_PRIVATE int +NET_DisplayGlobalHistoryInfoAsHTML(MWContext *context, + URL_Struct *URL_s, + int format_out) +{ + MOZ_FUNCTION_STUB; + return MK_UNABLE_TO_CONVERT; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libmisc/shist.c + *--------------------------------------------------------------------------- + */ +PUBLIC int +SHIST_GetIndex(History * hist, History_entry * entry) +{ + MOZ_FUNCTION_STUB; + return -1; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/plugin/npglue.c + *--------------------------------------------------------------------------- + */ + +XP_Bool +NPL_HandleURL(MWContext *cx, FO_Present_Types iFormatOut, URL_Struct *pURL, Net_GetUrlExitFunc *pExitFunc) +{ + MOZ_FUNCTION_STUB; + return FALSE; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/libmocha/lm_taint.c + *--------------------------------------------------------------------------- + */ + +const char * +LM_SkipWysiwygURLPrefix(const char *url_string) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/lib/htmldlgs/htmldlgs.c + *--------------------------------------------------------------------------- + */ + +void +XP_HandleHTMLPanel(URL_Struct *url) +{ + MOZ_FUNCTION_STUB; +} + + +void +XP_HandleHTMLDialog(URL_Struct *url) +{ + MOZ_FUNCTION_STUB; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/nav-java/netscape/net/netStubs.c + *--------------------------------------------------------------------------- + */ + +#if 0 +JRI_PUBLIC_API(void) +NSN_RegisterJavaConverter(void) +{ + MOZ_FUNCTION_STUB; +} +#endif + +/* + *--------------------------------------------------------------------------- + * From ns/modules/softupdt/src/softupdt.c + *--------------------------------------------------------------------------- + */ + +/* New stream callback */ +/* creates the stream, and a opens up a temporary file */ +NET_StreamClass * SU_NewStream (int format_out, void * registration, + URL_Struct * request, MWContext *context) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/modules/libpref/src/prefapi.c + *--------------------------------------------------------------------------- + */ + +/* This is more recent than the below 3 routines which should be obsoleted */ +PR_IMPLEMENT(JSBool) +PREF_EvaluateConfigScript(const char * js_buffer, size_t length, + const char* filename, XP_Bool bGlobalContext, XP_Bool bCallbacks) +{ + MOZ_FUNCTION_STUB; + return JS_FALSE; +} + + +#if 0 +/* + *--------------------------------------------------------------------------- + * From ns/modules/netcast/src/_jri/netscape_netcast_NSMimeConnection.c + *--------------------------------------------------------------------------- + */ + +JRI_PUBLIC_API(struct netscape_netcast_NSMimeConnection*) +netscape_netcast_NSMimeConnection_new(JRIEnv* env, struct java_lang_Class* clazz, struct java_lang_String *a) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +JRI_PUBLIC_API(struct java_lang_Class*) +register_netscape_netcast_NSMimeConnection(JRIEnv* env) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/modules/netcast/src/_jri/netscape_netcast_NSTunerConnection.c + *--------------------------------------------------------------------------- + */ + +JRI_PUBLIC_API(struct netscape_netcast_NSTunerConnection*) +netscape_netcast_NSTunerConnection_new(JRIEnv* env, struct java_lang_Class* clazz, jint a, struct java_lang_String *b) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +JRI_PUBLIC_API(struct java_lang_Class*) +register_netscape_netcast_NSTunerConnection(JRIEnv* env) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + + +/* + *--------------------------------------------------------------------------- + * From ns/modules/netcast/src/_jri/netscape_netcast_NSCastanetEnvironment.c + *--------------------------------------------------------------------------- + */ + +JRI_PUBLIC_API(struct java_lang_Class*) +register_netscape_netcast_NSCastanetEnvironment(JRIEnv* env) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/modules/netcast/src/_jri/netscape_netcast_NSMD5.c + *--------------------------------------------------------------------------- + */ + +JRI_PUBLIC_API(struct java_lang_Class*) +register_netscape_netcast_NSMD5(JRIEnv* env) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/sun-java/runtime/jrijdk.c + *--------------------------------------------------------------------------- + */ +/* !!! This is a non-jump-table entry point: */ +JRI_PUBLIC_API(const JRIEnvInterface**) +JRI_GetCurrentEnv(void) +{ + MOZ_FUNCTION_STUB; + return NULL; +} + + +/* + *--------------------------------------------------------------------------- + * From ns/modules/applet/src/lj_init.c + *--------------------------------------------------------------------------- + */ + +/* +** Start up java. This reflects the mozilla nspr thread into java. It +** also prepares the interpreter for execution, and does all of the misc +** initialization the java runtime needs. +*/ +JRI_PUBLIC_API(LJJavaStatus) LJ_StartupJava(void) +{ + MOZ_FUNCTION_STUB; + return LJJavaStatus_Failed; +} + +#endif /* 0 */ + + +}; /* end of extern "C" */ diff --git a/mozilla/lib/libnet/net.def b/mozilla/lib/libnet/net.def new file mode 100755 index 00000000000..1de2bc40812 --- /dev/null +++ b/mozilla/lib/libnet/net.def @@ -0,0 +1,21 @@ +; The contents of this file are subject to the Netscape Public License +; Version 1.0 (the "NPL"); you may not use this file except in +; compliance with the NPL. You may obtain a copy of the NPL at +; http://www.mozilla.org/NPL/ +; +; Software distributed under the NPL is distributed on an "AS IS" basis, +; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +; for the specific language governing rights and limitations under the +; NPL. +; +; The Initial Developer of this code under the NPL is Netscape +; Communications Corporation. Portions created by Netscape are +; Copyright (C) 1998 Netscape Communications Corporation. All Rights +; Reserved. + +LIBRARY netlib.dll + +EXPORTS + NS_NewINetService + NET_ToggleTrace + NET_PollSockets diff --git a/mozilla/lib/libnet/net_serv.cpp b/mozilla/lib/libnet/net_serv.cpp new file mode 100755 index 00000000000..22c4c9fa792 --- /dev/null +++ b/mozilla/lib/libnet/net_serv.cpp @@ -0,0 +1,229 @@ +/* -*- 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 + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "net_serv.h" +#include "net_strm.h" +#include "net.h" +#include "mktrace.h" + +/* XXX: Legacy definitions... */ +MWContext *new_stub_context(); +void free_stub_context(MWContext *window_id); +void bam_exit_routine(URL_Struct *URL_s, int status, MWContext *window_id); + +extern "C" { +extern char *XP_AppCodeName; +extern char *XP_AppVersion; +}; + + +nsNetlibService::nsNetlibService() +{ + NS_INIT_REFCNT(); + + m_stubContext = new_stub_context(); + + /* Initialize netlib with 32 sockets... */ + NET_InitNetLib(0, 32); + + + /* XXX: How should the User Agent get initialized? */ + XP_AppCodeName = strdup("Mozilla"); + XP_AppVersion = strdup("1.0"); + +} + + +NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID); +NS_IMPL_ISUPPORTS(nsNetlibService,kINetServiceIID); + + +nsNetlibService::~nsNetlibService() +{ + TRACEMSG(("nsNetlibService is being destroyed...\n")); + + if (NULL == m_stubContext) { + free_stub_context((MWContext *)m_stubContext); + } + + NET_ShutdownNetLib(); +} + + +NS_IMETHODIMP nsNetlibService::OpenStream(const char *aUrl, + nsIStreamNotification *aConsumer) +{ + URL_Struct *URL_s; + nsConnectionInfo *pConn; + + /* Create a new dummy context for the URL load... */ + if ((NULL == m_stubContext) || (NULL == aConsumer)) { + return NS_FALSE; + } + + /* Create the nsConnectionInfo object... */ + pConn = new nsConnectionInfo(NULL, aConsumer); + if (NULL == pConn) { + return NS_FALSE; + } + pConn->AddRef(); + + /* Create the URLStruct... */ + URL_s = NET_CreateURLStruct(aUrl, NET_NORMAL_RELOAD); + if (NULL == URL_s) { + pConn->Release(); + return NS_FALSE; + } + + /* + * Mark the URL as background loading. This prevents many + * client upcall notifications... + */ + URL_s->load_background = TRUE; + + /* + * Attach the Data Consumer to the URL_Struct. + * + * Both the Data Consumer and the URL_Struct are freed in the + * bam_exit_routine(...) + */ + URL_s->fe_data = pConn; + pConn->AddRef(); + + /* Start the URL load... */ + NET_GetURL (URL_s, /* URL_Struct */ + FO_CACHE_AND_PRESENT, /* FO_Present_type */ + (MWContext *)m_stubContext, /* MWContext */ + bam_exit_routine); /* Exit routine... */ + + /* Remember, the URL_s may have been freed ! */ + + return NS_OK; +} + + +NS_IMETHODIMP nsNetlibService::OpenBlockingStream(const char *aUrl, + nsIStreamNotification *aConsumer, + nsIInputStream **aNewStream) +{ + URL_Struct *URL_s; + nsConnectionInfo *pConn; + + if (NULL != aNewStream) { + *aNewStream = NULL; + + /* Create the nsConnectionInfo object... */ + pConn = new nsConnectionInfo(NULL, aConsumer); + if (NULL == pConn) { + return NS_FALSE; + } + pConn->AddRef(); + + /* Create the blocking stream... */ + pConn->pNetStream = new nsBlockingStream(); + if (NULL == pConn->pNetStream) { + pConn->Release(); + } + pConn->pNetStream->AddRef(); + + *aNewStream = pConn->pNetStream; + pConn->pNetStream->AddRef(); + + /* Create the URLStruct... */ + URL_s = NET_CreateURLStruct(aUrl, NET_NORMAL_RELOAD); + if (NULL == URL_s) { + pConn->pNetStream->Release(); + pConn->Release(); + return NS_FALSE; + } + + /* + * Mark the URL as background loading. This prevents many + * client upcall notifications... + */ + URL_s->load_background = TRUE; + + /* + * Attach the Data Consumer to the URL_Struct. + * + * Both the Data Consumer and the URL_Struct are freed in the + * bam_exit_routine(...) + */ + URL_s->fe_data = pConn; + + /* Start the URL load... */ + NET_GetURL (URL_s, /* URL_Struct */ + FO_CACHE_AND_PRESENT, /* FO_Present_type */ + (MWContext *)m_stubContext, /* MWContext */ + bam_exit_routine); /* Exit routine... */ + + /* Remember, the URL_s may have been freed ! */ + + return NS_OK; + } + + return NS_FALSE; +} + + +extern "C" { +/* + * Factory for creating instance of the NetlibService... + */ +/* NS_BASE */ nsresult NS_NewINetService(nsINetService** aInstancePtrResult, + nsISupports* aOuter) +{ + static nsNetlibService *pNetlib = NULL; + + if (NULL != aOuter) { + return NS_ERROR_NO_AGGREGATION; + } + + /* XXX: For now only allow a single instance of the Netlib Service */ + if (NULL == pNetlib) { + pNetlib = new nsNetlibService(); + } + + if (NULL == pNetlib) { + return NS_ERROR_OUT_OF_MEMORY; + } + + return pNetlib->QueryInterface(kINetServiceIID, (void**)aInstancePtrResult); +} + +}; /* extern "C" */ + + +/* + * This is the generic exit routine for all URLs loaded via the new + * BAM APIs... + */ +static void bam_exit_routine(URL_Struct *URL_s, int status, MWContext *window_id) +{ + TRACEMSG(("bam_exit_routine was called...\n")); + + if (NULL != URL_s) { + /* Release the nsIstreamNotification object held in the URL_Struct. */ + nsIStreamNotification *pConsumer = (nsIStreamNotification *)URL_s->fe_data; + pConsumer->Release(); + + /* Delete the URL_Struct... */ + NET_FreeURLStruct(URL_s); + } +} + diff --git a/mozilla/lib/libnet/net_serv.h b/mozilla/lib/libnet/net_serv.h new file mode 100755 index 00000000000..03a01d7cd73 --- /dev/null +++ b/mozilla/lib/libnet/net_serv.h @@ -0,0 +1,47 @@ +/* -*- 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 + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef net_serv_h___ +#define net_serv_h___ + +#include "nspr.h" +#include "nsINetService.h" + +class nsNetlibService : public nsINetService { + +public: + NS_DECL_ISUPPORTS + + nsNetlibService(); + + /* Implementation of the nsINetService interface */ + NS_IMETHOD OpenStream(const char *aUrl, nsIStreamNotification *aConsumer); + NS_IMETHOD OpenBlockingStream(const char *aUrl, + nsIStreamNotification *aConsumer, + nsIInputStream **aNewStream); + +protected: + ~nsNetlibService(); + +private: + /* XXX: This is temporary until bamwrap.cpp is removed... */ + void *m_stubContext; +}; + + +#endif /* net_strm_h___ */ diff --git a/mozilla/lib/libnet/net_strm.cpp b/mozilla/lib/libnet/net_strm.cpp new file mode 100755 index 00000000000..9afcc7edb86 --- /dev/null +++ b/mozilla/lib/libnet/net_strm.cpp @@ -0,0 +1,542 @@ +/* -*- 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 + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "net_strm.h" +#include "net.h" +#include "mktrace.h" + + +/* XXX: Declare NET_PollSockets(...) for the blocking stream hack... */ +extern "C" { + XP_Bool NET_PollSockets(void); +}; + + +NS_DEFINE_IID(kIInputStreamIID, NS_IINPUTSTREAM_IID); + +#define BUFFER_BLOCK_SIZE 8192 + + + + +nsConnectionInfo::nsConnectionInfo(nsNetlibStream *pStream, + nsIStreamNotification *pNotify) +{ + pNetStream = pStream; + pConsumer = pNotify; +} + + +NS_IMPL_ISUPPORTS(nsConnectionInfo,kISupportsIID); + + +nsConnectionInfo::~nsConnectionInfo() +{ + TRACEMSG(("nsConnectionInfo is being destroyed...\n")); + + pNetStream = NULL; + pConsumer = NULL; +} + + + +nsNetlibStream::nsNetlibStream(void) +{ + NS_INIT_REFCNT(); + + m_Lock = PR_NewMonitor(); + m_bIsClosed = PR_FALSE; +} + + +NS_IMPL_ISUPPORTS(nsNetlibStream,kIInputStreamIID); + + +nsNetlibStream::~nsNetlibStream() +{ + if (m_Lock) { + PR_DestroyMonitor(m_Lock); + m_Lock = NULL; + } +} + + +void nsNetlibStream::Close() +{ + LockStream(); + m_bIsClosed = PR_TRUE; + UnlockStream(); +} + + + + +nsBufferedStream::nsBufferedStream(void) +{ + m_BufferLength = BUFFER_BLOCK_SIZE; + + m_Buffer = new char[m_BufferLength]; + /* If the allocation failed, mark the stream as closed... */ + if (NULL == m_Buffer) { + m_bIsClosed = PR_TRUE; + m_BufferLength = 0; + } + + m_DataLength = 0; + m_ReadOffset = m_WriteOffset = 0; +} + + + + +nsBufferedStream::~nsBufferedStream() +{ + TRACEMSG(("nsBufferedStream is being destroyed...\n")); + + if (m_Buffer) { + free(m_Buffer); + m_Buffer = NULL; + } +} + + +PRInt32 nsBufferedStream::GetAvailableSpace(void) +{ + PRInt32 size; + + LockStream(); + size = m_bIsClosed ? 0 : m_BufferLength - m_WriteOffset; + UnlockStream(); + + return size; +} + + +PRInt32 nsBufferedStream::Write(const char *aBuf, PRInt32 aLen) +{ + PRInt32 bytesWritten = 0; + PRInt32 bytesFree; + + LockStream(); + + NS_PRECONDITION((m_Buffer || m_bIsClosed), "m_Buffer is NULL!"); + NS_PRECONDITION((m_WriteOffset >= m_ReadOffset), "Read past the end of buffer."); + + if (!m_bIsClosed && aBuf) { + /* Grow the buffer if necessary */ + bytesFree = GetAvailableSpace(); + if (aLen > bytesFree) { + char *newBuffer; + + m_BufferLength += (((aLen - bytesFree) / BUFFER_BLOCK_SIZE)+1) * BUFFER_BLOCK_SIZE; + newBuffer = (char *)realloc(m_Buffer, m_BufferLength); + /* If the allocation failed, close the stream and free the buffer... */ + if (NULL == newBuffer) { + m_bIsClosed = PR_TRUE; + free(m_Buffer); + m_Buffer = NULL; + m_BufferLength = 0; + + goto done; + } else { + m_Buffer = newBuffer; + } + } + + memcpy(&m_Buffer[m_WriteOffset], aBuf, aLen); + m_WriteOffset += aLen; + + bytesWritten = aLen; + m_DataLength += aLen; + } + +done: + UnlockStream(); + + return bytesWritten; +} + + +PRInt32 nsBufferedStream::Read(PRInt32 *aErrorCode, + char *aBuf, + PRInt32 aOffset, + PRInt32 aCount) +{ + PRInt32 bytesRead = 0; + + LockStream(); + + NS_PRECONDITION((m_Buffer || m_bIsClosed), "m_Buffer is NULL!"); + NS_PRECONDITION((m_WriteOffset >= m_ReadOffset), "Read past the end of buffer."); + + /* Check for initial error conditions... */ + if (NULL == aBuf) { + *aErrorCode = NS_INPUTSTREAM_ILLEGAL_ARGS; + goto done; + } else if (m_bIsClosed && (0 == m_DataLength)) { + *aErrorCode = NS_INPUTSTREAM_EOF; + bytesRead = -1; + goto done; + } else { + *aErrorCode = 0; + } + + if (m_Buffer && m_DataLength) { + /* Skip the appropriate number of bytes in the input buffer... */ + if (aOffset) { + aBuf += aOffset; + } + + /* Do not read more data than there is available... */ + if (aCount > m_DataLength) { + aCount = m_DataLength; + } + + memcpy(aBuf, &m_Buffer[m_ReadOffset], aCount); + m_ReadOffset += aCount; + + bytesRead = aCount; + m_DataLength -= aCount; + } + +done: + UnlockStream(); + + return bytesRead; +} + + + + + + +nsAsyncStream::nsAsyncStream(PRInt32 buffer_size) +{ + m_BufferLength = buffer_size; + + m_Buffer = (char *)malloc(m_BufferLength); + /* If the allocation failed, mark the stream as closed... */ + if (NULL == m_Buffer) { + m_bIsClosed = PR_TRUE; + m_BufferLength = 0; + } + + m_DataLength = 0; + m_ReadOffset = m_WriteOffset = 0; +} + + +nsAsyncStream::~nsAsyncStream() +{ + TRACEMSG(("nsAsyncStream is being destroyed...\n")); + + if (m_Buffer) { + free(m_Buffer); + m_Buffer = NULL; + } +} + + +PRInt32 nsAsyncStream::GetAvailableSpace(void) +{ + PRInt32 size; + + LockStream(); + size = m_bIsClosed ? 0 : m_BufferLength - m_DataLength; + UnlockStream(); + + return size; +} + + +PRInt32 nsAsyncStream::Write(const char *aBuf, PRInt32 aLen) +{ + PRInt32 bytesWritten = 0; + PRInt32 bytesFree; + + LockStream(); + + NS_PRECONDITION((m_Buffer || m_bIsClosed), "m_Buffer is NULL!"); + + if (!m_bIsClosed && aBuf) { + /* Do not store more data than there is space for... */ + bytesFree = GetAvailableSpace(); + if (aLen > bytesFree) { + aLen = bytesFree; + } + + /* Storing the data will cause m_WriteOffset to wrap */ + if (m_WriteOffset + aLen > m_BufferLength) { + PRInt32 delta; + + /* Store the first chunk through the end of the buffer */ + delta = m_BufferLength - m_WriteOffset; + memcpy(&m_Buffer[m_WriteOffset], aBuf, delta); + + /* Store the second chunk from the beginning of the buffer */ + m_WriteOffset = aLen-delta; + memcpy(m_Buffer, &aBuf[delta], m_WriteOffset); + } else { + memcpy(&m_Buffer[m_WriteOffset], aBuf, aLen); + m_WriteOffset += aLen; + } + + bytesWritten = aLen; + m_DataLength += aLen; + } + + UnlockStream(); + + return bytesWritten; +} + + +PRInt32 nsAsyncStream::Read(PRInt32 *aErrorCode, + char *aBuf, + PRInt32 aOffset, + PRInt32 aCount) +{ + PRInt32 bytesRead = 0; + + LockStream(); + + NS_PRECONDITION((m_Buffer || m_bIsClosed), "m_Buffer is NULL!"); + + /* Check for initial error conditions... */ + if (NULL == aBuf) { + *aErrorCode = NS_INPUTSTREAM_ILLEGAL_ARGS; + goto done; + } else if (m_bIsClosed && (0 == m_DataLength)) { + *aErrorCode = NS_INPUTSTREAM_EOF; + bytesRead = -1; + goto done; + } else { + *aErrorCode = 0; + } + + if (m_Buffer && m_DataLength) { + /* Skip the appropriate number of bytes in the input buffer... */ + if (aOffset) { + aBuf += aOffset; + } + + /* Do not read more data than there is available... */ + if (aCount > m_DataLength) { + aCount = m_DataLength; + } + + /* Reading the data will cause m_ReadOffset to wrap */ + if (m_ReadOffset + aCount > m_BufferLength) { + PRInt32 delta; + + /* Read the first chunk through the end of the buffer */ + delta = m_BufferLength - m_ReadOffset; + memcpy(aBuf, &m_Buffer[m_ReadOffset], delta); + + /* Read the second chunk from the beginning of the buffer */ + m_ReadOffset = aCount-delta; + memcpy(&aBuf[delta], m_Buffer, m_ReadOffset); + } else { + memcpy(aBuf, &m_Buffer[m_ReadOffset], aCount); + m_ReadOffset += aCount; + } + + bytesRead = aCount; + m_DataLength -= aCount; + } + +done: + UnlockStream(); + + return bytesRead; +} + + + + + + + + + +nsBlockingStream::nsBlockingStream() +{ + m_BufferLength = BUFFER_BLOCK_SIZE; + + m_Buffer = (char *)malloc(m_BufferLength); + /* If the allocation failed, mark the stream as closed... */ + if (NULL == m_Buffer) { + m_bIsClosed = PR_TRUE; + m_BufferLength = 0; + } + + m_DataLength = 0; + m_ReadOffset = m_WriteOffset = 0; +} + + +nsBlockingStream::~nsBlockingStream() +{ + TRACEMSG(("nsBlockingStream is being destroyed...\n")); + + if (m_Buffer) { + free(m_Buffer); + m_Buffer = NULL; + } +} + + +PRInt32 nsBlockingStream::GetAvailableSpace(void) +{ + PRInt32 size; + + LockStream(); + size = m_bIsClosed ? 0 : m_BufferLength - m_DataLength; + UnlockStream(); + + return size; +} + + +PRInt32 nsBlockingStream::Write(const char *aBuf, PRInt32 aLen) +{ + PRInt32 bytesWritten = 0; + PRInt32 bytesFree; + + LockStream(); + + NS_PRECONDITION((m_Buffer || m_bIsClosed), "m_Buffer is NULL!"); + + if (!m_bIsClosed && aBuf) { + /* Do not store more data than there is space for... */ + bytesFree = GetAvailableSpace(); + if (aLen > bytesFree) { + aLen = bytesFree; + } + + /* Storing the data will cause m_WriteOffset to wrap */ + if (m_WriteOffset + aLen > m_BufferLength) { + PRInt32 delta; + + /* Store the first chunk through the end of the buffer */ + delta = m_BufferLength - m_WriteOffset; + memcpy(&m_Buffer[m_WriteOffset], aBuf, delta); + + /* Store the second chunk from the beginning of the buffer */ + m_WriteOffset = aLen-delta; + memcpy(m_Buffer, &aBuf[delta], m_WriteOffset); + } else { + memcpy(&m_Buffer[m_WriteOffset], aBuf, aLen); + m_WriteOffset += aLen; + } + + bytesWritten = aLen; + m_DataLength += aLen; + } + + UnlockStream(); + + return bytesWritten; +} + + +PRInt32 nsBlockingStream::Read(PRInt32 *aErrorCode, + char *aBuf, + PRInt32 aOffset, + PRInt32 aCount) +{ + PRInt32 bytesRead = 0; + + LockStream(); + + NS_PRECONDITION((m_Buffer || m_bIsClosed), "m_Buffer is NULL!"); + + /* Check for initial error conditions... */ + if (NULL == aBuf) { + *aErrorCode = NS_INPUTSTREAM_ILLEGAL_ARGS; + goto done; + } else if (m_bIsClosed && (0 == m_DataLength)) { + *aErrorCode = NS_INPUTSTREAM_EOF; + bytesRead = -1; + goto done; + } else { + *aErrorCode = 0; + } + + if (m_Buffer) { + /* Skip the appropriate number of bytes in the input buffer... */ + if (aOffset) { + aBuf += aOffset; + } + + /* Not enough data is available... Must block. */ + if (aCount > m_DataLength) { + UnlockStream(); + do { + NET_PollSockets(); + bytesRead += ReadBuffer(aBuf, aCount); + /* XXX m_bIsClosed is checked outside of the lock! */ + } while ((aCount > bytesRead) && !m_bIsClosed); + LockStream(); + } else { + bytesRead = ReadBuffer(aBuf, aCount); + } + } + +done: + UnlockStream(); + + return bytesRead; +} + + +PRInt32 nsBlockingStream::ReadBuffer(char *aBuf, PRInt32 aCount) +{ + PRInt32 bytesRead = 0; + + LockStream(); + + /* Do not read more data than there is available... */ + if (aCount > m_DataLength) { + aCount = m_DataLength; + } + + /* Reading the data will cause m_ReadOffset to wrap */ + if (m_ReadOffset + aCount > m_BufferLength) { + PRInt32 delta; + + /* Read the first chunk through the end of the buffer */ + delta = m_BufferLength - m_ReadOffset; + memcpy(aBuf, &m_Buffer[m_ReadOffset], delta); + + /* Read the second chunk from the beginning of the buffer */ + m_ReadOffset = aCount-delta; + memcpy(&aBuf[delta], m_Buffer, m_ReadOffset); + } else { + memcpy(aBuf, &m_Buffer[m_ReadOffset], aCount); + m_ReadOffset += aCount; + } + + bytesRead = aCount; + m_DataLength -= aCount; + + UnlockStream(); + + return bytesRead; +} + diff --git a/mozilla/lib/libnet/net_strm.h b/mozilla/lib/libnet/net_strm.h new file mode 100755 index 00000000000..16a47bb4240 --- /dev/null +++ b/mozilla/lib/libnet/net_strm.h @@ -0,0 +1,169 @@ +/* -*- 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 + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef net_strm_h___ +#define net_strm_h___ + +#include "nspr.h" +#include "nsIInputStream.h" +#include "nsIStreamNotification.h" + + +/* Forward declaration... */ +class nsNetlibStream; + + +class nsConnectionInfo : public nsISupports +{ +public: + NS_DECL_ISUPPORTS + + nsConnectionInfo(nsNetlibStream *pStream, nsIStreamNotification *pNotify); + +protected: + virtual ~nsConnectionInfo(); + +public: + nsNetlibStream *pNetStream; + nsIStreamNotification *pConsumer; +}; + + +class nsNetlibStream : public nsIInputStream +{ +public: + NS_DECL_ISUPPORTS + + nsNetlibStream(void); + + virtual PRInt32 GetAvailableSpace(void) = 0; + virtual PRInt32 Write(const char *aBuf, PRInt32 aLen) = 0; + + /* From nsIInputStream... */ + virtual void Close(void); + +protected: + virtual ~nsNetlibStream(); + + inline void LockStream (void) { if (m_Lock) PR_EnterMonitor(m_Lock); } + inline void UnlockStream(void) { if (m_Lock) PR_ExitMonitor (m_Lock); } + +protected: + PRBool m_bIsClosed; + +private: + PRMonitor *m_Lock; + +}; + +/* + * Variable size, buffered input stream... + */ +class nsBufferedStream : public nsNetlibStream { + +public: + nsBufferedStream(void); + + /* nsIInputStream interface */ + virtual PRInt32 Read(PRInt32 *aErrorCode, + char *aBuf, + PRInt32 aOffset, + PRInt32 aCount); + + /* nsNetlibStream methods... */ + virtual PRInt32 GetAvailableSpace(void); + virtual PRInt32 Write(const char *aBuf, PRInt32 aLen); + +protected: + virtual ~nsBufferedStream(); + +private: + char *m_Buffer; + PRInt32 m_BufferLength; + + PRInt32 m_DataLength; + PRInt32 m_ReadOffset; + PRInt32 m_WriteOffset; +}; + + +/* + * Fixed size, buffered input stream... + */ + +class nsAsyncStream : public nsNetlibStream { + +public: + nsAsyncStream(PRInt32 buffer_size); + + /* nsIInputStream interface */ + virtual PRInt32 Read(PRInt32 *aErrorCode, + char *aBuf, + PRInt32 aOffset, + PRInt32 aCount); + + /* nsNetlibStream methods... */ + virtual PRInt32 GetAvailableSpace(void); + virtual PRInt32 Write(const char *aBuf, PRInt32 aLen); + +protected: + virtual ~nsAsyncStream(); + +private: + char *m_Buffer; + PRInt32 m_BufferLength; + + PRInt32 m_DataLength; + PRInt32 m_ReadOffset; + PRInt32 m_WriteOffset; +}; + + +/* + * Variable size, buffered input stream... + */ +class nsBlockingStream : public nsNetlibStream { + +public: + nsBlockingStream(void); + + /* nsIInputStream interface */ + virtual PRInt32 Read(PRInt32 *aErrorCode, + char *aBuf, + PRInt32 aOffset, + PRInt32 aCount); + + /* nsNetlibStream methods... */ + virtual PRInt32 GetAvailableSpace(void); + virtual PRInt32 Write(const char *aBuf, PRInt32 aLen); + +protected: + virtual ~nsBlockingStream(); + + PRInt32 ReadBuffer(char *aBuf, PRInt32 aCount); + +private: + char *m_Buffer; + PRInt32 m_BufferLength; + + PRInt32 m_DataLength; + PRInt32 m_ReadOffset; + PRInt32 m_WriteOffset; +}; + +#endif /* net_strm_h___ */ diff --git a/mozilla/lib/libnet/nsINetService.h b/mozilla/lib/libnet/nsINetService.h new file mode 100755 index 00000000000..eb2ea865508 --- /dev/null +++ b/mozilla/lib/libnet/nsINetService.h @@ -0,0 +1,55 @@ +/* -*- 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 + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef nsINetService_h___ +#define nsINetService_h___ + +#include "nsISupports.h" +#include "nsIStreamNotification.h" + + /* XXX: This should be moved to ns/xpcom/src/nserror.h */ +#define NS_OK 0 +#define NS_FALSE 1 + + +/* cfb1a480-c78f-11d1-bea2-00805f8a66dc */ +#define NS_INETSERVICE_IID \ +{ 0xcfb1a480, 0xc78f, 0x11d1, \ + {0xbe, 0xa2, 0x00, 0x80, 0x5f, 0x8a, 0x66, 0xdc} } + + +struct nsINetService : public nsISupports +{ + NS_IMETHOD OpenStream(const char *aUrl, + nsIStreamNotification *aConsumer) = 0; + NS_IMETHOD OpenBlockingStream(const char *aUrl, + nsIStreamNotification *aConsumer, + nsIInputStream **aNewStream) = 0; +}; + + +/* + * Create an instance of the INetService + * + * XXX: Add NS_BASE when nscore.h can be included... + */ +extern "C" /* NS_BASE */ nsresult NS_NewINetService(nsINetService** aInstancePtrResult, + nsISupports* aOuter); + + +#endif /* nsINetService_h___ */ diff --git a/mozilla/lib/libnet/nsIStreamNotification.h b/mozilla/lib/libnet/nsIStreamNotification.h new file mode 100755 index 00000000000..eb7039d05a8 --- /dev/null +++ b/mozilla/lib/libnet/nsIStreamNotification.h @@ -0,0 +1,45 @@ +/* -*- 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 + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef nsIStreamNotification_h___ +#define nsIStreamNotification_h___ + +#include "prtypes.h" +#include "nsISupports.h" + +/* forward declaration */ +class nsIInputStream; + + +/* 45d234d0-c6c9-11d1-bea2-00805f8a66dc */ +#define NS_ISTREAMNOTIFICATION_IID \ +{ 0x45d234d0, 0xc6c9, 0x11d1, \ + {0xbe, 0xa2, 0x00, 0x80, 0x5f, 0x8a, 0x66, 0xdc} } + + +struct nsIStreamNotification : public nsISupports +{ + NS_IMETHOD GetBindInfo(void) = 0; + NS_IMETHOD OnProgress(void) = 0; + NS_IMETHOD OnStartBinding(void) = 0; + NS_IMETHOD OnDataAvailable(nsIInputStream *pIStream) = 0; + NS_IMETHOD OnStopBinding(void) = 0; +}; + + +#endif /* nsIStreamNotification_h___ */