Compare commits
64 Commits
PSM_GLUE_J
...
MODULAR_NE
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c515100b8e | ||
|
|
fe0f4d855f | ||
|
|
3d4019f9c4 | ||
|
|
9d96048a4b | ||
|
|
ae5d3bac86 | ||
|
|
dd5a8c0dfa | ||
|
|
a5f43d2a13 | ||
|
|
897d60bb73 | ||
|
|
fd1359cac8 | ||
|
|
aa88ba7591 | ||
|
|
0c9f6e6d80 | ||
|
|
f635646933 | ||
|
|
74a41b1364 | ||
|
|
dddf36e52d | ||
|
|
42f1218f94 | ||
|
|
9369584965 | ||
|
|
644d7cd9c7 | ||
|
|
cac7b720c3 | ||
|
|
371d44de72 | ||
|
|
d5840939c7 | ||
|
|
2a50f93567 | ||
|
|
d2a75afae6 | ||
|
|
8f2a603835 | ||
|
|
d9babead55 | ||
|
|
daa26a48be | ||
|
|
be77d90b49 | ||
|
|
e2793376a7 | ||
|
|
6d54e5f6e3 | ||
|
|
b0db9a4acd | ||
|
|
a7a9a03946 | ||
|
|
5340ef2b1b | ||
|
|
1043bb4cc9 | ||
|
|
9cb908ce37 | ||
|
|
93cf7025ed | ||
|
|
42b35681a2 | ||
|
|
bd2471c41c | ||
|
|
3231691800 | ||
|
|
2bdd74e814 | ||
|
|
97b4b7a6d1 | ||
|
|
55369bada1 | ||
|
|
82ed1f72bb | ||
|
|
52d02fe072 | ||
|
|
11e91b2751 | ||
|
|
9c6ac35617 | ||
|
|
50054acba1 | ||
|
|
79a4c9490b | ||
|
|
c181b6d7f9 | ||
|
|
a5e5b98ad8 | ||
|
|
f453d81444 | ||
|
|
05cb725cfb | ||
|
|
46d5611628 | ||
|
|
d9a5e647f5 | ||
|
|
6c07a2ca66 | ||
|
|
3c5574eb6e | ||
|
|
fee6fe5171 | ||
|
|
46e818474a | ||
|
|
ac3fe4623e | ||
|
|
e5430a78e1 | ||
|
|
e8ecd3ec68 | ||
|
|
86e542aa90 | ||
|
|
35f45baaed | ||
|
|
e72757dc16 | ||
|
|
f7ac2222ef | ||
|
|
4099eb2ef3 |
3875
mozilla/cmd/winfe/fegui.cpp
Executable file
3875
mozilla/cmd/winfe/fegui.cpp
Executable file
File diff suppressed because it is too large
Load Diff
2031
mozilla/cmd/winfe/nsapp.cpp
Normal file
2031
mozilla/cmd/winfe/nsapp.cpp
Normal file
File diff suppressed because it is too large
Load Diff
123
mozilla/cmd/winfe/stdafx.h
Normal file
123
mozilla/cmd/winfe/stdafx.h
Normal file
@@ -0,0 +1,123 @@
|
||||
/* -*- 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 STDAFX_PCH
|
||||
#define STDAFX_PCH
|
||||
|
||||
#define OEMRESOURCE
|
||||
|
||||
#if defined(DEBUG_blythe)
|
||||
// Set up a flag specific to WFE developers in the client
|
||||
#define DEBUG_WFE
|
||||
#endif
|
||||
|
||||
/* Very windows specific includes.
|
||||
*/
|
||||
/* MFC, KFC, RUN DMC, whatever */
|
||||
#include <afxwin.h>
|
||||
#include <afxext.h>
|
||||
#include <afxpriv.h>
|
||||
#include <afxole.h>
|
||||
#include <afxdisp.h>
|
||||
#include <afxodlgs.h>
|
||||
#ifdef _WIN32
|
||||
#include <afxcmn.h>
|
||||
#endif
|
||||
|
||||
/* More XP than anything */
|
||||
#include "xp.h"
|
||||
#include "fe_proto.h"
|
||||
#include "fe_rgn.h"
|
||||
#include "libi18n.h"
|
||||
#include "xlate.h"
|
||||
#include "ntypes.h"
|
||||
#ifdef EDITOR
|
||||
#include "edttypes.h"
|
||||
#endif
|
||||
#include "xpassert.h"
|
||||
#include "lo_ele.h"
|
||||
#include "layers.h"
|
||||
|
||||
/* Standard C includes */
|
||||
#ifndef _WIN32
|
||||
#include <dos.h>
|
||||
#endif
|
||||
#include <malloc.h>
|
||||
#include <direct.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <io.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#ifdef DEBUG
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Very windows specific includes.
|
||||
*/
|
||||
/* WFE needs a layout file */
|
||||
extern "C" {
|
||||
#include "layout.h"
|
||||
}
|
||||
|
||||
/* Some common defines. */
|
||||
#ifndef _AFXDLL
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
/* All front end forward declarations needed to compile. */
|
||||
#include "forward.h"
|
||||
|
||||
/* Front end Casting macros. */
|
||||
#include "cast.h"
|
||||
|
||||
/* General purpose utilities. */
|
||||
#include "feutil.h"
|
||||
|
||||
/* afxData/sysInfo */
|
||||
#include "sysinfo.h"
|
||||
|
||||
/* Some defines we like everywhere. */
|
||||
#include "resource.h"
|
||||
#include "defaults.h"
|
||||
|
||||
/* The application include and
|
||||
* Commonly used, rarely changed headers */
|
||||
#include "ncapiurl.h"
|
||||
#include "genedit.h"
|
||||
#include "genframe.h"
|
||||
#include "genview.h"
|
||||
#include "gendoc.h"
|
||||
#include "intlwin.h"
|
||||
#include "mozilla.h"
|
||||
#include "cxwin.h"
|
||||
#include "winproto.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef assert
|
||||
#undef assert
|
||||
#endif
|
||||
#define assert(x) ASSERT(x)
|
||||
#endif
|
||||
|
||||
#endif /* STDAFX_PCH */
|
||||
@@ -1,32 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src res
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,27 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
DIRS = public src res
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
@@ -1,4 +0,0 @@
|
||||
nsIPSMComponent.idl
|
||||
nsIPSMUIHandler.idl
|
||||
nsISecureBrowserUI.idl
|
||||
nsISSLSocketProvider.idl
|
||||
@@ -1,45 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Hubbie Shaw
|
||||
# Doug Turner <dougt@netscape.com>
|
||||
# Terry Hayes <thayes@netscape.com>
|
||||
#
|
||||
|
||||
MODULE = psmglue
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIPSMComponent.idl \
|
||||
nsIPSMUIHandler.idl \
|
||||
nsISecureBrowserUI.idl \
|
||||
nsIPSMSocketInfo.idl \
|
||||
nsISSLSocketProvider.idl \
|
||||
nsISecretDecoderRing.idl \
|
||||
$(NULL)
|
||||
|
||||
PREF_JS_EXPORTS = $(srcdir)/psm-glue.js
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
@@ -1,53 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Hubbie Shaw
|
||||
# Doug Turner <dougt@netscape.com>
|
||||
# Terry Hayes <thayes@netscape.com>
|
||||
#
|
||||
|
||||
MODULE = psmglue
|
||||
|
||||
DEPTH=..\..\..
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
DLLNAME = psmglue
|
||||
PDBFILE = $(DLLNAME).pdb
|
||||
MAPFILE = $(DLLNAME).map
|
||||
DLL = .\$(OBJDIR)\$(DLLNAME).dll
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
XPIDL_INCLUDES=-I$(DEPTH)\..\mozilla\dist\idl
|
||||
|
||||
XPIDLSRCS= \
|
||||
.\nsIPSMComponent.idl \
|
||||
.\nsIPSMUIHandler.idl \
|
||||
.\nsISecureBrowserUI.idl \
|
||||
.\nsISSLSocketProvider.idl \
|
||||
.\nsIPSMSocketInfo.idl \
|
||||
.\nsISecretDecoderRing.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install::
|
||||
$(MAKE_INSTALL) .\psm-glue.js $(DIST)\bin\defaults\pref
|
||||
@@ -1,58 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
* Mitch Stoltz <mstoltz@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
interface nsIPrincipal;
|
||||
|
||||
%{C++
|
||||
#include "cmtcmn.h"
|
||||
%}
|
||||
|
||||
[ptr] native nsCMTControlStar(CMT_CONTROL);
|
||||
|
||||
[scriptable, uuid(9e482670-5412-11d3-bbc8-0000861d1237)]
|
||||
interface nsIPSMComponent : nsISupports
|
||||
{
|
||||
|
||||
[noscript] nsCMTControlStar getControlConnection( );
|
||||
|
||||
/**
|
||||
* Display the Security Advisor. PickledStatus and hostName can be null.
|
||||
* If they are, the "Selected Info" dialog will be empty.
|
||||
*/
|
||||
|
||||
void displaySecurityAdvisor(in string pickledStatus, in string hostName);
|
||||
|
||||
/**
|
||||
* This will send PSM all preferences that we know about.
|
||||
*/
|
||||
void passPrefs();
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define PSM_COMPONENT_PROGID "component://netscape/psm"
|
||||
#define PSM_COMPONENT_CLASSNAME "Mozilla PSM Component"
|
||||
%}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
%{C++
|
||||
#include "cmtcmn.h"
|
||||
#include "nsPSMShimLayer.h"
|
||||
%}
|
||||
|
||||
[ptr] native psmtControlStar(CMT_CONTROL);
|
||||
[ptr] native cmSocketStar(CMSocket);
|
||||
[ptr] native nsFileDescStar(PRFileDesc);
|
||||
|
||||
[noscript, uuid(deeb8dfc-fb7a-11d3-ac84-00c04fa0d26b)]
|
||||
interface nsIPSMSocketInfo : nsISupports {
|
||||
|
||||
readonly attribute string hostName;
|
||||
readonly attribute PRInt32 hostPort;
|
||||
|
||||
readonly attribute string proxyName;
|
||||
readonly attribute PRInt32 proxyPort;
|
||||
|
||||
readonly attribute psmtControlStar controlPtr;
|
||||
readonly attribute cmSocketStar socketPtr;
|
||||
readonly attribute nsFileDescStar fileDescPtr;
|
||||
|
||||
void getPickledStatus(out charPtr pickledStatus);
|
||||
};
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications, Inc. Portions created by Netscape are
|
||||
* Copyright (C) 1999, Mozilla. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(d92be9b0-601b-11d3-8c4a-000064657374)]
|
||||
interface nsIPSMUIHandler : nsISupports
|
||||
{
|
||||
void DisplayURI(in long width, in long height, in PRBool modal, in string urlStr);
|
||||
void PromptForFile(in wstring prompt, in string fileRegEx, in boolean shouldFileExist, out string outFile);
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define PSM_UI_HANLDER_PROGID "component://netscape/psm/ui"
|
||||
#define PSM_UI_HANLDER_CLASSNAME "Mozilla PSM UI Handler"
|
||||
%}
|
||||
@@ -1,35 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISocketProvider.idl"
|
||||
|
||||
[noscript, uuid(856a93d0-5415-11d3-bbc8-0000861d1237)]
|
||||
interface nsISSLSocketProvider : nsISocketProvider {
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define NS_ISSLSOCKETPROVIDER_PROGID NS_NETWORK_SOCKET_PROGID_PREFIX "ssl"
|
||||
#define NS_ISSLSOCKETPROVIDER_CLASSNAME "Mozilla SSL Socket Provider Component"
|
||||
|
||||
%}
|
||||
@@ -1,63 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* thayes@netscape.com
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/* Buffer type - for storing 8-bit octet values */
|
||||
[ptr] native buffer(unsigned char);
|
||||
|
||||
[scriptable, uuid(0EC80360-075C-11d4-9FD4-00C04F1B83D8)]
|
||||
interface nsISecretDecoderRing: nsISupports {
|
||||
|
||||
/* Encrypt a buffer - callable only from C++ */
|
||||
[noscript] long encrypt(in buffer data, in long dataLen, out buffer result);
|
||||
|
||||
/* Decrypt a buffer - callable only from C++ */
|
||||
[noscript] long decrypt(in buffer data, in long dataLen, out buffer result);
|
||||
|
||||
/* Encrypt nul-terminated string to BASE64 output */
|
||||
string encryptString(in string text);
|
||||
|
||||
/* Decrypt BASE64 input to nul-terminated string output */
|
||||
/* There is no check for embedded nul values in the decrypted output */
|
||||
string decryptString(in string crypt);
|
||||
|
||||
/* Prompt the user to change the password on the SDR key */
|
||||
void changePassword();
|
||||
|
||||
/* Logout of the security device that protects the SDR key */
|
||||
void logout();
|
||||
};
|
||||
|
||||
/*
|
||||
* Configuration interface for the Secret Decoder Ring
|
||||
* - this interface allows setting the window that will be
|
||||
* used as parent for dialog windows (such as password prompts)
|
||||
*/
|
||||
[scriptable, uuid(01D8C0F0-0CCC-11d4-9FDD-000064657374)]
|
||||
interface nsISecretDecoderRingConfig: nsISupports {
|
||||
void setWindow(in nsISupports w);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
interface nsIDOMElement;
|
||||
|
||||
[scriptable, uuid(081e31e0-a144-11d3-8c7c-00609792278c)]
|
||||
interface nsSecureBrowserUI : nsISupports
|
||||
{
|
||||
void init(in nsIDOMWindow window, in nsIDOMElement button);
|
||||
void displayPageInfoUI();
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define NS_SECURE_BROWSER_UI_PROGID "component://netscape/secure_browser_ui"
|
||||
#define NS_SECURE_BROWSER_UI_CLASSNAME "Mozilla Secure Browser UI Handler"
|
||||
|
||||
#define NS_SECURE_BROWSER_UI_CID \
|
||||
{ 0x10fe7ea0, 0xa10a, 0x11d3, {0x8c, 0x7c, 0x00, 0x60, 0x97, 0x92, 0x27, 0x8c}}
|
||||
|
||||
%}
|
||||
@@ -1,11 +0,0 @@
|
||||
pref("general.useragent.security", "U");
|
||||
|
||||
pref("security.enable_ssl2", true);
|
||||
pref("security.enable_ssl3", true);
|
||||
pref("security.default_personal_cert", "Select Automatically");
|
||||
pref("security.ask_for_password", 0);
|
||||
pref("security.password_lifetime", 30);
|
||||
pref("security.warn_entering_secure", true);
|
||||
pref("security.warn_leaving_secure", true);
|
||||
pref("security.warn_viewing_mixed", true);
|
||||
pref("security.warn_submit_insecure", true);
|
||||
@@ -1,32 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = content locale
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
securityOverlay.xul
|
||||
securityUI.js
|
||||
PSMTaskMenu.xul
|
||||
@@ -1,38 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
COMMUNICATOR_CONTENT_DIR = $(DIST)/bin/chrome/packages/core/communicator/content/
|
||||
COMMUNICATOR_EXPORT_CONTENT = \
|
||||
$(srcdir)/securityOverlay.xul \
|
||||
$(srcdir)/securityUI.js \
|
||||
$(srcdir)/PSMTaskMenu.xul \
|
||||
$(NULL)
|
||||
|
||||
install::
|
||||
$(INSTALL) $(COMMUNICATOR_EXPORT_CONTENT) $(COMMUNICATOR_CONTENT_DIR)
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://communicator/locale/PSMTaskMenu.dtd" >
|
||||
|
||||
<overlay id="psmTaskMenuID"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script language="JavaScript">
|
||||
function displaySecurityAdvisor()
|
||||
{
|
||||
var psm = Components.classes["component://netscape/psm"].getService();
|
||||
psm = psm.QueryInterface(Components.interfaces.nsIPSMComponent);
|
||||
psm.displaySecurityAdvisor( null, null );
|
||||
}
|
||||
</script>
|
||||
|
||||
<menupopup id="personalManagers">
|
||||
<menuitem id="PSMMentItem" position="1" value="&PSMCmd.label;" oncommand="displaySecurityAdvisor()"/>
|
||||
</menupopup>
|
||||
|
||||
</overlay>
|
||||
@@ -1,35 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) securityOverlay.xul $(DIST)\bin\chrome\packages\core\communicator\content
|
||||
$(MAKE_INSTALL) securityUI.js $(DIST)\bin\chrome\packages\core\communicator\content
|
||||
$(MAKE_INSTALL) PSMTaskMenu.xul $(DIST)\bin\chrome\packages\core\communicator\content
|
||||
|
||||
clobber::
|
||||
$(RM) $(DIST)\bin\chrome\packages\core\communicator\content\securityOverlay.xul
|
||||
$(RM) $(DIST)\bin\chrome\packages\core\communicator\content\securityUI.js
|
||||
$(RM) $(DIST)\bin\chrome\packages\core\communicator\content\PSMTaskMenu.xul
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/securityOverlay.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://communicator/locale/securityOverlay.dtd">
|
||||
|
||||
<overlay id="NavSecurityOverlay"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script language="JavaScript" src="chrome://communicator/content/securityUI.js" />
|
||||
|
||||
<statusbarpanel id="security-button" onclick="displayPageInfo()" tooltip="aToolTip" tooltiptext="&lockIcon.label;"/>
|
||||
|
||||
</overlay>
|
||||
@@ -1,45 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
window.addEventListener("load", SetSecurityButton, false);
|
||||
|
||||
var securityUI;
|
||||
|
||||
function SetSecurityButton()
|
||||
{
|
||||
dump("in SetSecurityButton\n");
|
||||
|
||||
var ui = Components.classes["component://netscape/secure_browser_ui"].createInstance();
|
||||
securityUI = ui.QueryInterface(Components.interfaces.nsSecureBrowserUI);
|
||||
|
||||
var button = document.getElementById('security-button');
|
||||
if (button && window.content)
|
||||
securityUI.init(window.content, button);
|
||||
}
|
||||
|
||||
function displayPageInfo()
|
||||
{
|
||||
if (securityUI)
|
||||
securityUI.displayPageInfoUI();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = en-US
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
PSMTaskMenu.dtd
|
||||
securityOverlay.dtd
|
||||
security.properties
|
||||
@@ -1,41 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
COMMUNICATOR_RESOURCE_CONTENT = \
|
||||
$(srcdir)/PSMTaskMenu.dtd \
|
||||
$(srcdir)/security.properties \
|
||||
$(srcdir)/securityOverlay.dtd \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
install::
|
||||
$(INSTALL) $(COMMUNICATOR_RESOURCE_CONTENT) $(DIST)/bin/chrome/locales/en-US/communicator/locale
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<!ENTITY PSMCmd.label "Security Manager">
|
||||
@@ -1,37 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..\..\..
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
COMMUNICATOR_DIST=$(DIST)\bin\chrome\locales\en-US\communicator\locale
|
||||
|
||||
|
||||
install::
|
||||
$(MAKE_INSTALL) PSMTaskMenu.dtd $(COMMUNICATOR_DIST)
|
||||
$(MAKE_INSTALL) security.properties $(COMMUNICATOR_DIST)
|
||||
$(MAKE_INSTALL) securityOverlay.dtd $(COMMUNICATOR_DIST)
|
||||
|
||||
clobber::
|
||||
$(RM) -f $(DIST)\bin\chrome\locales\en-US\communicator\locale\PSMTaskMenu.dtd
|
||||
$(RM) -f $(DIST)\bin\chrome\locales\en-US\communicator\locale\security.properties
|
||||
$(RM) -f $(DIST)\bin\chrome\locales\en-US\communicator\locale\securityOverlay.dtd
|
||||
@@ -1,29 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
Title=Security Warning
|
||||
MixedContentMessage=You have requested a secure document that contains some insecure information.
|
||||
LeaveSiteMessage=You have requested an insecure document. The document and any information you send back could be observed by a third party while in transit.
|
||||
EnterSiteMessage=You have requested a secure document. The document and any information you send back are encrypted for privacy while in transit.
|
||||
PostToInsecure=Warning! Although this document is secure, the information you have submitted is insecure and could be observed by a third party while in transit. If you are submitting passwords, credit card numbers, or other information you would like to keep private, it would be safer for you to cancel the submission.
|
||||
PostToInsecureFromInsecure=Any information you submit is insecure and could be observed by a third party while in transit. If you are submitting passwords, credit card numbers, or other information you would like to keep private, it would be safer for you to cancel the submission.
|
||||
DontShowAgain=Show Me This Alert Next Time.
|
||||
FindText=Please find the Personal Security Manager application
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
<!ENTITY lockIcon.label "Show security information for this window">
|
||||
@@ -1,27 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
DIRS=en-US
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
DIRS = content locale
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
@@ -1,66 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Hubbie Shaw
|
||||
# Doug Turner <dougt@netscape.com>
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = psmglue
|
||||
|
||||
IS_COMPONENT = 1
|
||||
LIBRARY_NAME = psmglue
|
||||
|
||||
|
||||
CPPSRCS = \
|
||||
nsPSMComponent.cpp \
|
||||
nsPSMUICallbacks.cpp \
|
||||
nsSSLSocketProvider.cpp \
|
||||
nsPSMModule.cpp \
|
||||
nsSSLIOLayer.cpp \
|
||||
nsSecureBrowserUIImpl.cpp \
|
||||
nsSDR.cpp \
|
||||
nsFSDR.cpp \
|
||||
nsCrypto.cpp \
|
||||
nsKeygenHandler.cpp \
|
||||
$(NULL)
|
||||
|
||||
CSRCS = \
|
||||
nsPSMMutex.c \
|
||||
nsPSMShimLayer.c \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
-lcmt \
|
||||
-lprotocol \
|
||||
$(MOZ_JS_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
INCLUDES += \
|
||||
-I$(srcdir) \
|
||||
$(NULL)
|
||||
@@ -1,72 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Hubbie Shaw
|
||||
# Doug Turner <dougt@netscape.com>
|
||||
#
|
||||
|
||||
MODULE = psmglue
|
||||
|
||||
DEPTH=..\..\..
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
DLLNAME = psmglue
|
||||
PDBFILE = $(DLLNAME).pdb
|
||||
MAPFILE = $(DLLNAME).map
|
||||
DLL = .\$(OBJDIR)\$(DLLNAME).dll
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
LINCS = $(LINCS) \
|
||||
-I$(PUBLIC) \
|
||||
-I$(PUBLIC)/security \
|
||||
$(NULL)
|
||||
|
||||
LLIBS = \
|
||||
$(LIBNSPR) \
|
||||
$(DIST)\lib\neckobase_s.lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\js3250.lib \
|
||||
$(DIST)\lib\cmt.lib \
|
||||
$(DIST)\lib\protocol.lib \
|
||||
$(DIST)\lib\mozreg.lib \
|
||||
$(DIST)\lib\jsdom.lib \
|
||||
$(NULL)
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\nsPSMMutex.obj \
|
||||
.\$(OBJDIR)\nsPSMShimLayer.obj \
|
||||
.\$(OBJDIR)\nsPSMComponent.obj \
|
||||
.\$(OBJDIR)\nsPSMUICallbacks.obj \
|
||||
.\$(OBJDIR)\nsPSMModule.obj \
|
||||
.\$(OBJDIR)\nsSecureBrowserUIImpl.obj \
|
||||
.\$(OBJDIR)\nsSSLIOLayer.obj \
|
||||
.\$(OBJDIR)\nsSSLSocketProvider.obj \
|
||||
.\$(OBJDIR)\nsSDR.obj \
|
||||
.\$(OBJDIR)\nsFSDR.obj \
|
||||
.\$(OBJDIR)\nsCrypto.obj \
|
||||
.\$(OBJDIR)\nsKeygenHandler.obj \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,112 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef _nsCrypto_h_
|
||||
#define _nsCrypto_h_
|
||||
#include "nsIDOMCRMFObject.h"
|
||||
#include "nsIDOMCrypto.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMPkcs11.h"
|
||||
|
||||
#define NS_CRYPTO_CLASSNAME "Crypto JavaScript Class"
|
||||
#define NS_CRYPTO_CID \
|
||||
{0x929d9320, 0x251e, 0x11d4, { 0x8a, 0x7c, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} }
|
||||
|
||||
#define NS_PKCS11_CLASSNAME "Pkcs11 JavaScript Class"
|
||||
#define NS_PKCS11_CID \
|
||||
{0x74b7a390, 0x3b41, 0x11d4, { 0x8a, 0x80, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} }
|
||||
|
||||
class nsIPSMComponent;
|
||||
class nsIDOMScriptObjectFactory;
|
||||
|
||||
|
||||
class nsCRMFObject : public nsIDOMCRMFObject,
|
||||
public nsIScriptObjectOwner {
|
||||
public:
|
||||
nsCRMFObject();
|
||||
virtual ~nsCRMFObject();
|
||||
NS_DECL_IDOMCRMFOBJECT
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void* aScriptObject);
|
||||
|
||||
nsresult init();
|
||||
|
||||
nsresult SetCRMFRequest(char *inRequest);
|
||||
private:
|
||||
|
||||
nsString mBase64Request;
|
||||
void *mScriptObject;
|
||||
};
|
||||
|
||||
|
||||
class nsCrypto: public nsIDOMCrypto,
|
||||
public nsIScriptObjectOwner {
|
||||
public:
|
||||
nsCrypto();
|
||||
virtual ~nsCrypto();
|
||||
nsresult init();
|
||||
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void* aScriptObject);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_IDOMCRYPTO
|
||||
|
||||
static nsresult GetScriptObjectFactory(nsIDOMScriptObjectFactory **aResult);
|
||||
static nsIDOMScriptObjectFactory *gScriptObjectFactory;
|
||||
static nsIPrincipal* GetScriptPrincipal(JSContext *cx);
|
||||
static const char *kPSMComponentProgID;
|
||||
|
||||
private:
|
||||
|
||||
nsIPSMComponent *mPSM;
|
||||
nsString mVersionString;
|
||||
PRBool mVersionStringSet;
|
||||
void *mScriptObject;
|
||||
};
|
||||
|
||||
class nsPkcs11 : public nsIDOMPkcs11,
|
||||
public nsIScriptObjectOwner {
|
||||
public:
|
||||
nsPkcs11();
|
||||
virtual ~nsPkcs11();
|
||||
|
||||
nsresult init();
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_IDOMPKCS11
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void* aScriptObject);
|
||||
|
||||
private:
|
||||
nsIPSMComponent *mPSM;
|
||||
void *mScriptObject;
|
||||
};
|
||||
|
||||
nsresult
|
||||
getPSMComponent(nsIPSMComponent ** retPSM);
|
||||
|
||||
#endif //_nsCrypto_h_
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,60 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Terry Hayes <thayes@netscape.com>
|
||||
* Steve Morse <morse@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NSFSDR_H_
|
||||
#define _NSFSDR_H_
|
||||
|
||||
#include "nsISecretDecoderRing.h"
|
||||
|
||||
// ===============================================
|
||||
// nsFSecretDecoderRing - "fake" implementation of nsISecretDecoderRing
|
||||
// ===============================================
|
||||
|
||||
#define NS_FSDR_CLASSNAME "Fake Secret Decoder Ring"
|
||||
#define NS_FSDR_CID \
|
||||
{ 0x1ee28720, 0x2b93, 0x11d4, { 0xa0, 0xa4, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
|
||||
|
||||
#define NS_FSDR_PROGID "netscape.security.fsdr"
|
||||
|
||||
class nsFSecretDecoderRing : public nsISecretDecoderRing
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISECRETDECODERRING
|
||||
|
||||
nsFSecretDecoderRing();
|
||||
virtual ~nsFSecretDecoderRing();
|
||||
|
||||
nsresult init();
|
||||
|
||||
private:
|
||||
nsIPSMComponent *mPSM;
|
||||
|
||||
static const char *kPSMComponentProgID;
|
||||
|
||||
nsresult encode(const unsigned char *data, PRInt32 dataLen, char **_retval);
|
||||
nsresult decode(const char *data, unsigned char **result, PRInt32 * _retval);
|
||||
};
|
||||
|
||||
#endif /* _NSFSDR_H_ */
|
||||
@@ -1,255 +0,0 @@
|
||||
//For some weird reason, nsProxiedService has to be the first file
|
||||
//included. Don't ask me, I'm just the messenger.
|
||||
#include "nsProxiedService.h"
|
||||
#include "nsKeygenHandler.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsSecureBrowserUIImpl.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIPSMComponent.h"
|
||||
#include "nsIPSMUIHandler.h"
|
||||
#include "nsPSMUICallbacks.h"
|
||||
#include "nsCrypto.h"
|
||||
#include "cmtcmn.h"
|
||||
#include "cmtjs.h"
|
||||
|
||||
//These defines are taken from the PKCS#11 spec
|
||||
#define CKM_RSA_PKCS_KEY_PAIR_GEN 0x00000000
|
||||
#define CKM_DH_PKCS_KEY_PAIR_GEN 0x00000020
|
||||
#define CKM_DSA_KEY_PAIR_GEN 0x00000010
|
||||
|
||||
static NS_DEFINE_IID(kFormProcessorIID, NS_IFORMPROCESSOR_IID);
|
||||
static NS_DEFINE_IID(kIDOMHTMLSelectElementIID, NS_IDOMHTMLSELECTELEMENT_IID);
|
||||
|
||||
static const char *mozKeyGen = "-mozilla-keygen";
|
||||
|
||||
NS_IMPL_ADDREF(nsKeygenFormProcessor);
|
||||
NS_IMPL_RELEASE(nsKeygenFormProcessor);
|
||||
NS_IMPL_QUERY_INTERFACE(nsKeygenFormProcessor, kFormProcessorIID);
|
||||
|
||||
nsKeygenFormProcessor::nsKeygenFormProcessor()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
getPSMComponent(&mPSM);
|
||||
}
|
||||
|
||||
char *
|
||||
nsKeygenFormProcessor::ChooseToken(PCMT_CONTROL control,
|
||||
CMKeyGenTagArg *psmarg,
|
||||
CMKeyGenTagReq *reason)
|
||||
{
|
||||
CMUint32 resID;
|
||||
CMTStatus crv;
|
||||
CMTItem url;
|
||||
char *keyString = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
NameList *tokenNames;
|
||||
int i;
|
||||
|
||||
// In this case, PSM provided us with a list of potential tokens to choose
|
||||
// from, but we're gonna make it use it's UI for now, so let's delte the
|
||||
// memory associated with the structure it sent back.
|
||||
tokenNames = (NameList*)psmarg->current;
|
||||
for (i=0; i < tokenNames->numitems; i++) {
|
||||
nsCRT::free(tokenNames->names[i]);
|
||||
}
|
||||
nsCRT::free((char*)tokenNames);
|
||||
resID = psmarg->rid;
|
||||
memset(&url, 0, sizeof(CMTItem));
|
||||
NS_WITH_PROXIED_SERVICE(nsIPSMUIHandler, handler, nsPSMUIHandlerImpl::GetCID(), NS_UI_THREAD_EVENTQ, &rv);
|
||||
crv = CMT_GetStringAttribute(control, resID, SSM_FID_CHOOSE_TOKEN_URL, &url);
|
||||
if (crv != CMTSuccess) {
|
||||
goto loser;
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
handler->DisplayURI(400, 300, PR_TRUE, (char*)url.data);
|
||||
} else {
|
||||
goto loser;
|
||||
}
|
||||
return CMT_GetGenKeyResponse(control, psmarg, reason);
|
||||
loser:
|
||||
if (keyString)
|
||||
nsCRT::free(keyString);
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
char *
|
||||
nsKeygenFormProcessor::SetUserPassword(PCMT_CONTROL control,
|
||||
CMKeyGenTagArg *psmarg,
|
||||
CMKeyGenTagReq *reason)
|
||||
{
|
||||
nsresult rv;
|
||||
CMTStatus crv;
|
||||
CMTItem url;
|
||||
char *keystring=nsnull;
|
||||
|
||||
// We need to delete the memory the PSM client API allocated for us since
|
||||
// we're just gonna tell it to use it's own UI.
|
||||
nsCRT::free((char*)psmarg->current);
|
||||
NS_WITH_PROXIED_SERVICE(nsIPSMUIHandler, handler, nsPSMUIHandlerImpl::GetCID(), NS_UI_THREAD_EVENTQ, &rv);
|
||||
memset (&url, 0, sizeof(CMTItem));
|
||||
crv = CMT_GetStringAttribute(control,psmarg->rid, SSM_FID_INIT_DB_URL, &url);
|
||||
if (crv != CMTSuccess || NS_FAILED(rv)){
|
||||
goto loser;
|
||||
}
|
||||
|
||||
handler->DisplayURI(500, 450, PR_TRUE, (char*)url.data);
|
||||
|
||||
return CMT_GetGenKeyResponse(control, psmarg, reason);
|
||||
loser:
|
||||
if (keystring)
|
||||
nsCRT::free(keystring);
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsKeygenFormProcessor::GetPublicKey(nsString& value, nsString& challenge,
|
||||
nsString& keyType,
|
||||
nsString& outPublicKey, nsString& pqg)
|
||||
{
|
||||
PCMT_CONTROL control;
|
||||
nsresult rv;
|
||||
CMKeyGenParams *params = nsnull;
|
||||
CMKeyGenTagArg *psmarg = nsnull;
|
||||
CMKeyGenTagReq reason;
|
||||
char *emptyCString = "null";
|
||||
char *keystring = nsnull;
|
||||
|
||||
rv = mPSM->GetControlConnection(&control);
|
||||
if (NS_FAILED(rv)) {
|
||||
goto loser;
|
||||
}
|
||||
params = new CMKeyGenParams;
|
||||
if (params == nsnull) {
|
||||
goto loser;
|
||||
}
|
||||
params->typeString = (keyType.IsEmpty()) ? emptyCString :
|
||||
keyType.ToNewCString();
|
||||
params->challenge = (challenge.IsEmpty()) ? emptyCString :
|
||||
challenge.ToNewCString();
|
||||
params->choiceString = value.ToNewCString();
|
||||
params->pqgString = (pqg.IsEmpty()) ? emptyCString : pqg.ToNewCString();
|
||||
psmarg = new CMKeyGenTagArg;
|
||||
if (psmarg == nsnull) {
|
||||
goto loser;
|
||||
}
|
||||
// ARGH, while this is going on, we need to lock the control
|
||||
// connection so that the event loop doesn't drop our response on
|
||||
// the floor.
|
||||
CMT_LockConnection(control);
|
||||
psmarg->op = CM_KEYGEN_START;
|
||||
psmarg->rid = 0;
|
||||
psmarg->tokenName = NULL;
|
||||
psmarg->current = params;
|
||||
keystring = CMT_GenKeyOldStyle(control, psmarg, &reason);
|
||||
while (!keystring) {
|
||||
psmarg->op = reason;
|
||||
switch (psmarg->op) {
|
||||
case CM_KEYGEN_PICK_TOKEN:
|
||||
keystring = ChooseToken(control, psmarg, &reason);
|
||||
break;
|
||||
case CM_KEYGEN_SET_PASSWORD:
|
||||
keystring = SetUserPassword(control, psmarg, &reason);
|
||||
break;
|
||||
case CM_KEYGEN_ERR:
|
||||
default:
|
||||
goto loser;
|
||||
}
|
||||
}
|
||||
CMT_UnlockConnection(control);
|
||||
outPublicKey.AssignWithConversion(keystring);
|
||||
nsCRT::free(keystring);
|
||||
return NS_OK;
|
||||
loser:
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsKeygenFormProcessor::ProcessValue(nsIDOMHTMLElement *aElement,
|
||||
const nsString& aName,
|
||||
nsString& aValue)
|
||||
{
|
||||
#ifdef DEBUG_javi
|
||||
char *name = aName.ToNewCString();
|
||||
char *value = aValue.ToNewCString();
|
||||
printf("ProcessValue: name %s value %s\n", name, value);
|
||||
delete [] name;
|
||||
delete [] value;
|
||||
#endif
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement>selectElement;
|
||||
nsresult res = aElement->QueryInterface(kIDOMHTMLSelectElementIID,
|
||||
getter_AddRefs(selectElement));
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
nsAutoString keygenvalue;
|
||||
nsAutoString challengeValue;
|
||||
nsString publicKey;
|
||||
nsString mozillaKeygen;
|
||||
nsString mozType;
|
||||
|
||||
mozType.AssignWithConversion("_moz-type");
|
||||
mozillaKeygen.AssignWithConversion(mozKeyGen);
|
||||
res = selectElement->GetAttribute(mozType, keygenvalue);
|
||||
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == res && keygenvalue.Equals(mozillaKeygen)) {
|
||||
nsString challenge;
|
||||
nsString keyType;
|
||||
nsString keyTypeValue;
|
||||
nsString pqg, pqgValue;
|
||||
|
||||
challenge.AssignWithConversion("challenge");
|
||||
pqg.AssignWithConversion("pqg");
|
||||
res = selectElement->GetAttribute(pqg, pqgValue);
|
||||
keyType.AssignWithConversion("keytype");
|
||||
res = selectElement->GetAttribute(keyType, keyTypeValue);
|
||||
if (NS_FAILED(res) || keyTypeValue.IsEmpty()) {
|
||||
// If this field is not present, we default to rsa.
|
||||
keyTypeValue.AssignWithConversion("rsa");
|
||||
}
|
||||
res = selectElement->GetAttribute(challenge, challengeValue);
|
||||
rv = GetPublicKey(aValue, challenge, keyTypeValue,
|
||||
publicKey, pqgValue);
|
||||
aValue = publicKey;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_METHOD nsKeygenFormProcessor::ProvideContent(const nsString& aFormType,
|
||||
nsVoidArray& aContent,
|
||||
nsString& aAttribute)
|
||||
{
|
||||
nsString selectString;
|
||||
nsresult rv;
|
||||
PCMT_CONTROL control;
|
||||
PRUint32 i;
|
||||
|
||||
selectString.AssignWithConversion("SELECT");
|
||||
if (aFormType.EqualsIgnoreCase(selectString)) {
|
||||
nsString *selectString;
|
||||
char **result;
|
||||
|
||||
rv = mPSM->GetControlConnection(&control);
|
||||
if (NS_FAILED(rv)) {
|
||||
goto loser;
|
||||
}
|
||||
result = CMT_GetKeyChoiceList(control, "rsa"/*Need to figure out if DSA*/,
|
||||
nsnull);
|
||||
for (i=0; result[i] != nsnull; i++) {
|
||||
selectString = new nsString;
|
||||
selectString->AssignWithConversion(result[i]);
|
||||
aContent.AppendElement(selectString);
|
||||
delete []result[i];
|
||||
}
|
||||
delete []result;
|
||||
aAttribute.AssignWithConversion(mozKeyGen);
|
||||
}
|
||||
return NS_OK;
|
||||
loser:
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef _NSKEYGENHANDLER_H_
|
||||
#define _NSKEYGENHANDLER_H_
|
||||
// Form Processor
|
||||
#include "nsIFormProcessor.h"
|
||||
#include "ssmdefs.h"
|
||||
#include "cmtcmn.h"
|
||||
|
||||
class nsIPSMComponent;
|
||||
|
||||
class nsKeygenFormProcessor : public nsIFormProcessor {
|
||||
public:
|
||||
nsKeygenFormProcessor();
|
||||
NS_IMETHOD ProcessValue(nsIDOMHTMLElement *aElement,
|
||||
const nsString& aName,
|
||||
nsString& aValue);
|
||||
|
||||
NS_IMETHOD ProvideContent(const nsString& aFormType,
|
||||
nsVoidArray& aContent,
|
||||
nsString& aAttribute);
|
||||
NS_DECL_ISUPPORTS
|
||||
protected:
|
||||
nsresult GetPublicKey(nsString& value, nsString& challenge,
|
||||
nsString& keyType, nsString& outPublicKey,
|
||||
nsString& pqg);
|
||||
char * ChooseToken(PCMT_CONTROL control, CMKeyGenTagArg *psmarg,
|
||||
CMKeyGenTagReq *reason);
|
||||
char * SetUserPassword(PCMT_CONTROL control, CMKeyGenTagArg *psmarg,
|
||||
CMKeyGenTagReq *reason);
|
||||
nsIPSMComponent *mPSM;
|
||||
};
|
||||
|
||||
#endif //_NSKEYGENHANDLER_H_
|
||||
@@ -1,935 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
* Mitch Stoltz <mstoltz@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsProxiedService.h"
|
||||
#include "nsPSMUICallbacks.h"
|
||||
#include "VerReg.h"
|
||||
|
||||
#include "nspr.h"
|
||||
#include "nsPSMComponent.h"
|
||||
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIStreamListener.h"
|
||||
|
||||
#include "nsIPref.h"
|
||||
#include "nsIProfile.h"
|
||||
#include "nsILocalFile.h"
|
||||
|
||||
#include "nsDirectoryService.h"
|
||||
|
||||
#include "rsrcids.h"
|
||||
|
||||
#include "nsPSMMutex.h"
|
||||
#include "nsPSMShimLayer.h"
|
||||
#include "nsPSMUICallbacks.h"
|
||||
|
||||
#include "nsISecureBrowserUI.h"
|
||||
#include "nsIDocumentLoaderObserver.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsICertificatePrincipal.h"
|
||||
|
||||
#include "nsIProtocolProxyService.h"
|
||||
|
||||
#define PSM_VERSION_REG_KEY "/Netscape/Personal Security Manager"
|
||||
|
||||
#ifdef WIN32
|
||||
#define PSM_FILE_NAME "psm.exe"
|
||||
#elif XP_UNIX
|
||||
#define PSM_FILE_NAME "start-psm"
|
||||
#else
|
||||
#define PSM_FILE_NAME "psm"
|
||||
#endif
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID);
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
static NS_DEFINE_CID(kProtocolProxyServiceCID, NS_PROTOCOLPROXYSERVICE_CID);
|
||||
|
||||
nsPSMComponent* nsPSMComponent::mInstance = nsnull;
|
||||
|
||||
nsPSMComponent::nsPSMComponent()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mControl = nsnull;
|
||||
}
|
||||
|
||||
nsPSMComponent::~nsPSMComponent()
|
||||
{
|
||||
if (mControl)
|
||||
{
|
||||
CMT_CloseControlConnection(mControl);
|
||||
mControl = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMComponent::CreatePSMComponent(nsISupports* aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (!aResult) {
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
|
||||
if (mInstance == nsnull)
|
||||
{
|
||||
mInstance = new nsPSMComponent();
|
||||
}
|
||||
|
||||
if (mInstance == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = mInstance->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
*aResult = nsnull;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* nsISupports Implementation for the class */
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS3(nsPSMComponent,
|
||||
nsIPSMComponent,
|
||||
nsIContentHandler,
|
||||
nsISignatureVerifier);
|
||||
|
||||
#define INIT_NUM_PREFS 100
|
||||
/* preference types */
|
||||
#define STRING_PREF 0
|
||||
#define BOOL_PREF 1
|
||||
#define INT_PREF 2
|
||||
|
||||
|
||||
/* resizable list struct that contains pref items */
|
||||
typedef struct CMSetPrefList {
|
||||
int n; /* number of filled items */
|
||||
int capacity; /* allocated memory */
|
||||
CMTSetPrefElement* list; /* actual list */
|
||||
} CMSetPrefList;
|
||||
|
||||
static void get_pack_bool_pref(nsIPref *prefManager, char* key, CMTSetPrefElement* list, int* n)
|
||||
{
|
||||
PRBool boolpref;
|
||||
|
||||
list[*n].key = nsCRT::strdup(key);
|
||||
list[*n].type = BOOL_PREF;
|
||||
|
||||
if ((prefManager->GetBoolPref(key, &boolpref) != 0) || boolpref)
|
||||
{
|
||||
list[*n].value = nsCRT::strdup("true");
|
||||
}
|
||||
else
|
||||
{
|
||||
list[*n].value = nsCRT::strdup("false");
|
||||
}
|
||||
|
||||
(*n)++; /* increment the counter after done packing */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void SaveAllPrefs(int number, CMTSetPrefElement* list)
|
||||
{
|
||||
nsCOMPtr<nsIPref> prefManager;
|
||||
|
||||
nsresult res = nsServiceManager::GetService(kPrefCID,
|
||||
nsIPref::GetIID(),
|
||||
getter_AddRefs(prefManager));
|
||||
|
||||
if (NS_FAILED(res) || !prefManager)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int i;
|
||||
int intval;
|
||||
|
||||
for (i = 0; i < number; i++)
|
||||
{
|
||||
if (list[i].key == nsnull)
|
||||
{
|
||||
/* misconfigured item: next */
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (list[i].type)
|
||||
{
|
||||
case 0: /* string type */
|
||||
prefManager->SetCharPref(list[i].key, list[i].value);
|
||||
break;
|
||||
case 1: /* boolean type */
|
||||
if (strcmp(list[i].value, "true") == 0) {
|
||||
prefManager->SetBoolPref(list[i].key, (PRBool)1);
|
||||
}
|
||||
else if (strcmp(list[i].value, "false") == 0) {
|
||||
prefManager->SetBoolPref(list[i].key, (PRBool)0);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
intval = atoi(list[i].value);
|
||||
prefManager->SetIntPref(list[i].key, intval);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMComponent::PassPrefs()
|
||||
{
|
||||
// if we have not passed anything to psm yet, this function can just return.
|
||||
|
||||
if (!mControl)
|
||||
return NS_OK;
|
||||
|
||||
int i;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
char* strpref = NULL;
|
||||
int intpref;
|
||||
PRBool boolpref;
|
||||
CMSetPrefList prefs = {0};
|
||||
CMTSetPrefElement* list = NULL;
|
||||
|
||||
char* pickAuto = "Select Automatically";
|
||||
char* alwaysAsk = "Ask Every Time";
|
||||
|
||||
nsCOMPtr<nsIPref> prefManager;
|
||||
|
||||
nsresult res = nsServiceManager::GetService(kPrefCID,
|
||||
nsIPref::GetIID(),
|
||||
getter_AddRefs(prefManager));
|
||||
|
||||
if (NS_OK != res)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* allocate memory for list */
|
||||
prefs.n = 0; /* counter */
|
||||
prefs.capacity = INIT_NUM_PREFS;
|
||||
prefs.list = (CMTSetPrefElement*) new char[(INIT_NUM_PREFS * sizeof(CMTSetPrefElement))];
|
||||
|
||||
if (prefs.list == NULL)
|
||||
{
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* shorthand */
|
||||
list = prefs.list;
|
||||
|
||||
/* get preferences */
|
||||
get_pack_bool_pref(prefManager, "security.enable_ssl2", (CMTSetPrefElement*)list, &(prefs.n));
|
||||
get_pack_bool_pref(prefManager, "security.enable_ssl3", (CMTSetPrefElement*)list, &(prefs.n));
|
||||
|
||||
/* this pref is a boolean pref in nature but a string pref for
|
||||
* historical reason
|
||||
*/
|
||||
|
||||
list[prefs.n].key = nsCRT::strdup("security.default_personal_cert");
|
||||
list[prefs.n].type = STRING_PREF;
|
||||
|
||||
if ((prefManager->CopyCharPref(list[prefs.n].key, &strpref) == 0) && (strcmp(strpref, pickAuto) == 0))
|
||||
{
|
||||
list[prefs.n].value = nsCRT::strdup(pickAuto);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* although one could choose a specific cert for client auth in
|
||||
* Nova, that mode is deprecated with PSM and mapped to ASK
|
||||
*/
|
||||
list[prefs.n].value = nsCRT::strdup(alwaysAsk);
|
||||
}
|
||||
|
||||
prefs.n++;
|
||||
if (strpref != NULL)
|
||||
{
|
||||
nsCRT::free(strpref);
|
||||
}
|
||||
|
||||
list[prefs.n].key = nsCRT::strdup("security.default_mail_cert");
|
||||
list[prefs.n].type = STRING_PREF;
|
||||
if (prefManager->CopyCharPref(list[prefs.n].key, &list[prefs.n].value) != 0)
|
||||
{
|
||||
list[prefs.n].value = NULL;
|
||||
}
|
||||
prefs.n++;
|
||||
|
||||
list[prefs.n].key = nsCRT::strdup("security.ask_for_password");
|
||||
list[prefs.n].type = INT_PREF;
|
||||
if (prefManager->GetIntPref(list[prefs.n].key, &intpref) != 0)
|
||||
{
|
||||
intpref = 0; /* default */
|
||||
}
|
||||
|
||||
list[prefs.n].value = PR_smprintf("%d", intpref);
|
||||
prefs.n++;
|
||||
|
||||
list[prefs.n].key = nsCRT::strdup("security.password_lifetime");
|
||||
list[prefs.n].type = INT_PREF;
|
||||
if (prefManager->GetIntPref(list[prefs.n].key, &intpref) != 0)
|
||||
{
|
||||
intpref = 30; /* default */
|
||||
}
|
||||
|
||||
list[prefs.n].value = PR_smprintf("%d", intpref);
|
||||
prefs.n++;
|
||||
|
||||
/* OCSP preferences */
|
||||
/* XXX since these are the new ones added by PSM, we will be more
|
||||
* error-tolerant in fetching them
|
||||
*/
|
||||
if (prefManager->GetBoolPref("security.OCSP.enabled", &boolpref) == 0)
|
||||
{
|
||||
if (boolpref)
|
||||
{
|
||||
list[prefs.n].value = nsCRT::strdup("true");
|
||||
}
|
||||
else
|
||||
{
|
||||
list[prefs.n].value = nsCRT::strdup("false");
|
||||
}
|
||||
list[prefs.n].key = nsCRT::strdup("security.OCSP.enabled");
|
||||
list[prefs.n].type = BOOL_PREF;
|
||||
prefs.n++;
|
||||
}
|
||||
|
||||
if (prefManager->GetBoolPref("security.OCSP.useDefaultResponder", &boolpref) == 0)
|
||||
{
|
||||
if (boolpref)
|
||||
{
|
||||
list[prefs.n].value = nsCRT::strdup("true");
|
||||
}
|
||||
else
|
||||
{
|
||||
list[prefs.n].value = nsCRT::strdup("false");
|
||||
}
|
||||
list[prefs.n].key = nsCRT::strdup("security.OCSP.useDefaultResponder");
|
||||
list[prefs.n].type = BOOL_PREF;
|
||||
prefs.n++;
|
||||
}
|
||||
|
||||
if (prefManager->CopyCharPref("security.OCSP.URL", &strpref) == 0)
|
||||
{
|
||||
list[prefs.n].value = strpref;
|
||||
list[prefs.n].key = nsCRT::strdup("security.OCSP.URL");
|
||||
list[prefs.n].type = STRING_PREF;
|
||||
prefs.n++;
|
||||
}
|
||||
|
||||
if (prefManager->CopyCharPref("security.OCSP.signingCA", &strpref) == 0)
|
||||
{
|
||||
list[prefs.n].value = strpref;
|
||||
list[prefs.n].key = nsCRT::strdup("security.OCSP.signingCA");
|
||||
list[prefs.n].type = STRING_PREF;
|
||||
prefs.n++;
|
||||
}
|
||||
|
||||
/* now application-specific preferences */
|
||||
/* get navigator preferences */
|
||||
get_pack_bool_pref(prefManager, "security.warn_entering_secure", (CMTSetPrefElement*)list, &prefs.n);
|
||||
get_pack_bool_pref(prefManager, "security.warn_leaving_secure", (CMTSetPrefElement*)list, &prefs.n);
|
||||
get_pack_bool_pref(prefManager, "security.warn_viewing_mixed", (CMTSetPrefElement*)list, &prefs.n);
|
||||
get_pack_bool_pref(prefManager, "security.warn_submit_insecure", (CMTSetPrefElement*)list, &prefs.n);
|
||||
|
||||
// Add any other prefs here such as ldap or mail/news.
|
||||
|
||||
CMT_SetSavePrefsCallback(mControl, (savePrefsCallback_fn)SaveAllPrefs);
|
||||
|
||||
if (CMT_PassAllPrefs(mControl, prefs.n, (CMTSetPrefElement*)prefs.list) != CMTSuccess)
|
||||
{
|
||||
goto loser;
|
||||
}
|
||||
|
||||
rv = NS_OK; /* success */
|
||||
loser:
|
||||
/* clean out memory for prefs */
|
||||
for (i = 0; i < prefs.n; i++)
|
||||
{
|
||||
if (prefs.list[i].key != NULL)
|
||||
{
|
||||
nsCRT::free(prefs.list[i].key);
|
||||
}
|
||||
|
||||
if (prefs.list[i].value != NULL)
|
||||
{
|
||||
nsCRT::free(prefs.list[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
if (prefs.list != NULL)
|
||||
{
|
||||
delete(prefs.list);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
extern "C" {
|
||||
void RunMacPSM(void* arg);
|
||||
PRThread* SSM_CreateAndRegisterThread(PRThreadType type, void (*start)(void *arg),
|
||||
void *arg, PRThreadPriority priority,
|
||||
PRThreadScope scope, PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
void SSM_KillAllThreads(void);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMComponent::GetControlConnection( CMT_CONTROL * *_retval )
|
||||
{
|
||||
nsresult rv;
|
||||
*_retval = nsnull;
|
||||
if (mControl)
|
||||
{
|
||||
*_retval = mControl;
|
||||
return NS_OK;
|
||||
}
|
||||
else /* initialize mutex, sock table, etc. */
|
||||
{
|
||||
|
||||
if (nsPSMMutexInit() != PR_SUCCESS)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef XP_MAC
|
||||
/* FIXME: Really need better error handling in PSM, which simply exits on error. */
|
||||
/* use a cached monitor to rendezvous with the PSM thread. */
|
||||
PRMonitor* monitor = PR_CEnterMonitor(this);
|
||||
if (monitor != nsnull) {
|
||||
/* create the Cartman thread, and let it run awhile to get things going. */
|
||||
PRThread* cartmanThread = SSM_CreateAndRegisterThread(PR_USER_THREAD, RunMacPSM,
|
||||
this, PR_PRIORITY_NORMAL,
|
||||
PR_LOCAL_THREAD, PR_UNJOINABLE_THREAD, 0);
|
||||
if (cartmanThread != nsnull) {
|
||||
/* need a good way to rendezvouz with the Cartman thread. */
|
||||
PR_CWait(this, PR_INTERVAL_NO_TIMEOUT);
|
||||
}
|
||||
|
||||
PR_CExitMonitor(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Try to see if it is open already
|
||||
mControl = CMT_ControlConnect(&nsPSMMutexTbl, &nsPSMShimTbl);
|
||||
|
||||
// Find the one in the bin directory
|
||||
if (mControl == nsnull)
|
||||
{
|
||||
nsCOMPtr<nsILocalFile> psmAppFile;
|
||||
NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
directoryService->Get("system.OS_CurrentProcessDirectory",
|
||||
NS_GET_IID(nsIFile),
|
||||
getter_AddRefs(psmAppFile));
|
||||
|
||||
|
||||
psmAppFile->Append("psm");
|
||||
psmAppFile->Append(PSM_FILE_NAME);
|
||||
|
||||
PRBool isExecutable, exists;
|
||||
psmAppFile->Exists(&exists);
|
||||
psmAppFile->IsExecutable(&isExecutable);
|
||||
if (exists && isExecutable)
|
||||
{
|
||||
nsXPIDLCString path;
|
||||
psmAppFile->GetPath(getter_Copies(path));
|
||||
// FIX THIS. using a file path is totally wrong here.
|
||||
mControl = CMT_EstablishControlConnection((char*)(const char*)path, &nsPSMShimTbl, &nsPSMMutexTbl);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the one in the version registry
|
||||
if (mControl == nsnull)
|
||||
{
|
||||
//Try to find it.
|
||||
int err;
|
||||
char filepath[MAXREGPATHLEN];
|
||||
|
||||
err = VR_GetPath(PSM_VERSION_REG_KEY, sizeof(filepath), filepath);
|
||||
if ( err == REGERR_OK )
|
||||
{
|
||||
nsFileSpec psmSpec(filepath);
|
||||
psmSpec += PSM_FILE_NAME;
|
||||
|
||||
if (psmSpec.Exists())
|
||||
{
|
||||
mControl = CMT_EstablishControlConnection((char *)psmSpec.GetNativePathCString(), &nsPSMShimTbl, &nsPSMMutexTbl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!mControl || InitPSMUICallbacks(mControl) != PR_SUCCESS)
|
||||
goto failure;
|
||||
|
||||
nsFileSpec profileSpec;
|
||||
PRUnichar* profileName;
|
||||
|
||||
NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv);
|
||||
if (NS_FAILED(rv)) goto failure;
|
||||
|
||||
rv = profile->GetCurrentProfileDir(&profileSpec);
|
||||
if (NS_FAILED(rv)) goto failure;;
|
||||
|
||||
#ifdef XP_MAC
|
||||
profileSpec += "Security";
|
||||
// make sure the dir exists
|
||||
profileSpec.CreateDirectory();
|
||||
#endif
|
||||
|
||||
rv = profile->GetCurrentProfile(&profileName);
|
||||
if (NS_FAILED(rv)) goto failure;
|
||||
|
||||
CMTStatus psmStatus;
|
||||
nsCAutoString profilenameC;
|
||||
profilenameC.AssignWithConversion(profileName);
|
||||
|
||||
psmStatus = CMT_Hello( mControl,
|
||||
PROTOCOL_VERSION,
|
||||
profilenameC,
|
||||
(char*)profileSpec.GetNativePathCString());
|
||||
|
||||
if (psmStatus == CMTFailure)
|
||||
{
|
||||
PR_FREEIF(profileName);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
if (InitPSMEventLoop(mControl) != PR_SUCCESS)
|
||||
{
|
||||
PR_FREEIF(profileName);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
if (NS_FAILED(PassPrefs()))
|
||||
{
|
||||
PR_FREEIF(profileName);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
PR_FREEIF(profileName);
|
||||
|
||||
nsCOMPtr<nsIProtocolProxyService> proxySvc = do_GetService(kProtocolProxyServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
proxySvc->AddNoProxyFor("127.0.0.1", mControl->port);
|
||||
|
||||
*_retval = mControl;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
failure:
|
||||
#ifdef DEBUG
|
||||
printf("*** Failure setting up Cartman! \n");
|
||||
#endif
|
||||
|
||||
if (mControl)
|
||||
{
|
||||
CMT_CloseControlConnection(mControl);
|
||||
mControl = NULL;
|
||||
}
|
||||
|
||||
// TODO we need to unregister our UI callback BEFORE destroying our mutex.
|
||||
// nsPSMMutexDestroy();
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMComponent::DisplaySecurityAdvisor(const char *pickledStatus, const char *hostName)
|
||||
{
|
||||
CMT_CONTROL *controlConnection;
|
||||
GetControlConnection( &controlConnection );
|
||||
if (DisplayPSMUIDialog(controlConnection, pickledStatus, hostName) == PR_SUCCESS)
|
||||
return NS_OK;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
class CertDownloader : public nsIStreamListener
|
||||
{
|
||||
public:
|
||||
CertDownloader() {NS_ASSERTION(0, "don't use this constructor."); }
|
||||
CertDownloader(PRInt32 type);
|
||||
virtual ~CertDownloader();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISTREAMOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
protected:
|
||||
char* mByteData;
|
||||
PRInt32 mBufferOffset;
|
||||
PRInt32 mContentLength;
|
||||
PRInt32 mType;
|
||||
};
|
||||
|
||||
|
||||
CertDownloader::CertDownloader(PRInt32 type)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mByteData = nsnull;
|
||||
mType = type;
|
||||
}
|
||||
|
||||
CertDownloader::~CertDownloader()
|
||||
{
|
||||
if (mByteData)
|
||||
nsMemory::Free(mByteData);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(CertDownloader,NS_GET_IID(nsIStreamListener));
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CertDownloader::OnStartRequest(nsIChannel* channel, nsISupports* context)
|
||||
{
|
||||
channel->GetContentLength(&mContentLength);
|
||||
if (mContentLength == -1)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mBufferOffset = 0;
|
||||
mByteData = (char*) nsMemory::Alloc(mContentLength);
|
||||
if (!mByteData)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CertDownloader::OnDataAvailable(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
if (!mByteData)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRUint32 amt;
|
||||
nsresult err;
|
||||
|
||||
do
|
||||
{
|
||||
err = aIStream->Read(mByteData+mBufferOffset, mContentLength-mBufferOffset, &amt);
|
||||
if (amt == 0) break;
|
||||
if (NS_FAILED(err)) return err;
|
||||
|
||||
aLength -= amt;
|
||||
mBufferOffset += amt;
|
||||
|
||||
} while (aLength > 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CertDownloader::OnStopRequest(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
|
||||
nsCOMPtr<nsIPSMComponent> psm = do_QueryInterface(context);
|
||||
|
||||
if (!psm) return NS_ERROR_FAILURE;
|
||||
|
||||
CMT_CONTROL *controlConnection;
|
||||
psm->GetControlConnection( &controlConnection );
|
||||
unsigned int certID;
|
||||
|
||||
certID = CMT_DecodeAndCreateTempCert(controlConnection, mByteData, mContentLength, mType);
|
||||
|
||||
if (certID)
|
||||
CMT_DestroyResource(controlConnection, certID, SSM_RESTYPE_CERTIFICATE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* other mime types that we should handle sometime:
|
||||
|
||||
application/x-pkcs7-crl
|
||||
application/x-pkcs7-mime
|
||||
application/pkcs7-signature
|
||||
application/pre-encrypted
|
||||
|
||||
*/
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMComponent::HandleContent(const char * aContentType,
|
||||
const char * aCommand,
|
||||
const char * aWindowTarget,
|
||||
nsISupports* aWindowContext,
|
||||
nsIChannel * aChannel)
|
||||
{
|
||||
// We were called via CI. We better protect ourselves and addref.
|
||||
NS_ADDREF_THIS();
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (!aChannel) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
CMUint32 type = -1;
|
||||
|
||||
if ( nsCRT::strcasecmp(aContentType, "application/x-x509-ca-cert") == 0)
|
||||
{
|
||||
type = 1; //CA cert
|
||||
}
|
||||
else if (nsCRT::strcasecmp(aContentType, "application/x-x509-server-cert") == 0)
|
||||
{
|
||||
type = 2; //Server cert
|
||||
}
|
||||
else if (nsCRT::strcasecmp(aContentType, "application/x-x509-user-cert") == 0)
|
||||
{
|
||||
type = 3; //User cert
|
||||
}
|
||||
else if (nsCRT::strcasecmp(aContentType, "application/x-x509-email-cert") == 0)
|
||||
{
|
||||
type = 4; //Someone else's email cert
|
||||
}
|
||||
|
||||
if (type != -1)
|
||||
{
|
||||
// I can't directly open the passed channel cause it fails :-(
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = aChannel->GetURI(getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = NS_OpenURI(getter_AddRefs(channel), uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return channel->AsyncRead(new CertDownloader(type), NS_STATIC_CAST(nsIPSMComponent*,this));
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------
|
||||
// Functions Implenenting NSISignatureVerifier
|
||||
//---------------------------------------------
|
||||
NS_IMETHODIMP
|
||||
nsPSMComponent::HashBegin(PRUint32 alg, PRUint32* id)
|
||||
{
|
||||
CMT_CONTROL *controlConnection;
|
||||
if (NS_FAILED(GetControlConnection( &controlConnection )))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if(CMT_HashCreate(controlConnection, alg, (CMUint32*)id) != CMTSuccess)
|
||||
return NS_ERROR_FAILURE;
|
||||
if(CMT_HASH_Begin(controlConnection, *id) != CMTSuccess)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMComponent::HashUpdate(PRUint32 id, const char* buf, PRUint32 buflen)
|
||||
{
|
||||
CMT_CONTROL *controlConnection;
|
||||
|
||||
if (NS_FAILED(GetControlConnection( &controlConnection )))
|
||||
return NS_ERROR_FAILURE;
|
||||
if (CMT_HASH_Update(controlConnection, id,
|
||||
(const unsigned char*)buf, buflen) != CMTSuccess)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMComponent::HashEnd(PRUint32 id, unsigned char** hash,
|
||||
PRUint32* hashLen, PRUint32 maxLen)
|
||||
{
|
||||
if (!hash)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
CMT_CONTROL *controlConnection;
|
||||
if (NS_FAILED(GetControlConnection( &controlConnection )))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if(CMT_HASH_End(controlConnection, id, *hash,
|
||||
(CMUint32*)hashLen, maxLen) != CMTSuccess)
|
||||
return NS_ERROR_FAILURE;
|
||||
CMT_HASH_Destroy(controlConnection, id);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMComponent::CreatePrincipalFromSignature(const char* aRSABuf, PRUint32 aRSABufLen,
|
||||
nsIPrincipal** aPrincipal)
|
||||
{
|
||||
PRInt32 errorCode;
|
||||
return VerifySignature(aRSABuf, aRSABufLen, nsnull, 0, &errorCode, aPrincipal);
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(void)
|
||||
UselessPK7DataSink(void* arg, const char* buf, CMUint32 len)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMComponent::VerifySignature(const char* aRSABuf, PRUint32 aRSABufLen,
|
||||
const char* aPlaintext, PRUint32 aPlaintextLen,
|
||||
PRInt32* aErrorCode,
|
||||
nsIPrincipal** aPrincipal)
|
||||
{
|
||||
if (!aPrincipal || !aErrorCode)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aErrorCode = 0;
|
||||
*aPrincipal = nsnull;
|
||||
|
||||
CMT_CONTROL *controlConnection;
|
||||
if (NS_FAILED(GetControlConnection( &controlConnection )))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
//-- Decode the signature stream
|
||||
CMUint32 decoderID;
|
||||
CMInt32* blah = nsnull;
|
||||
CMTStatus result = CMT_PKCS7DecoderStart(controlConnection, nsnull,
|
||||
&decoderID, blah,
|
||||
UselessPK7DataSink, nsnull);
|
||||
if (result != CMTSuccess) return NS_ERROR_FAILURE;
|
||||
result = CMT_PKCS7DecoderUpdate(controlConnection, decoderID, aRSABuf, aRSABufLen);
|
||||
if (result != CMTSuccess) return NS_ERROR_FAILURE;
|
||||
CMUint32 contentInfo;
|
||||
result = CMT_PKCS7DecoderFinish(controlConnection,
|
||||
decoderID, &contentInfo);
|
||||
if (result != CMTSuccess) return NS_ERROR_FAILURE;
|
||||
|
||||
CMTItem hashItem;
|
||||
hashItem.data = 0;
|
||||
hashItem.len = 0;
|
||||
//-- If a plaintext was provided, hash it.
|
||||
if (aPlaintext)
|
||||
{
|
||||
CMUint32 hashId;
|
||||
CMT_HashCreate(controlConnection, nsISignatureVerifier::SHA1, &hashId);
|
||||
CMT_HASH_Begin(controlConnection, hashId);
|
||||
CMTStatus result = CMT_HASH_Update(controlConnection, hashId,
|
||||
(const unsigned char*)aPlaintext, aPlaintextLen);
|
||||
if (result != CMTSuccess) return NS_ERROR_FAILURE;
|
||||
|
||||
unsigned char* hash = (unsigned char*)PR_MALLOC(nsISignatureVerifier::SHA1_LENGTH);
|
||||
if (!hash) return NS_ERROR_OUT_OF_MEMORY;
|
||||
CMUint32 hashLen;
|
||||
result = CMT_HASH_End(controlConnection, hashId, hash,
|
||||
&hashLen, nsISignatureVerifier::SHA1_LENGTH);
|
||||
if (result != CMTSuccess)
|
||||
{
|
||||
PR_FREEIF(hash);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_ASSERTION(hashLen == nsISignatureVerifier::SHA1_LENGTH,
|
||||
"PSMComponent: Hash too short.");
|
||||
CMT_HASH_Destroy(controlConnection, hashId);
|
||||
hashItem.data = hash;
|
||||
hashItem.len = hashLen;
|
||||
}
|
||||
|
||||
//-- Verify signature
|
||||
// We need to call this function even if we're only creating a principal, not
|
||||
// verifying, because PSM won't give us certificate information unless this
|
||||
// function has been called.
|
||||
result = CMT_PKCS7VerifyDetachedSignature(controlConnection, contentInfo,
|
||||
6 /* =Object Signing Cert */,
|
||||
3 /* =SHA1 algorithm (MD5=2)*/,
|
||||
1,/* Save Certificate */
|
||||
&hashItem, (CMInt32*)aErrorCode);
|
||||
|
||||
if (result != CMTSuccess) return NS_ERROR_FAILURE;
|
||||
if (aPlaintext && *aErrorCode != 0) return NS_OK; // Verification failed.
|
||||
|
||||
CMUint32 certID;
|
||||
result = CMT_GetRIDAttribute(controlConnection, contentInfo,
|
||||
SSM_FID_P7CINFO_SIGNER_CERT, &certID);
|
||||
if ((result != CMTSuccess) || !certID) return NS_OK; // No signature present
|
||||
|
||||
CMTItem fingerprint;
|
||||
result = CMT_GetStringAttribute(controlConnection, certID,
|
||||
SSM_FID_CERT_FINGERPRINT, &fingerprint);
|
||||
if (result != CMTSuccess) return NS_ERROR_FAILURE;
|
||||
|
||||
//-- Get a principal
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv)
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
rv = secMan->GetCertificatePrincipal((char*)fingerprint.data,
|
||||
aPrincipal);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
//-- Get common name and store it in the principal.
|
||||
// Using common name + organizational unit as the user-visible certificate name
|
||||
nsCOMPtr<nsICertificatePrincipal> certificate = do_QueryInterface(*aPrincipal, &rv);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
CMTItem common;
|
||||
result = CMT_GetStringAttribute(controlConnection, certID,
|
||||
SSM_FID_CERT_COMMON_NAME, &common);
|
||||
if (result != CMTSuccess) return NS_ERROR_FAILURE;
|
||||
CMTItem subject;
|
||||
result = CMT_GetStringAttribute(controlConnection, certID,
|
||||
SSM_FID_CERT_SUBJECT_NAME, &subject);
|
||||
if (result != CMTSuccess) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCAutoString commonName;
|
||||
commonName = (char*)common.data;
|
||||
static const char orgUnitTag[] = " OU=";
|
||||
char* orgUnitPos = PL_strstr((char*)subject.data, orgUnitTag);
|
||||
if (orgUnitPos)
|
||||
{
|
||||
orgUnitPos += sizeof(orgUnitTag)-1;
|
||||
char* orgUnitEnd = PL_strchr(orgUnitPos, ',');
|
||||
PRInt32 orgUnitLen;
|
||||
if(orgUnitEnd)
|
||||
orgUnitLen = orgUnitEnd - orgUnitPos;
|
||||
else
|
||||
orgUnitLen = PL_strlen(orgUnitPos);
|
||||
commonName.Append(' ');
|
||||
commonName.Append(orgUnitPos, orgUnitLen);
|
||||
}
|
||||
char* commonChar = commonName.ToNewCString();
|
||||
if (!commonChar) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = certificate->SetCommonName(commonChar);
|
||||
Recycle(commonChar);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsIPSMComponent.h"
|
||||
#include "nsISignatureVerifier.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
#include "nsIContentHandler.h"
|
||||
|
||||
#define SECURITY_STRING_BUNDLE_URL "chrome://communicator/locale/security.properties"
|
||||
|
||||
#define NS_PSMCOMPONENT_CID {0xddcae170, 0x5412, 0x11d3, {0xbb, 0xc8, 0x00, 0x00, 0x86, 0x1d, 0x12, 0x37}}
|
||||
|
||||
// Implementation of the PSM component interface.
|
||||
class nsPSMComponent : public nsIPSMComponent,
|
||||
public nsIContentHandler,
|
||||
public nsISignatureVerifier
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_CID_ACCESSOR( NS_PSMCOMPONENT_CID );
|
||||
|
||||
nsPSMComponent();
|
||||
virtual ~nsPSMComponent();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPSMCOMPONENT
|
||||
NS_DECL_NSICONTENTHANDLER
|
||||
NS_DECL_NSISIGNATUREVERIFIER
|
||||
|
||||
static NS_METHOD CreatePSMComponent(nsISupports* aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
private:
|
||||
|
||||
PCMT_CONTROL mControl;
|
||||
|
||||
nsCOMPtr<nsISupports> mSecureBrowserIU;
|
||||
static nsPSMComponent* mInstance;
|
||||
};
|
||||
@@ -1,178 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsIModule.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "nsPSMUICallbacks.h"
|
||||
#include "nsPSMComponent.h"
|
||||
|
||||
#include "nsISecureBrowserUI.h"
|
||||
#include "nsSecureBrowserUIImpl.h"
|
||||
|
||||
#include "nsSSLSocketProvider.h"
|
||||
|
||||
#include "nsSDR.h"
|
||||
#include "nsFSDR.h"
|
||||
#include "nsCrypto.h"
|
||||
#include "nsKeygenHandler.h"
|
||||
//For the NS_CRYPTO_PROGID define
|
||||
#include "nsDOMCID.h"
|
||||
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
|
||||
// Define SDR object constructor
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kFormProcessorCID, NS_IFORMPROCESSOR_CID);
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSecretDecoderRing, init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFSecretDecoderRing, init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsCrypto, init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPkcs11, init)
|
||||
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{
|
||||
PSM_COMPONENT_CLASSNAME,
|
||||
NS_PSMCOMPONENT_CID,
|
||||
PSM_COMPONENT_PROGID,
|
||||
nsPSMComponent::CreatePSMComponent
|
||||
},
|
||||
|
||||
{
|
||||
"PSM Content Handler - application/x-x509-ca-cert",
|
||||
NS_PSMCOMPONENT_CID,
|
||||
NS_CONTENT_HANDLER_PROGID_PREFIX"application/x-x509-ca-cert",
|
||||
nsPSMComponent::CreatePSMComponent
|
||||
},
|
||||
|
||||
{
|
||||
"PSM Content Handler - application/x-x509-server-cert",
|
||||
NS_PSMCOMPONENT_CID,
|
||||
NS_CONTENT_HANDLER_PROGID_PREFIX"application/x-x509-server-cert",
|
||||
nsPSMComponent::CreatePSMComponent
|
||||
},
|
||||
|
||||
{
|
||||
"PSM Content Handler - application/x-x509-user-cert",
|
||||
NS_PSMCOMPONENT_CID,
|
||||
NS_CONTENT_HANDLER_PROGID_PREFIX"application/x-x509-user-cert",
|
||||
nsPSMComponent::CreatePSMComponent
|
||||
},
|
||||
|
||||
{
|
||||
"PSM Content Handler - application/x-x509-email-cert",
|
||||
NS_PSMCOMPONENT_CID,
|
||||
NS_CONTENT_HANDLER_PROGID_PREFIX"application/x-x509-email-cert",
|
||||
nsPSMComponent::CreatePSMComponent
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
PSM_UI_HANLDER_CLASSNAME,
|
||||
NS_PSMUIHANDLER_CID,
|
||||
PSM_UI_HANLDER_PROGID,
|
||||
nsPSMUIHandlerImpl::CreatePSMUIHandler
|
||||
},
|
||||
|
||||
{
|
||||
NS_SECURE_BROWSER_UI_CLASSNAME,
|
||||
NS_SECURE_BROWSER_UI_CID,
|
||||
NS_SECURE_BROWSER_UI_PROGID,
|
||||
nsSecureBrowserUIImpl::Create
|
||||
},
|
||||
|
||||
{
|
||||
NS_SECURE_BROWSER_DOCOBSERVER_CLASSNAME,
|
||||
NS_SECURE_BROWSER_DOCOBSERVER_CID,
|
||||
NS_SECURE_BROWSER_DOCOBSERVER_PROGID,
|
||||
nsSecureBrowserUIImpl::Create
|
||||
},
|
||||
|
||||
{
|
||||
NS_ISSLSOCKETPROVIDER_CLASSNAME,
|
||||
NS_SSLSOCKETPROVIDER_CID,
|
||||
NS_ISSLSOCKETPROVIDER_PROGID,
|
||||
nsSSLSocketProvider::Create
|
||||
},
|
||||
|
||||
{
|
||||
NS_SDR_CLASSNAME,
|
||||
NS_SDR_CID,
|
||||
NS_SDR_PROGID,
|
||||
nsSecretDecoderRingConstructor
|
||||
},
|
||||
|
||||
{
|
||||
NS_FSDR_CLASSNAME,
|
||||
NS_FSDR_CID,
|
||||
NS_FSDR_PROGID,
|
||||
nsFSecretDecoderRingConstructor
|
||||
},
|
||||
|
||||
{
|
||||
NS_CRYPTO_CLASSNAME,
|
||||
NS_CRYPTO_CID,
|
||||
NS_CRYPTO_PROGID,
|
||||
nsCryptoConstructor
|
||||
},
|
||||
{
|
||||
NS_PKCS11_CLASSNAME,
|
||||
NS_PKCS11_CID,
|
||||
NS_PKCS11_PROGID,
|
||||
nsPkcs11Constructor
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#if 0
|
||||
NS_IMPL_NSGETMODULE("PSMComponent", components);
|
||||
#endif
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *servMgr,
|
||||
nsIFile* location,
|
||||
nsIModule** result)
|
||||
{
|
||||
nsresult rv;
|
||||
// Put in code to register KEYGEN form input handler.
|
||||
rv= NS_NewGenericModule("PSMComponent",
|
||||
sizeof(components) / sizeof(components[0]),
|
||||
components, nsnull, result);
|
||||
// Register a form processor. The form processor has the opportunity to
|
||||
// modify the value's passed during form submission.
|
||||
nsKeygenFormProcessor* testFormProcessor = new nsKeygenFormProcessor();
|
||||
nsCOMPtr<nsISupports> formProcessor;
|
||||
rv = testFormProcessor->QueryInterface(kISupportsIID,
|
||||
getter_AddRefs(formProcessor));
|
||||
if (NS_SUCCEEDED(rv) && formProcessor) {
|
||||
rv = nsServiceManager::RegisterService(kFormProcessorCID, formProcessor);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "prmon.h"
|
||||
#include "prtypes.h"
|
||||
|
||||
#include "nsPSMMutex.h"
|
||||
|
||||
static PRMonitor *_nsPSMMutexVar;
|
||||
|
||||
PRStatus
|
||||
nsPSMMutexInit()
|
||||
{
|
||||
if (!_nsPSMMutexVar)
|
||||
_nsPSMMutexVar = PR_NewMonitor();
|
||||
|
||||
return _nsPSMMutexVar ? PR_SUCCESS : PR_FAILURE;
|
||||
}
|
||||
|
||||
PRStatus
|
||||
nsPSMMutexDestroy()
|
||||
{
|
||||
if (!_nsPSMMutexVar)
|
||||
return PR_FAILURE;
|
||||
|
||||
PR_Wait(_nsPSMMutexVar, PR_INTERVAL_NO_TIMEOUT);
|
||||
|
||||
PR_DestroyMonitor(_nsPSMMutexVar);
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
nsPSMMutexLock(CMTMutexPointer *p)
|
||||
{
|
||||
PR_EnterMonitor(*(PRMonitor **)p);
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
nsPSMMutexUnlock(CMTMutexPointer *p)
|
||||
{
|
||||
PR_ExitMonitor(*(PRMonitor **)p);
|
||||
return;
|
||||
}
|
||||
|
||||
CMT_MUTEX nsPSMMutexTbl =
|
||||
{
|
||||
&_nsPSMMutexVar,
|
||||
(CMTMutexFunction)nsPSMMutexLock,
|
||||
(CMTMutexFunction)nsPSMMutexUnlock
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NSPSMMUTEX_H
|
||||
#define _NSPSMMUTEX_H
|
||||
|
||||
#include "cmtcmn.h"
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
PR_EXTERN(CMT_MUTEX) nsPSMMutexTbl;
|
||||
|
||||
PR_EXTERN(PRStatus) nsPSMMutexInit(void);
|
||||
PR_EXTERN(PRStatus) nsPSMMutexDestroy(void);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif
|
||||
@@ -1,293 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nspr.h"
|
||||
#include "nsPSMShimLayer.h"
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include "private/pprio.h" /* for PR_Socket */
|
||||
#endif
|
||||
|
||||
#define PSM_TIMEOUT_IN_SEC 300
|
||||
|
||||
#define NSPSMSHIMMAXFD 50
|
||||
|
||||
|
||||
static PRIntervalTime gTimeout = PR_INTERVAL_NO_TIMEOUT;
|
||||
|
||||
CMT_SocketFuncs nsPSMShimTbl =
|
||||
{
|
||||
nsPSMShimGetSocket,
|
||||
nsPSMShimConnect,
|
||||
nsPSMShimVerifyUnixSocket,
|
||||
nsPSMShimSend,
|
||||
nsPSMShimSelect,
|
||||
nsPSMShimReceive,
|
||||
nsPSMShimShutdown,
|
||||
nsPSMShimClose
|
||||
};
|
||||
|
||||
|
||||
CMTSocket
|
||||
nsPSMShimGetSocket(int unixSock)
|
||||
{
|
||||
PRStatus rv;
|
||||
PRFileDesc *fd;
|
||||
CMSocket *sock;
|
||||
PRSocketOptionData sockopt;
|
||||
|
||||
/*
|
||||
if (PR_INTERVAL_NO_WAIT == gTimeout)
|
||||
{
|
||||
gTimeout = PR_SecondsToInterval(PSM_TIMEOUT_IN_SEC);
|
||||
}
|
||||
*/
|
||||
|
||||
if (unixSock)
|
||||
{
|
||||
#ifndef XP_UNIX
|
||||
return NULL;
|
||||
#else
|
||||
fd = PR_Socket(PR_AF_LOCAL, PR_SOCK_STREAM, 0);
|
||||
PR_ASSERT(fd);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
fd = PR_NewTCPSocket();
|
||||
PR_ASSERT(fd);
|
||||
|
||||
/* disable Nagle algorithm delay for control sockets */
|
||||
sockopt.option = PR_SockOpt_NoDelay;
|
||||
sockopt.value.no_delay = PR_TRUE;
|
||||
rv = PR_SetSocketOption(fd, &sockopt);
|
||||
PR_ASSERT(PR_SUCCESS == rv);
|
||||
}
|
||||
|
||||
sock = (CMSocket *)PR_Malloc(sizeof(CMSocket));
|
||||
|
||||
if (sock == NULL)
|
||||
return sock;
|
||||
|
||||
sock->fd = fd;
|
||||
sock->isUnix = unixSock;
|
||||
|
||||
memset(&sock->netAddr, 0, sizeof(PRNetAddr));
|
||||
|
||||
return (CMTSocket)sock;
|
||||
}
|
||||
|
||||
CMTStatus
|
||||
nsPSMShimConnect(CMTSocket sock, short port, char *path)
|
||||
{
|
||||
CMTStatus rv = CMTSuccess;
|
||||
PRStatus err;
|
||||
PRErrorCode errcode;
|
||||
PRSocketOptionData sockopt;
|
||||
PRBool nonBlocking;
|
||||
CMSocket *cmSock = (CMSocket *)sock;
|
||||
|
||||
if (!sock) return CMTFailure;
|
||||
|
||||
if (cmSock->isUnix)
|
||||
{
|
||||
#ifndef XP_UNIX
|
||||
return CMTFailure;
|
||||
#else
|
||||
int pathLen;
|
||||
if (!path)
|
||||
{
|
||||
return CMTFailure;
|
||||
}
|
||||
|
||||
/* check buffer overrun */
|
||||
pathLen = strlen(path)+1;
|
||||
|
||||
pathLen = pathLen < sizeof(cmSock->netAddr.local.path)
|
||||
? pathLen : sizeof(cmSock->netAddr.local.path);
|
||||
|
||||
memcpy(&cmSock->netAddr.local.path, path, pathLen);
|
||||
cmSock->netAddr.local.family = PR_AF_LOCAL;
|
||||
#endif
|
||||
}
|
||||
else /* cmSock->isUnix */
|
||||
{
|
||||
cmSock->netAddr.inet.family = PR_AF_INET;
|
||||
cmSock->netAddr.inet.port = PR_htons(port);
|
||||
cmSock->netAddr.inet.ip = PR_htonl(PR_INADDR_LOOPBACK);
|
||||
}
|
||||
|
||||
/* Save non-blocking status */
|
||||
sockopt.option = PR_SockOpt_Nonblocking;
|
||||
err = PR_GetSocketOption(cmSock->fd, &sockopt);
|
||||
PR_ASSERT(PR_SUCCESS == err);
|
||||
|
||||
nonBlocking = sockopt.value.non_blocking;
|
||||
|
||||
/* make connect blocking for now */
|
||||
sockopt.option = PR_SockOpt_Nonblocking;
|
||||
sockopt.value.non_blocking = PR_FALSE;
|
||||
err = PR_SetSocketOption(cmSock->fd, &sockopt);
|
||||
PR_ASSERT(PR_SUCCESS == err);
|
||||
|
||||
err = PR_Connect( cmSock->fd, &cmSock->netAddr, PR_INTERVAL_MAX );
|
||||
|
||||
if (err == PR_FAILURE)
|
||||
{
|
||||
errcode = PR_GetError();
|
||||
|
||||
if (PR_IS_CONNECTED_ERROR != errcode)
|
||||
rv = CMTFailure;
|
||||
}
|
||||
|
||||
/* restore nonblock status */
|
||||
if (nonBlocking) {
|
||||
sockopt.option = PR_SockOpt_Nonblocking;
|
||||
sockopt.value.non_blocking = nonBlocking;
|
||||
err = PR_SetSocketOption(cmSock->fd, &sockopt);
|
||||
PR_ASSERT(PR_SUCCESS == err);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
CMTStatus
|
||||
nsPSMShimVerifyUnixSocket(CMTSocket sock)
|
||||
{
|
||||
#ifndef XP_UNIX
|
||||
return CMTFailure;
|
||||
#else
|
||||
|
||||
int rv;
|
||||
CMSocket *cmSock;
|
||||
struct stat statbuf;
|
||||
|
||||
cmSock = (CMSocket *)sock;
|
||||
|
||||
if (!cmSock || !cmSock->isUnix)
|
||||
return CMTFailure;
|
||||
|
||||
rv = stat(cmSock->netAddr.local.path, &statbuf);
|
||||
if (rv < 0 || statbuf.st_uid != geteuid() )
|
||||
{
|
||||
PR_Close(cmSock->fd);
|
||||
cmSock->fd = NULL;
|
||||
PR_Free(cmSock);
|
||||
return CMTFailure;
|
||||
}
|
||||
return CMTSuccess;
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t
|
||||
nsPSMShimSend(CMTSocket sock, void *buffer, size_t length)
|
||||
{
|
||||
CMSocket *cmSock = (CMSocket *)sock;
|
||||
|
||||
if (!sock) return CMTFailure;
|
||||
|
||||
return PR_Send(cmSock->fd, buffer, length, 0, gTimeout);
|
||||
}
|
||||
|
||||
size_t
|
||||
nsPSMShimReceive(CMTSocket sock, void *buffer, size_t bufSize)
|
||||
{
|
||||
CMSocket *cmSock = (CMSocket *)sock;
|
||||
|
||||
if (!sock) return CMTFailure;
|
||||
|
||||
return PR_Recv(cmSock->fd, buffer, bufSize, 0, gTimeout);
|
||||
}
|
||||
|
||||
|
||||
CMTSocket
|
||||
nsPSMShimSelect(CMTSocket *socks, int numsocks, int poll)
|
||||
{
|
||||
CMSocket **sockArr = (CMSocket **)socks;
|
||||
PRPollDesc readPDs[NSPSMSHIMMAXFD];
|
||||
PRIntervalTime timeout;
|
||||
PRInt32 cnt;
|
||||
int i;
|
||||
|
||||
if (!socks) return NULL;
|
||||
|
||||
memset(readPDs, 0, sizeof(readPDs));
|
||||
|
||||
PR_ASSERT(NSPSMSHIMMAXFD >= numsocks);
|
||||
|
||||
for (i=0; i<numsocks; i++)
|
||||
{
|
||||
readPDs[i].fd = sockArr[i]->fd;
|
||||
readPDs[i].in_flags = PR_POLL_READ;
|
||||
}
|
||||
|
||||
timeout = poll ? PR_INTERVAL_NO_WAIT : PR_INTERVAL_NO_TIMEOUT;
|
||||
|
||||
cnt = PR_Poll(readPDs, numsocks, timeout);
|
||||
|
||||
/* Figure out which socket was selected */
|
||||
if (cnt > 0)
|
||||
{
|
||||
for (i=0; i<numsocks; i++)
|
||||
{
|
||||
if (readPDs[i].out_flags & PR_POLL_READ)
|
||||
{
|
||||
return (CMTSocket)sockArr[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
CMTStatus
|
||||
nsPSMShimShutdown(CMTSocket sock)
|
||||
{
|
||||
CMSocket *cmSock = (CMSocket*)sock;
|
||||
PRStatus rv;
|
||||
|
||||
if (!sock) return CMTFailure;
|
||||
|
||||
rv = PR_Shutdown(cmSock->fd, PR_SHUTDOWN_SEND);
|
||||
return (PR_SUCCESS == rv) ? CMTSuccess : CMTFailure;
|
||||
}
|
||||
|
||||
CMTStatus
|
||||
nsPSMShimClose(CMTSocket sock)
|
||||
{
|
||||
CMSocket *cmSock = (CMSocket*)sock;
|
||||
PRStatus rv = PR_SUCCESS;
|
||||
PR_ASSERT(cmSock);
|
||||
|
||||
if (!sock) return CMTFailure;
|
||||
|
||||
rv = PR_Close(cmSock->fd);
|
||||
cmSock->fd = NULL;
|
||||
|
||||
PR_Free(cmSock);
|
||||
|
||||
return (PR_SUCCESS == rv) ? CMTSuccess : CMTFailure;
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NSPSMSHIMLAYER_H_
|
||||
#define _NSPSMSHIMLAYER_H_
|
||||
|
||||
#include "cmtcmn.h"
|
||||
#include "prio.h"
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
typedef struct CMSocket {
|
||||
PRFileDesc *fd;
|
||||
PRBool isUnix;
|
||||
PRNetAddr netAddr;
|
||||
} CMSocket;
|
||||
|
||||
PR_EXTERN(CMT_SocketFuncs) nsPSMShimTbl;
|
||||
|
||||
PR_EXTERN(CMTSocket)
|
||||
nsPSMShimGetSocket(int unixSock);
|
||||
|
||||
PR_EXTERN(CMTStatus)
|
||||
nsPSMShimConnect(CMTSocket sock, short port, char *path);
|
||||
|
||||
PR_EXTERN(CMTStatus)
|
||||
nsPSMShimVerifyUnixSocket(CMTSocket sock);
|
||||
|
||||
PR_EXTERN(size_t)
|
||||
nsPSMShimSend(CMTSocket sock, void *buffer, size_t length);
|
||||
|
||||
PR_EXTERN(CMTSocket)
|
||||
nsPSMShimSelect(CMTSocket *socks, int numsocks, int poll);
|
||||
|
||||
PR_EXTERN(size_t)
|
||||
nsPSMShimReceive(CMTSocket sock, void *buffer, size_t bufSize);
|
||||
|
||||
PR_EXTERN(CMTStatus)
|
||||
nsPSMShimShutdown(CMTSocket sock);
|
||||
|
||||
PR_EXTERN(CMTStatus)
|
||||
nsPSMShimClose(CMTSocket sock);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* _NSPSMSHIMLAYER_H_ */
|
||||
@@ -1,348 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsProxiedService.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsPSMUICallbacks.h"
|
||||
#include "nsINetSupportDialogService.h"
|
||||
#include "nsIFilePicker.h"
|
||||
|
||||
#include "nsAppShellCIDs.h"
|
||||
#include "prprf.h"
|
||||
#include "prmem.h"
|
||||
|
||||
#include "nsSSLIOLayer.h" // for SSMSTRING_PADDED_LENGTH
|
||||
#include "ssmdefs.h"
|
||||
#include "rsrcids.h"
|
||||
|
||||
// Interfaces Needed
|
||||
#include "nsIAppShellService.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIXULWindow.h"
|
||||
|
||||
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
||||
static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
|
||||
|
||||
|
||||
// Happy callbacks
|
||||
static char * PromptUserCallback(void *arg, char *prompt, int isPasswd);
|
||||
static char * FilePathPromptCallback(void *arg, char *prompt, char *fileRegEx, CMUint32 shouldFileExist);
|
||||
static void ApplicationFreeCallback(char *userInput);
|
||||
|
||||
static void * CartmanUIHandler(uint32 resourceID, void* clientContext, uint32 width, uint32 height,
|
||||
CMBool isModal, char* urlStr, void *data);
|
||||
|
||||
extern "C" void CARTMAN_UIEventLoop(void *data);
|
||||
|
||||
|
||||
/* nsISupports Implementation for the class */
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsPSMUIHandlerImpl, nsIPSMUIHandler)
|
||||
|
||||
NS_METHOD
|
||||
nsPSMUIHandlerImpl::DisplayURI(PRInt32 width, PRInt32 height, PRBool modal, const char *urlStr)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMWindow> hiddenWindow;
|
||||
JSContext *jsContext;
|
||||
|
||||
NS_WITH_SERVICE(nsIAppShellService, appShell, kAppShellServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = appShell->GetHiddenWindowAndJSContext( getter_AddRefs( hiddenWindow ),
|
||||
&jsContext );
|
||||
|
||||
if ( NS_SUCCEEDED( rv ) )
|
||||
{
|
||||
// Set up arguments for "window.open"
|
||||
void *stackPtr;
|
||||
char params[36];
|
||||
|
||||
if (modal) // if you change this, remember to change the buffer size above.
|
||||
strcpy(params, "menubar=no,height=%d,width=%d,modal");
|
||||
else
|
||||
strcpy(params, "menubar=no,height=%d,width=%d");
|
||||
|
||||
char buffer[256];
|
||||
PR_snprintf(buffer,
|
||||
sizeof(buffer),
|
||||
params,
|
||||
height,
|
||||
width );
|
||||
|
||||
jsval *argv = JS_PushArguments(jsContext, &stackPtr, "sss", urlStr, "_blank", buffer);
|
||||
if (argv)
|
||||
{
|
||||
// open the window
|
||||
nsIDOMWindow *newWindow;
|
||||
hiddenWindow->Open(jsContext, argv, 3, &newWindow);
|
||||
newWindow->ResizeTo(width, height);
|
||||
JS_PopArguments(jsContext, stackPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMUIHandlerImpl::PromptForFile(const PRUnichar *prompt, const char *fileRegEx, PRBool shouldFileExist, char **outFile)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(outFile);
|
||||
nsCOMPtr<nsIFilePicker> fp = do_CreateInstance("component://mozilla/filepicker");
|
||||
|
||||
if (!fp)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
|
||||
fp->Init(nsnull, prompt, nsIFilePicker::modeOpen);
|
||||
fp->AppendFilter(NS_ConvertASCIItoUCS2(fileRegEx).GetUnicode(), NS_ConvertASCIItoUCS2(fileRegEx).GetUnicode());
|
||||
fp->AppendFilters(nsIFilePicker::filterAll);
|
||||
PRInt16 mode;
|
||||
nsresult rv = fp->Show(&mode);
|
||||
|
||||
if (NS_FAILED(rv) || (mode == nsIFilePicker::returnCancel))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsILocalFile> file;
|
||||
rv = fp->GetFile(getter_AddRefs(file));
|
||||
|
||||
if (file)
|
||||
file->GetPath(outFile);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsPSMUIHandlerImpl::CreatePSMUIHandler(nsISupports* aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if ( aResult )
|
||||
{
|
||||
/* Allocate new find component object. */
|
||||
nsPSMUIHandlerImpl *component = new nsPSMUIHandlerImpl();
|
||||
if ( component )
|
||||
{
|
||||
/* Allocated OK, do query interface to get proper */
|
||||
/* pointer and increment refcount. */
|
||||
rv = component->QueryInterface( aIID, aResult );
|
||||
if ( NS_FAILED( rv ) )
|
||||
{
|
||||
/* refcount still at zero, delete it here. */
|
||||
delete component;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C" void CARTMAN_UIEventLoop(void *data)
|
||||
{
|
||||
CMT_EventLoop((PCMT_CONTROL)data);
|
||||
}
|
||||
|
||||
PRStatus InitPSMEventLoop(PCMT_CONTROL control)
|
||||
{
|
||||
PR_CreateThread(PR_USER_THREAD,
|
||||
CARTMAN_UIEventLoop,
|
||||
control,
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_UNJOINABLE_THREAD,
|
||||
0);
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
PRStatus InitPSMUICallbacks(PCMT_CONTROL control)
|
||||
{
|
||||
if (!control)
|
||||
return PR_FAILURE;
|
||||
|
||||
CMT_SetPromptCallback(control, (promptCallback_fn)PromptUserCallback, nsnull);
|
||||
CMT_SetAppFreeCallback(control, (applicationFreeCallback_fn) ApplicationFreeCallback);
|
||||
CMT_SetFilePathPromptCallback(control, (filePathPromptCallback_fn) FilePathPromptCallback, nsnull);
|
||||
|
||||
if (CMT_SetUIHandlerCallback(control, (uiHandlerCallback_fn) CartmanUIHandler, NULL) != CMTSuccess)
|
||||
return PR_FAILURE;
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
PRStatus DisplayPSMUIDialog(PCMT_CONTROL control, const char *pickledStatus, const char *hostName)
|
||||
{
|
||||
CMUint32 advRID = 0;
|
||||
CMInt32 width = 0;
|
||||
CMInt32 height = 0;
|
||||
CMTItem urlItem = {0, NULL, 0};
|
||||
CMTStatus rv = CMTSuccess;
|
||||
CMTItem advisorContext = {0, NULL, 0};
|
||||
void * pwin;
|
||||
|
||||
CMTSecurityAdvisorData data;
|
||||
memset(&data, '\0', sizeof(CMTSecurityAdvisorData));
|
||||
|
||||
if (hostName)
|
||||
{
|
||||
// if there is a hostName, than this request is about
|
||||
// a webpage.
|
||||
data.hostname = (char*) hostName;
|
||||
data.infoContext = SSM_BROWSER;
|
||||
|
||||
if (pickledStatus)
|
||||
{
|
||||
CMTItem pickledResource = {0, NULL, 0};
|
||||
CMUint32 socketStatus = 0;
|
||||
|
||||
pickledResource.len = *(int*)(pickledStatus);
|
||||
pickledResource.data = (unsigned char*) PR_Malloc(SSMSTRING_PADDED_LENGTH(pickledResource.len));
|
||||
|
||||
if (! pickledResource.data) return PR_FAILURE;
|
||||
|
||||
memcpy(pickledResource.data, pickledStatus+sizeof(int), pickledResource.len);
|
||||
|
||||
/* Unpickle the SSL Socket Status */
|
||||
if (CMT_UnpickleResource( control,
|
||||
SSM_RESTYPE_SSL_SOCKET_STATUS,
|
||||
pickledResource,
|
||||
&socketStatus) == CMTSuccess)
|
||||
{
|
||||
data.infoContext = SSM_BROWSER;
|
||||
data.resID = socketStatus;
|
||||
}
|
||||
|
||||
PR_FREEIF(pickledResource.data);
|
||||
}
|
||||
}
|
||||
|
||||
/* Create a Security Advisor context object. */
|
||||
rv = CMT_SecurityAdvisor(control, &data, &advRID);
|
||||
|
||||
if (rv != CMTSuccess)
|
||||
return PR_FAILURE;
|
||||
|
||||
/* Get the URL, width, height, etc. from the advisor context. */
|
||||
rv = CMT_GetStringAttribute(control,
|
||||
advRID,
|
||||
SSM_FID_SECADVISOR_URL,
|
||||
&urlItem);
|
||||
|
||||
if ((rv != CMTSuccess) || (!urlItem.data))
|
||||
return PR_FAILURE;
|
||||
|
||||
rv = CMT_GetNumericAttribute(control,
|
||||
advRID,
|
||||
SSM_FID_SECADVISOR_WIDTH,
|
||||
&width);
|
||||
if (rv != CMTSuccess)
|
||||
return PR_FAILURE;
|
||||
|
||||
rv = CMT_GetNumericAttribute(control,
|
||||
advRID,
|
||||
SSM_FID_SECADVISOR_HEIGHT,
|
||||
&height);
|
||||
if (rv != CMTSuccess)
|
||||
return PR_FAILURE;
|
||||
|
||||
/* Fire the URL up in a window of its own. */
|
||||
pwin = CartmanUIHandler(advRID, nsnull, width, height, CM_FALSE, (char*)urlItem.data, NULL);
|
||||
|
||||
//allocated by cmt, we can free with free:
|
||||
free(urlItem.data);
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void* CartmanUIHandler(uint32 resourceID, void* clientContext, uint32 width, uint32 height, CMBool isModal, char* urlStr, void *data)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_PROXIED_SERVICE(nsIPSMUIHandler, handler, nsPSMUIHandlerImpl::GetCID(), NS_UI_THREAD_EVENTQ, &rv);
|
||||
|
||||
if(NS_SUCCEEDED(rv))
|
||||
handler->DisplayURI(width, height, isModal, urlStr);
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
||||
|
||||
char * PromptUserCallback(void *arg, char *prompt, int isPasswd)
|
||||
{
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
PRUnichar *password;
|
||||
PRBool value;
|
||||
|
||||
NS_WITH_PROXIED_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, NS_UI_THREAD_EVENTQ, &rv);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = dialog->PromptPassword(nsnull, NS_ConvertASCIItoUCS2(prompt).GetUnicode(),
|
||||
NS_ConvertASCIItoUCS2(" ").GetUnicode(), // hostname
|
||||
PR_TRUE, &password, &value);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && value) {
|
||||
nsString a(password);
|
||||
char* str = a.ToNewCString();
|
||||
Recycle(password);
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
void ApplicationFreeCallback(char *userInput)
|
||||
{
|
||||
nsMemory::Free(userInput);
|
||||
}
|
||||
|
||||
char * FilePathPromptCallback(void *arg, char *prompt, char *fileRegEx, CMUint32 shouldFileExist)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
char* filePath = nsnull;
|
||||
|
||||
NS_WITH_PROXIED_SERVICE(nsIPSMUIHandler, handler, nsPSMUIHandlerImpl::GetCID(), NS_UI_THREAD_EVENTQ, &rv);
|
||||
|
||||
if(NS_SUCCEEDED(rv))
|
||||
handler->PromptForFile(NS_ConvertASCIItoUCS2(prompt).GetUnicode(), fileRegEx, (PRBool)shouldFileExist, &filePath);
|
||||
|
||||
return filePath;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NSPSMUICALLBACKS_H
|
||||
#define _NSPSMUICALLBACKS_H
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "cmtcmn.h"
|
||||
|
||||
#include "nsIPSMUIHandler.h"
|
||||
|
||||
PRStatus InitPSMUICallbacks(PCMT_CONTROL gControl);
|
||||
PRStatus InitPSMEventLoop(PCMT_CONTROL gControl);
|
||||
PRStatus DisplayPSMUIDialog(PCMT_CONTROL control, const char* pickledStatus, const char *hostName);
|
||||
|
||||
|
||||
#define NS_PSMUIHANDLER_CID {0x15944e30, 0x601e, 0x11d3, {0x8c, 0x4a, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
|
||||
|
||||
class nsPSMUIHandlerImpl : public nsIPSMUIHandler
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_CID_ACCESSOR( NS_PSMUIHANDLER_CID );
|
||||
|
||||
/* ctor/dtor */
|
||||
nsPSMUIHandlerImpl() { NS_INIT_REFCNT(); }
|
||||
virtual ~nsPSMUIHandlerImpl() { }
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPSMUIHANDLER
|
||||
|
||||
static NS_METHOD CreatePSMUIHandler(nsISupports* aOuter, REFNSIID aIID, void **aResult);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,320 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* thayes@netscape.com
|
||||
*/
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "plstr.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "plbase64.h"
|
||||
|
||||
#include "nsISecretDecoderRing.h"
|
||||
|
||||
#include "cmtcmn.h"
|
||||
#include "nsIPSMComponent.h"
|
||||
|
||||
#include "nsSDR.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsSecretDecoderRing, nsISecretDecoderRing)
|
||||
|
||||
nsSecretDecoderRing::nsSecretDecoderRing()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
mPSM = NULL;
|
||||
}
|
||||
|
||||
nsSecretDecoderRing::~nsSecretDecoderRing()
|
||||
{
|
||||
if (mPSM) mPSM->Release();
|
||||
}
|
||||
|
||||
/* Init the new instance */
|
||||
nsresult nsSecretDecoderRing::
|
||||
init()
|
||||
{
|
||||
nsresult rv;
|
||||
nsISupports *psm;
|
||||
|
||||
rv = nsServiceManager::GetService(kPSMComponentProgID, NS_GET_IID(nsIPSMComponent),
|
||||
&psm);
|
||||
if (rv != NS_OK) goto loser; /* Should promote error */
|
||||
|
||||
mPSM = (nsIPSMComponent *)psm;
|
||||
|
||||
loser:
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* [noscript] long encrypt (in buffer data, in long dataLen, out buffer result); */
|
||||
NS_IMETHODIMP nsSecretDecoderRing::
|
||||
Encrypt(unsigned char * data, PRInt32 dataLen, unsigned char * *result, PRInt32 *_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
unsigned char *r = 0;
|
||||
CMT_CONTROL *control;
|
||||
CMTStatus status;
|
||||
CMUint32 cLen;
|
||||
|
||||
if (data == nsnull || result == nsnull || _retval == nsnull) {
|
||||
rv = NS_ERROR_INVALID_POINTER;
|
||||
goto loser;
|
||||
}
|
||||
|
||||
/* Check object initialization */
|
||||
NS_ASSERTION(mPSM != nsnull, "SDR object not initialized");
|
||||
if (mPSM == nsnull) { rv = NS_ERROR_NOT_INITIALIZED; goto loser; }
|
||||
|
||||
/* Get the control connect to use for the request */
|
||||
rv = mPSM->GetControlConnection(&control);
|
||||
if (rv != NS_OK) { rv = NS_ERROR_NOT_AVAILABLE; goto loser; }
|
||||
|
||||
status = CMT_SDREncrypt(control, (void *)0, (const unsigned char *)0, 0,
|
||||
data, dataLen, result, &cLen);
|
||||
if (status != CMTSuccess) { rv = NS_ERROR_FAILURE; goto loser; } /* XXX */
|
||||
|
||||
/* Copy returned data to nsMemory buffer ? */
|
||||
*_retval = cLen;
|
||||
|
||||
loser:
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* [noscript] long decrypt (in buffer data, in long dataLen, out buffer result); */
|
||||
NS_IMETHODIMP nsSecretDecoderRing::
|
||||
Decrypt(unsigned char * data, PRInt32 dataLen, unsigned char * *result, PRInt32 *_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
CMTStatus status;
|
||||
CMT_CONTROL *control;
|
||||
CMUint32 len;
|
||||
|
||||
if (data == nsnull || result == nsnull || _retval == nsnull) {
|
||||
rv = NS_ERROR_INVALID_POINTER;
|
||||
goto loser;
|
||||
}
|
||||
|
||||
/* Check object initialization */
|
||||
NS_ASSERTION(mPSM != nsnull, "SDR object not initialized");
|
||||
if (mPSM == nsnull) { rv = NS_ERROR_NOT_INITIALIZED; goto loser; }
|
||||
|
||||
/* Get the control connection */
|
||||
rv = mPSM->GetControlConnection(&control);
|
||||
if (rv != NS_OK) { rv = NS_ERROR_NOT_AVAILABLE; goto loser; }
|
||||
|
||||
/* Call PSM to decrypt the value */
|
||||
status = CMT_SDRDecrypt(control, (void *)0, data, dataLen, result, &len);
|
||||
if (status != CMTSuccess) { rv = NS_ERROR_FAILURE; goto loser; } /* Promote? */
|
||||
|
||||
/* Copy returned data to nsMemory buffer ? */
|
||||
*_retval = len;
|
||||
|
||||
loser:
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* string encryptString (in string text); */
|
||||
NS_IMETHODIMP nsSecretDecoderRing::
|
||||
EncryptString(const char *text, char **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
unsigned char *encrypted = 0;
|
||||
PRInt32 eLen;
|
||||
|
||||
if (text == nsnull || _retval == nsnull) {
|
||||
rv = NS_ERROR_INVALID_POINTER;
|
||||
goto loser;
|
||||
}
|
||||
|
||||
rv = Encrypt((unsigned char *)text, PL_strlen(text), &encrypted, &eLen);
|
||||
if (rv != NS_OK) { goto loser; }
|
||||
|
||||
rv = encode(encrypted, eLen, _retval);
|
||||
|
||||
loser:
|
||||
if (encrypted) nsMemory::Free(encrypted);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* string decryptString (in string crypt); */
|
||||
NS_IMETHODIMP nsSecretDecoderRing::
|
||||
DecryptString(const char *crypt, char **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
char *r = 0;
|
||||
unsigned char *decoded = 0;
|
||||
PRInt32 decodedLen;
|
||||
unsigned char *decrypted = 0;
|
||||
PRInt32 decryptedLen;
|
||||
|
||||
if (crypt == nsnull || _retval == nsnull) {
|
||||
rv = NS_ERROR_INVALID_POINTER;
|
||||
goto loser;
|
||||
}
|
||||
|
||||
rv = decode(crypt, &decoded, &decodedLen);
|
||||
if (rv != NS_OK) goto loser;
|
||||
|
||||
rv = Decrypt(decoded, decodedLen, &decrypted, &decryptedLen);
|
||||
if (rv != NS_OK) goto loser;
|
||||
|
||||
// Convert to NUL-terminated string
|
||||
r = (char *)nsMemory::Alloc(decryptedLen+1);
|
||||
if (!r) { rv = NS_ERROR_OUT_OF_MEMORY; goto loser; }
|
||||
|
||||
memcpy(r, decrypted, decryptedLen);
|
||||
r[decryptedLen] = 0;
|
||||
|
||||
*_retval = r;
|
||||
r = 0;
|
||||
|
||||
loser:
|
||||
if (r) nsMemory::Free(r);
|
||||
if (decrypted) nsMemory::Free(decrypted);
|
||||
if (decoded) nsMemory::Free(decoded);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* void changePassword(); */
|
||||
NS_IMETHODIMP nsSecretDecoderRing::
|
||||
ChangePassword()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
CMTStatus status;
|
||||
CMT_CONTROL *control;
|
||||
|
||||
rv = mPSM->GetControlConnection(&control);
|
||||
if (rv != NS_OK) { rv = NS_ERROR_NOT_AVAILABLE; goto loser; }
|
||||
|
||||
status = CMT_SDRChangePassword(control, (void*)0);
|
||||
|
||||
loser:
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* void logout(); */
|
||||
NS_IMETHODIMP nsSecretDecoderRing::
|
||||
Logout()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
CMTStatus status;
|
||||
CMT_CONTROL *control;
|
||||
|
||||
/* Check object initialization */
|
||||
NS_ASSERTION(mPSM != nsnull, "SDR object not initialized");
|
||||
if (mPSM == nsnull) { rv = NS_ERROR_NOT_INITIALIZED; goto loser; }
|
||||
|
||||
/* Get the control connection */
|
||||
rv = mPSM->GetControlConnection(&control);
|
||||
if (rv != NS_OK) { rv = NS_ERROR_NOT_AVAILABLE; goto loser; }
|
||||
|
||||
/* Call PSM to decrypt the value */
|
||||
status = CMT_LogoutAllTokens(control);
|
||||
if (status != CMTSuccess) { rv = NS_ERROR_FAILURE; goto loser; } /* Promote? */
|
||||
|
||||
loser:
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
// Support routines
|
||||
|
||||
nsresult nsSecretDecoderRing::
|
||||
encode(const unsigned char *data, PRInt32 dataLen, char **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
*_retval = PL_Base64Encode((const char *)data, dataLen, NULL);
|
||||
if (!*_retval) { rv = NS_ERROR_OUT_OF_MEMORY; goto loser; }
|
||||
|
||||
loser:
|
||||
return rv;
|
||||
|
||||
#if 0
|
||||
nsresult rv = NS_OK;
|
||||
char *r = 0;
|
||||
|
||||
// Allocate space for encoded string (with NUL)
|
||||
r = (char *)nsMemory::Alloc(dataLen+1);
|
||||
if (!r) { rv = NS_ERROR_OUT_OF_MEMORY; goto loser; }
|
||||
|
||||
memcpy(r, data, dataLen);
|
||||
r[dataLen] = 0;
|
||||
|
||||
*_retval = r;
|
||||
r = 0;
|
||||
|
||||
loser:
|
||||
if (r) nsMemory::Free(r);
|
||||
|
||||
return rv;
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult nsSecretDecoderRing::
|
||||
decode(const char *data, unsigned char **result, PRInt32 * _retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUint32 len = PL_strlen(data);
|
||||
int adjust = 0;
|
||||
|
||||
/* Compute length adjustment */
|
||||
if (data[len-1] == '=') {
|
||||
adjust++;
|
||||
if (data[len-2] == '=') adjust++;
|
||||
}
|
||||
|
||||
*result = (unsigned char *)PL_Base64Decode(data, len, NULL);
|
||||
if (!*result) { rv = NS_ERROR_ILLEGAL_VALUE; goto loser; }
|
||||
|
||||
*_retval = (len*3)/4 - adjust;
|
||||
|
||||
loser:
|
||||
return rv;
|
||||
|
||||
#if 0
|
||||
nsresult rv = NS_OK;
|
||||
unsigned char *r = 0;
|
||||
PRInt32 rLen;
|
||||
|
||||
// Allocate space for decoded string (missing NUL)
|
||||
rLen = PL_strlen(data);
|
||||
r = (unsigned char *)nsMemory::Alloc(rLen);
|
||||
if (!r) { rv = NS_ERROR_OUT_OF_MEMORY; goto loser; }
|
||||
|
||||
memcpy(r, data, rLen);
|
||||
|
||||
*result = r;
|
||||
r = 0;
|
||||
*_retval = rLen;
|
||||
|
||||
loser:
|
||||
if (r) nsMemory::Free(r);
|
||||
|
||||
return rv;
|
||||
#endif
|
||||
}
|
||||
|
||||
const char * nsSecretDecoderRing::kPSMComponentProgID = PSM_COMPONENT_PROGID;
|
||||
@@ -1,58 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Terry Hayes <thayes@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NSSDR_H_
|
||||
#define _NSSDR_H_
|
||||
|
||||
#include "nsISecretDecoderRing.h"
|
||||
|
||||
// ===============================================
|
||||
// nsSecretDecoderRing - implementation of nsISecretDecoderRing
|
||||
// ===============================================
|
||||
|
||||
#define NS_SDR_CLASSNAME "Secret Decoder Ring"
|
||||
#define NS_SDR_CID \
|
||||
{ 0xd9a0341, 0xce7, 0x11d4, { 0x9f, 0xdd, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
|
||||
#define NS_SDR_PROGID "netscape.security.sdr"
|
||||
|
||||
class nsSecretDecoderRing : public nsISecretDecoderRing
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISECRETDECODERRING
|
||||
|
||||
nsSecretDecoderRing();
|
||||
virtual ~nsSecretDecoderRing();
|
||||
|
||||
nsresult init();
|
||||
|
||||
private:
|
||||
nsIPSMComponent *mPSM;
|
||||
|
||||
static const char *kPSMComponentProgID;
|
||||
|
||||
nsresult encode(const unsigned char *data, PRInt32 dataLen, char **_retval);
|
||||
nsresult decode(const char *data, unsigned char **result, PRInt32 * _retval);
|
||||
};
|
||||
|
||||
#endif /* _NSSDR_H_ */
|
||||
@@ -1,550 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nspr.h"
|
||||
#include "nsString.h"
|
||||
#include "cmtcmn.h"
|
||||
|
||||
#include "nsIPSMComponent.h"
|
||||
#include "nsIPSMSocketInfo.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsPSMShimLayer.h"
|
||||
#include "nsSSLIOLayer.h"
|
||||
|
||||
static PRDescIdentity nsSSLIOLayerIdentity;
|
||||
static PRIOMethods nsSSLIOLayerMethods;
|
||||
static nsIPSMComponent* gPSMService = nsnull;
|
||||
|
||||
|
||||
|
||||
class nsPSMSocketInfo : public nsIPSMSocketInfo
|
||||
{
|
||||
public:
|
||||
nsPSMSocketInfo();
|
||||
virtual ~nsPSMSocketInfo();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPSMSOCKETINFO
|
||||
|
||||
// internal functions to psm-glue.
|
||||
nsresult SetSocketPtr(CMSocket *socketPtr);
|
||||
nsresult SetControlPtr(CMT_CONTROL *aControlPtr);
|
||||
nsresult SetFileDescPtr(PRFileDesc *aControlPtr);
|
||||
nsresult SetHostName(char *aHostName);
|
||||
nsresult SetProxyName(char *aName);
|
||||
|
||||
nsresult SetHostPort(PRInt32 aPort);
|
||||
nsresult SetProxyPort(PRInt32 aPort);
|
||||
nsresult SetPickledStatus();
|
||||
|
||||
protected:
|
||||
CMT_CONTROL* mControl;
|
||||
CMSocket* mSocket;
|
||||
PRFileDesc* mFd;
|
||||
|
||||
nsString mHostName;
|
||||
PRInt32 mHostPort;
|
||||
|
||||
nsString mProxyName;
|
||||
PRInt32 mProxyPort;
|
||||
|
||||
unsigned char* mPickledStatus;
|
||||
};
|
||||
|
||||
|
||||
static PRStatus PR_CALLBACK
|
||||
nsSSLIOLayerConnect(PRFileDesc *fd, const PRNetAddr *addr, PRIntervalTime timeout)
|
||||
{
|
||||
nsresult result;
|
||||
PRStatus rv = PR_SUCCESS;
|
||||
CMTStatus status = CMTFailure;
|
||||
|
||||
/* Set the error in case of failure. */
|
||||
|
||||
PR_SetError(PR_UNKNOWN_ERROR, status);
|
||||
|
||||
if (!fd || !addr || !fd->secret || !gPSMService)
|
||||
return PR_FAILURE;
|
||||
|
||||
char ipBuffer[PR_NETDB_BUF_SIZE];
|
||||
rv = PR_NetAddrToString(addr, (char*)&ipBuffer, PR_NETDB_BUF_SIZE);
|
||||
if (rv != PR_SUCCESS)
|
||||
return PR_FAILURE;
|
||||
|
||||
if (addr->raw.family == PR_AF_INET6 && PR_IsNetAddrType(addr, PR_IpAddrV4Mapped))
|
||||
{
|
||||
/* Chop off the leading "::ffff:" */
|
||||
strcpy(ipBuffer, ipBuffer + 7);
|
||||
}
|
||||
|
||||
|
||||
CMT_CONTROL *control;
|
||||
result = gPSMService->GetControlConnection(&control);
|
||||
if (result != PR_SUCCESS)
|
||||
return PR_FAILURE;
|
||||
|
||||
CMSocket* cmsock = (CMSocket *)PR_Malloc(sizeof(CMSocket));
|
||||
if (!cmsock)
|
||||
return PR_FAILURE;
|
||||
|
||||
memset(cmsock, 0, sizeof(CMSocket));
|
||||
|
||||
cmsock->fd = fd->lower;
|
||||
cmsock->isUnix = PR_FALSE;
|
||||
|
||||
nsPSMSocketInfo *infoObject = (nsPSMSocketInfo *)fd->secret;
|
||||
|
||||
infoObject->SetControlPtr(control);
|
||||
infoObject->SetSocketPtr(cmsock);
|
||||
|
||||
char* proxyName;
|
||||
char* hostName;
|
||||
infoObject->GetProxyName(&proxyName);
|
||||
infoObject->GetHostName(&hostName);
|
||||
|
||||
if (!proxyName)
|
||||
{
|
||||
// Direct connection
|
||||
status = CMT_OpenSSLConnection(control,
|
||||
cmsock,
|
||||
SSM_REQUEST_SSL_DATA_SSL,
|
||||
PR_ntohs(addr->inet.port),
|
||||
ipBuffer,
|
||||
(hostName ? hostName : ipBuffer),
|
||||
CM_FALSE,
|
||||
nsnull);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// not supported yet.
|
||||
|
||||
return PR_FAILURE;
|
||||
#if 0
|
||||
PRInt32 destPort;
|
||||
|
||||
infoObject->GetProxyPort(&destPort);
|
||||
|
||||
status = CMT_OpenSSLProxyConnection(control,
|
||||
cmsock,
|
||||
destPort,
|
||||
proxyName, // wants IP
|
||||
hostName);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (hostName) Recycle(hostName);
|
||||
if (proxyName) Recycle(proxyName);
|
||||
|
||||
if (CMTSuccess == status)
|
||||
{
|
||||
// since our stuff can block, what we want to do is return PR_FAILURE,
|
||||
// but set the nspr ERROR to BLOCK. This will put us into a select
|
||||
// q.
|
||||
PR_SetError(PR_WOULD_BLOCK_ERROR, status);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
/* CMT_DestroyDataConnection(ctrl, sock); */
|
||||
/* need to strip our layer, pass result to DestroyDataConnection */
|
||||
/* which will clean up the CMT accounting of sock, then call our */
|
||||
/* shim layer to translate back to NSPR */
|
||||
|
||||
static PRStatus PR_CALLBACK
|
||||
nsSSLIOLayerClose(PRFileDesc *fd)
|
||||
{
|
||||
nsPSMSocketInfo *infoObject = (nsPSMSocketInfo *)fd->secret;
|
||||
PRDescIdentity id = PR_GetLayersIdentity(fd);
|
||||
|
||||
if (infoObject && id == nsSSLIOLayerIdentity)
|
||||
{
|
||||
CMInt32 errorCode = PR_FAILURE;
|
||||
CMT_CONTROL* control;
|
||||
CMSocket* socket;
|
||||
|
||||
PR_Shutdown(fd, PR_SHUTDOWN_BOTH);
|
||||
|
||||
infoObject->GetControlPtr(&control);
|
||||
infoObject->GetSocketPtr(&socket);
|
||||
infoObject->SetPickledStatus();
|
||||
|
||||
CMT_GetSSLDataErrorCode(control, socket, &errorCode);
|
||||
CMT_DestroyDataConnection(control, socket);
|
||||
NS_RELEASE(infoObject); // if someone is interested in us, the better have an addref.
|
||||
fd->identity = PR_INVALID_IO_LAYER;
|
||||
|
||||
return (PRStatus)errorCode;
|
||||
}
|
||||
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
static PRInt32 PR_CALLBACK
|
||||
nsSSLIOLayerRead( PRFileDesc *fd, void *buf, PRInt32 amount)
|
||||
{
|
||||
if (!fd)
|
||||
return PR_FAILURE;
|
||||
|
||||
PRInt32 result = PR_Recv(fd, buf, amount, 0, PR_INTERVAL_MIN);
|
||||
|
||||
if (result > 0)
|
||||
return result;
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
PRErrorCode code = PR_GetError();
|
||||
|
||||
if (code == PR_IO_TIMEOUT_ERROR )
|
||||
PR_SetError(PR_WOULD_BLOCK_ERROR, PR_WOULD_BLOCK_ERROR);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
nsPSMSocketInfo *infoObject = (nsPSMSocketInfo *)fd->secret;
|
||||
PRDescIdentity id = PR_GetLayersIdentity(fd);
|
||||
|
||||
if (infoObject && id == nsSSLIOLayerIdentity)
|
||||
{
|
||||
CMInt32 errorCode = PR_FAILURE;
|
||||
|
||||
CMT_CONTROL* control;
|
||||
CMSocket* socket;
|
||||
|
||||
infoObject->GetControlPtr(&control);
|
||||
infoObject->GetSocketPtr(&socket);
|
||||
|
||||
CMT_GetSSLDataErrorCode(control, socket, &errorCode);
|
||||
|
||||
if (errorCode == PR_IO_TIMEOUT_ERROR)
|
||||
{
|
||||
PR_SetError(PR_WOULD_BLOCK_ERROR, PR_WOULD_BLOCK_ERROR);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PR_SetError(0, 0);
|
||||
return errorCode;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static PRInt32 PR_CALLBACK
|
||||
nsSSLIOLayerWrite( PRFileDesc *fd, const void *buf, PRInt32 amount)
|
||||
{
|
||||
if (!fd)
|
||||
return PR_FAILURE;
|
||||
|
||||
PRInt32 result = PR_Send(fd, buf, amount, 0, PR_INTERVAL_MIN);
|
||||
|
||||
if (result > 0)
|
||||
return result;
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
PRErrorCode code = PR_GetError();
|
||||
|
||||
if (code == PR_IO_TIMEOUT_ERROR )
|
||||
PR_SetError(PR_WOULD_BLOCK_ERROR, PR_WOULD_BLOCK_ERROR);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
nsPSMSocketInfo *infoObject = (nsPSMSocketInfo *)fd->secret;
|
||||
PRDescIdentity id = PR_GetLayersIdentity(fd);
|
||||
|
||||
if (infoObject && id == nsSSLIOLayerIdentity)
|
||||
{
|
||||
CMInt32 errorCode = PR_FAILURE;
|
||||
CMT_CONTROL* control;
|
||||
CMSocket* socket;
|
||||
|
||||
infoObject->GetControlPtr(&control);
|
||||
infoObject->GetSocketPtr(&socket);
|
||||
|
||||
CMT_GetSSLDataErrorCode(control, socket, &errorCode);
|
||||
PR_SetError(0, 0);
|
||||
return errorCode;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nsPSMSocketInfo::nsPSMSocketInfo()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mControl = nsnull;
|
||||
mSocket = nsnull;
|
||||
mPickledStatus = nsnull;
|
||||
}
|
||||
|
||||
nsPSMSocketInfo::~nsPSMSocketInfo()
|
||||
{
|
||||
PR_FREEIF(mPickledStatus);
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsPSMSocketInfo, nsIPSMSocketInfo);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMSocketInfo::GetControlPtr(CMT_CONTROL * *aControlPtr)
|
||||
{
|
||||
*aControlPtr = mControl;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPSMSocketInfo::SetControlPtr(CMT_CONTROL *aControlPtr)
|
||||
{
|
||||
mControl = aControlPtr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMSocketInfo::GetSocketPtr(CMSocket * *socketPtr)
|
||||
{
|
||||
*socketPtr = mSocket;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPSMSocketInfo::SetSocketPtr(CMSocket *socketPtr)
|
||||
{
|
||||
mSocket = socketPtr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMSocketInfo::GetFileDescPtr(PRFileDesc * *aFilePtr)
|
||||
{
|
||||
*aFilePtr = mFd;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsPSMSocketInfo::SetFileDescPtr(PRFileDesc *aFilePtr)
|
||||
{
|
||||
mFd = aFilePtr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMSocketInfo::GetHostName(char * *aHostName)
|
||||
{
|
||||
if (mHostName.IsEmpty())
|
||||
*aHostName = nsnull;
|
||||
else
|
||||
*aHostName = mHostName.ToNewCString();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsPSMSocketInfo::SetHostName(char *aHostName)
|
||||
{
|
||||
mHostName.AssignWithConversion(aHostName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMSocketInfo::GetHostPort(PRInt32 *aPort)
|
||||
{
|
||||
*aPort = mHostPort;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPSMSocketInfo::SetHostPort(PRInt32 aPort)
|
||||
{
|
||||
mHostPort = aPort;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMSocketInfo::GetProxyName(char * *aName)
|
||||
{
|
||||
if (mProxyName.IsEmpty())
|
||||
*aName = nsnull;
|
||||
else
|
||||
*aName = mProxyName.ToNewCString();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsPSMSocketInfo::SetProxyName(char *aName)
|
||||
{
|
||||
mProxyName.AssignWithConversion(aName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMSocketInfo::GetProxyPort(PRInt32 *aPort)
|
||||
{
|
||||
*aPort = mProxyPort;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPSMSocketInfo::SetProxyPort(PRInt32 aPort)
|
||||
{
|
||||
mProxyPort = aPort;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nsresult
|
||||
nsPSMSocketInfo::SetPickledStatus()
|
||||
{
|
||||
PR_FREEIF(mPickledStatus);
|
||||
|
||||
long level;
|
||||
CMTItem pickledStatus = {0, nsnull, 0};
|
||||
unsigned char* ret = nsnull;
|
||||
|
||||
if (CMT_GetSSLSocketStatus(mControl, mSocket, &pickledStatus, &level) != PR_FAILURE)
|
||||
{
|
||||
ret = (unsigned char*) PR_Malloc( (SSMSTRING_PADDED_LENGTH(pickledStatus.len) + sizeof(int)) );
|
||||
if (ret)
|
||||
{
|
||||
*(int*)ret = pickledStatus.len;
|
||||
memcpy(ret+sizeof(int), pickledStatus.data, *(int*)ret);
|
||||
}
|
||||
|
||||
PR_FREEIF(pickledStatus.data);
|
||||
mPickledStatus = ret;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPSMSocketInfo::GetPickledStatus(char * *pickledStatusString)
|
||||
{
|
||||
if (!mPickledStatus)
|
||||
SetPickledStatus();
|
||||
|
||||
if (mPickledStatus)
|
||||
{
|
||||
PRInt32 len = *(int*)mPickledStatus;
|
||||
char *out = (char *)nsMemory::Alloc(len);
|
||||
memcpy(out, mPickledStatus, len);
|
||||
*pickledStatusString = out;
|
||||
return NS_OK;
|
||||
}
|
||||
*pickledStatusString = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSSLIOLayerNewSocket( const char *host,
|
||||
PRInt32 port,
|
||||
const char *proxyHost,
|
||||
PRInt32 proxyPort,
|
||||
PRFileDesc **fd,
|
||||
nsISupports** info)
|
||||
{
|
||||
static PRBool firstTime = PR_TRUE;
|
||||
if (firstTime)
|
||||
{
|
||||
nsSSLIOLayerIdentity = PR_GetUniqueIdentity("Cartman layer");
|
||||
nsSSLIOLayerMethods = *PR_GetDefaultIOMethods();
|
||||
|
||||
nsSSLIOLayerMethods.connect = nsSSLIOLayerConnect;
|
||||
nsSSLIOLayerMethods.close = nsSSLIOLayerClose;
|
||||
nsSSLIOLayerMethods.read = nsSSLIOLayerRead;
|
||||
nsSSLIOLayerMethods.write = nsSSLIOLayerWrite;
|
||||
|
||||
|
||||
nsresult result = nsServiceManager::GetService( PSM_COMPONENT_PROGID,
|
||||
NS_GET_IID(nsIPSMComponent),
|
||||
(nsISupports**)&gPSMService);
|
||||
if (NS_FAILED(result))
|
||||
return PR_FAILURE;
|
||||
|
||||
firstTime = PR_FALSE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
PRFileDesc * sock;
|
||||
PRFileDesc * layer;
|
||||
PRStatus rv;
|
||||
|
||||
/* Get a normal NSPR socket */
|
||||
sock = PR_NewTCPSocket();
|
||||
if (! sock) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
/* disable Nagle algorithm delay for control sockets */
|
||||
PRSocketOptionData sockopt;
|
||||
sockopt.option = PR_SockOpt_NoDelay;
|
||||
sockopt.value.no_delay = PR_TRUE;
|
||||
rv = PR_SetSocketOption(sock, &sockopt);
|
||||
PR_ASSERT(PR_SUCCESS == rv);
|
||||
|
||||
|
||||
layer = PR_CreateIOLayerStub(nsSSLIOLayerIdentity, &nsSSLIOLayerMethods);
|
||||
if (! layer)
|
||||
{
|
||||
PR_Close(sock);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsPSMSocketInfo *infoObject = new nsPSMSocketInfo();
|
||||
if (!infoObject)
|
||||
{
|
||||
PR_Close(sock);
|
||||
// clean up IOLayerStub.
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_ADDREF(infoObject);
|
||||
|
||||
infoObject->SetHostName((char*)host);
|
||||
infoObject->SetHostPort(port);
|
||||
infoObject->SetProxyName((char*)proxyHost);
|
||||
infoObject->SetProxyPort(proxyPort);
|
||||
|
||||
layer->secret = (PRFilePrivate*) infoObject;
|
||||
rv = PR_PushIOLayer(sock, PR_GetLayersIdentity(sock), layer);
|
||||
|
||||
if (rv == PR_SUCCESS)
|
||||
{
|
||||
*fd = sock;
|
||||
*info = infoObject;
|
||||
NS_ADDREF(*info);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PR_Close(sock);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _NSSSLIOLAYER_H
|
||||
#define _NSSSLIOLAYER_H
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "prio.h"
|
||||
#include "nsIPSMSocketInfo.h"
|
||||
|
||||
// define taken from 4.x cartman glue code.
|
||||
#define SSMSTRING_PADDED_LENGTH(x) ((((x)+3)/4)*4)
|
||||
|
||||
nsresult nsSSLIOLayerNewSocket(const char *host,
|
||||
PRInt32 port,
|
||||
const char *proxyHost,
|
||||
PRInt32 proxyPort,
|
||||
PRFileDesc **fd,
|
||||
nsISupports **securityInfo);
|
||||
#endif /* _NSSSLIOLAYER_H */
|
||||
@@ -1,94 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsSSLSocketProvider.h"
|
||||
#include "nsSSLIOLayer.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsSSLSocketProvider::nsSSLSocketProvider()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSSLSocketProvider::Init()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsSSLSocketProvider::~nsSSLSocketProvider()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(nsSSLSocketProvider, nsISocketProvider, nsISSLSocketProvider);
|
||||
|
||||
NS_METHOD
|
||||
nsSSLSocketProvider::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsSSLSocketProvider * inst;
|
||||
|
||||
if (NULL == aResult) {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
return rv;
|
||||
}
|
||||
*aResult = NULL;
|
||||
if (NULL != aOuter) {
|
||||
rv = NS_ERROR_NO_AGGREGATION;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_NEWXPCOM(inst, nsSSLSocketProvider);
|
||||
if (NULL == inst) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
return rv;
|
||||
}
|
||||
NS_ADDREF(inst);
|
||||
rv = inst->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(inst);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSSLSocketProvider::NewSocket(const char *host,
|
||||
PRInt32 port,
|
||||
const char *proxyHost,
|
||||
PRInt32 proxyPort,
|
||||
PRFileDesc **_result,
|
||||
nsISupports **securityInfo)
|
||||
{
|
||||
nsresult rv = nsSSLIOLayerNewSocket(host,
|
||||
port,
|
||||
proxyHost,
|
||||
proxyPort,
|
||||
_result,
|
||||
securityInfo);
|
||||
|
||||
return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK;
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _NSSSLSOCKETPROVIDER_H_
|
||||
#define _NSSSLSOCKETPROVIDER_H_
|
||||
|
||||
#include "nsISSLSocketProvider.h"
|
||||
|
||||
|
||||
/* 274418d0-5437-11d3-bbc8-0000861d1237 */
|
||||
#define NS_SSLSOCKETPROVIDER_CID { 0x274418d0, 0x5437, 0x11d3, {0xbb, 0xc8, 0x00, 0x00, 0x86, 0x1d, 0x12, 0x37}}
|
||||
|
||||
|
||||
class nsSSLSocketProvider : public nsISSLSocketProvider
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSISOCKETPROVIDER
|
||||
|
||||
NS_DECL_NSISSLSOCKETPROVIDER
|
||||
|
||||
// nsSSLSocketProvider methods:
|
||||
nsSSLSocketProvider();
|
||||
virtual ~nsSSLSocketProvider();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif /* _NSSSLSOCKETPROVIDER_H_ */
|
||||
@@ -1,654 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nspr.h"
|
||||
#include "prlog.h"
|
||||
|
||||
#include "nsISecureBrowserUI.h"
|
||||
#include "nsSecureBrowserUIImpl.h"
|
||||
#include "nsIPSMComponent.h"
|
||||
#include "nsPSMComponent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIDocumentLoader.h"
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIPSMSocketInfo.h"
|
||||
|
||||
#include "nsIURI.h"
|
||||
|
||||
#include "prmem.h"
|
||||
|
||||
#include "nsINetSupportDialogService.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsICommonDialogs.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
#include "nsIFormSubmitObserver.h"
|
||||
|
||||
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID );
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
#define ENTER_SITE_PREF "security.warn_entering_secure"
|
||||
#define LEAVE_SITE_PREF "security.warn_leaving_secure"
|
||||
#define MIXEDCONTENT_PREF "security.warn_viewing_mixed"
|
||||
#define INSECURE_SUBMIT_PREF "security.warn_submit_insecure"
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
//
|
||||
// Log module for nsSecureBroswerUI logging...
|
||||
//
|
||||
// To enable logging (see prlog.h for full details):
|
||||
//
|
||||
// set NSPR_LOG_MODULES=nsSecureBroswerUI:5
|
||||
// set NSPR_LOG_FILE=nspr.log
|
||||
//
|
||||
// this enables PR_LOG_DEBUG level information and places all output in
|
||||
// the file nspr.log
|
||||
//
|
||||
PRLogModuleInfo* gSecureDocLog = nsnull;
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSecureBrowserUIImpl::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsSecureBrowserUIImpl * inst;
|
||||
|
||||
if (NULL == aResult) {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
return rv;
|
||||
}
|
||||
*aResult = NULL;
|
||||
if (NULL != aOuter) {
|
||||
rv = NS_ERROR_NO_AGGREGATION;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_NEWXPCOM(inst, nsSecureBrowserUIImpl);
|
||||
if (NULL == inst) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
return rv;
|
||||
}
|
||||
NS_ADDREF(inst);
|
||||
rv = inst->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(inst);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsSecureBrowserUIImpl::nsSecureBrowserUIImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
if (nsnull == gSecureDocLog) {
|
||||
gSecureDocLog = PR_NewLogModule("nsSecureBroswerUI");
|
||||
}
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
|
||||
mIsSecureDocument = mMixContentAlertShown = mIsDocumentBroken = PR_FALSE;
|
||||
mLastPSMStatus = nsnull;
|
||||
mCurrentURI = nsnull;
|
||||
mSecurityButton = nsnull;
|
||||
}
|
||||
|
||||
nsSecureBrowserUIImpl::~nsSecureBrowserUIImpl()
|
||||
{
|
||||
PR_FREEIF(mLastPSMStatus);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS4(nsSecureBrowserUIImpl,
|
||||
nsSecureBrowserUI,
|
||||
nsIWebProgressListener,
|
||||
nsIFormSubmitObserver,
|
||||
nsIObserver);
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSecureBrowserUIImpl::Init(nsIDOMWindow *window, nsIDOMElement *button)
|
||||
{
|
||||
mSecurityButton = button;
|
||||
mWindow = window;
|
||||
|
||||
nsresult rv = nsServiceManager::GetService( kPrefCID,
|
||||
NS_GET_IID(nsIPref),
|
||||
getter_AddRefs(mPref));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIStringBundleService, service, kCStringBundleServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsILocale* locale = nsnull;
|
||||
rv = service->CreateBundle(SECURITY_STRING_BUNDLE_URL, locale, getter_AddRefs(mStringBundle));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// hook up to the form post notifications:
|
||||
nsIObserverService *svc = 0;
|
||||
rv = nsServiceManager::GetService(NS_OBSERVERSERVICE_PROGID,
|
||||
NS_GET_IID(nsIObserverService),
|
||||
(nsISupports**)&svc );
|
||||
if (NS_SUCCEEDED(rv) && svc) {
|
||||
nsString topic; topic.AssignWithConversion(NS_FORMSUBMIT_SUBJECT);
|
||||
rv = svc->AddObserver( this, topic.GetUnicode());
|
||||
nsServiceManager::ReleaseService( NS_OBSERVERSERVICE_PROGID, svc );
|
||||
}
|
||||
|
||||
// hook up to the webprogress notifications.
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(window);
|
||||
if (!sgo) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
sgo->GetDocShell(getter_AddRefs(docShell));
|
||||
if (!docShell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIWebProgress> wp = do_GetInterface(docShell);
|
||||
if (!wp) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
wp->AddProgressListener(NS_STATIC_CAST(nsIWebProgressListener*,this));
|
||||
|
||||
mInitByLocationChange = PR_TRUE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSecureBrowserUIImpl::DisplayPageInfoUI()
|
||||
{
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIPSMComponent, psm, PSM_COMPONENT_PROGID, &res);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
nsXPIDLCString host;
|
||||
if (mCurrentURI)
|
||||
mCurrentURI->GetHost(getter_Copies(host));
|
||||
|
||||
return psm->DisplaySecurityAdvisor(mLastPSMStatus, host);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSecureBrowserUIImpl::Observe(nsISupports*, const PRUnichar*, const PRUnichar*)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
static nsresult IsChildOfDomWindow(nsIDOMWindow *parent, nsIDOMWindow *child, PRBool* value)
|
||||
{
|
||||
*value = PR_FALSE;
|
||||
|
||||
if (parent == child)
|
||||
{
|
||||
*value = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> childsParent;
|
||||
child->GetParent(getter_AddRefs(childsParent));
|
||||
|
||||
if (childsParent && childsParent.get() != child)
|
||||
IsChildOfDomWindow(parent, childsParent, value);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSecureBrowserUIImpl::Notify(nsIContent* formNode, nsIDOMWindow* window, nsIURI* actionURL)
|
||||
{
|
||||
// Return NS_OK unless we want to prevent this form from submitting.
|
||||
|
||||
if (!window || !actionURL || !formNode) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
formNode->GetDocument(*getter_AddRefs(document));
|
||||
if (!document) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
||||
document->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
||||
nsCOMPtr<nsIDOMWindow> postingWindow = do_QueryInterface(globalObject);
|
||||
|
||||
PRBool isChild;
|
||||
IsChildOfDomWindow(mWindow, postingWindow, &isChild);
|
||||
|
||||
if (!isChild)
|
||||
return NS_OK;
|
||||
|
||||
PRBool okayToPost;
|
||||
nsresult res = CheckPost(actionURL, &okayToPost);
|
||||
|
||||
if (NS_SUCCEEDED(res) && okayToPost)
|
||||
return NS_OK;
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// nsIWebProgressListener
|
||||
NS_IMETHODIMP
|
||||
nsSecureBrowserUIImpl::OnProgressChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
PRInt32 aCurSelfProgress,
|
||||
PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress,
|
||||
PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
PRInt32 aProgressStateFlags,
|
||||
nsresult aStatus)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (aRequest == nsnull || !mSecurityButton || !mPref)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Get the channel from the request...
|
||||
// If the request is not network based, then ignore it.
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
channel = do_QueryInterface(aRequest, &res);
|
||||
if (NS_FAILED(res))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIURI> loadingURI;
|
||||
channel->GetURI(getter_AddRefs(loadingURI));
|
||||
|
||||
#if defined(DEBUG)
|
||||
nsXPIDLCString temp;
|
||||
loadingURI->GetSpec(getter_Copies(temp));
|
||||
PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI:%p: OnStateChange: %x :%s\n", this, aProgressStateFlags,(const char*)temp));
|
||||
#endif
|
||||
|
||||
// A Document is starting to load...
|
||||
if ((aProgressStateFlags & flag_start) &&
|
||||
(aProgressStateFlags & flag_is_network))
|
||||
{
|
||||
// starting to load a webpage
|
||||
PR_FREEIF(mLastPSMStatus); mLastPSMStatus = nsnull;
|
||||
|
||||
mIsSecureDocument = mMixContentAlertShown = mIsDocumentBroken = PR_FALSE;
|
||||
|
||||
res = CheckProtocolContextSwitch( loadingURI, mCurrentURI);
|
||||
return res;
|
||||
}
|
||||
|
||||
// A document has finished loading
|
||||
if ((aProgressStateFlags & flag_stop) &&
|
||||
(aProgressStateFlags & flag_is_network) &&
|
||||
mIsSecureDocument)
|
||||
{
|
||||
if (!mIsDocumentBroken) // and status is okay FIX
|
||||
{
|
||||
// qi for the psm information about this channel load.
|
||||
nsCOMPtr<nsISupports> info;
|
||||
channel->GetSecurityInfo(getter_AddRefs(info));
|
||||
nsCOMPtr<nsIPSMSocketInfo> psmInfo = do_QueryInterface(info);
|
||||
if (psmInfo)
|
||||
{
|
||||
// Everything looks okay. Lets stash the picked status.
|
||||
PR_FREEIF(mLastPSMStatus);
|
||||
res = psmInfo->GetPickledStatus(&mLastPSMStatus);
|
||||
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI:%p: Icon set to lock\n", this));
|
||||
res = mSecurityButton->SetAttribute( NS_ConvertASCIItoUCS2("level"), NS_ConvertASCIItoUCS2("high") );
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI:%p: Icon set to broken\n", this));
|
||||
mIsDocumentBroken = PR_TRUE;
|
||||
res = mSecurityButton->SetAttribute( NS_ConvertASCIItoUCS2("level"), NS_ConvertASCIItoUCS2("broken"));
|
||||
return res;
|
||||
}
|
||||
|
||||
/// if (aProgressStateFlags == nsIWebProgress::flag_net_redirecting)
|
||||
/// {
|
||||
/// // need to implmentent.
|
||||
/// }
|
||||
|
||||
// don't need to do anything more if the page is broken or not secure...
|
||||
|
||||
if (!mIsSecureDocument || mIsDocumentBroken)
|
||||
return NS_OK;
|
||||
|
||||
// A URL is starting to load...
|
||||
if ((aProgressStateFlags & flag_start) &&
|
||||
(aProgressStateFlags & flag_is_request))
|
||||
{ // check to see if we are going to mix content.
|
||||
return CheckMixedContext(loadingURI);
|
||||
}
|
||||
|
||||
// A URL has finished loading...
|
||||
if ((aProgressStateFlags & flag_stop) &&
|
||||
(aProgressStateFlags & flag_is_request))
|
||||
{
|
||||
if (1) // FIX status from the flag...
|
||||
{
|
||||
nsCOMPtr<nsISupports> info;
|
||||
channel->GetSecurityInfo(getter_AddRefs(info));
|
||||
nsCOMPtr<nsIPSMSocketInfo> psmInfo = do_QueryInterface(info, &res);
|
||||
|
||||
// qi for the psm information about this channel load.
|
||||
if (psmInfo) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI:%p: OnStateChange - Icon set to broken\n", this));
|
||||
mSecurityButton->SetAttribute( NS_ConvertASCIItoUCS2("level"), NS_ConvertASCIItoUCS2("broken") );
|
||||
mIsDocumentBroken = PR_TRUE;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSecureBrowserUIImpl::OnLocationChange(nsIURI* aLocation)
|
||||
{
|
||||
mCurrentURI = aLocation;
|
||||
|
||||
if (mInitByLocationChange)
|
||||
{
|
||||
IsURLHTTPS(mCurrentURI, &mIsSecureDocument);
|
||||
mInitByLocationChange = PR_FALSE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsSecureBrowserUIImpl::IsURLHTTPS(nsIURI* aURL, PRBool* value)
|
||||
{
|
||||
*value = PR_FALSE;
|
||||
|
||||
if (!aURL)
|
||||
return NS_OK;
|
||||
|
||||
char* scheme;
|
||||
aURL->GetScheme(&scheme);
|
||||
|
||||
if (scheme == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if ( PL_strncasecmp(scheme, "https", 5) == 0 )
|
||||
*value = PR_TRUE;
|
||||
|
||||
nsMemory::Free(scheme);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void nsSecureBrowserUIImpl::GetBundleString(const nsString& name, nsString &outString)
|
||||
{
|
||||
if (mStringBundle && name.Length() > 0) {
|
||||
PRUnichar *ptrv = nsnull;
|
||||
if (NS_SUCCEEDED(mStringBundle->GetStringFromName(name.GetUnicode(), &ptrv)))
|
||||
outString = ptrv;
|
||||
else
|
||||
outString.SetLength(0);;
|
||||
|
||||
nsMemory::Free(ptrv);
|
||||
|
||||
} else {
|
||||
outString.SetLength(0);;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSecureBrowserUIImpl::CheckProtocolContextSwitch( nsIURI* newURI, nsIURI* oldURI)
|
||||
{
|
||||
nsresult res;
|
||||
PRBool isNewSchemeSecure, isOldSchemeSecure, boolpref;
|
||||
|
||||
res = IsURLHTTPS(oldURI, &isOldSchemeSecure);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
res = IsURLHTTPS(newURI, &isNewSchemeSecure);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
// Check to see if we are going from a secure page to and insecure page
|
||||
if ( !isNewSchemeSecure && isOldSchemeSecure)
|
||||
{
|
||||
mSecurityButton->RemoveAttribute( NS_ConvertASCIItoUCS2("level") );
|
||||
|
||||
if ((mPref->GetBoolPref(LEAVE_SITE_PREF, &boolpref) != 0))
|
||||
boolpref = PR_TRUE;
|
||||
|
||||
if (boolpref)
|
||||
{
|
||||
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &res);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
nsAutoString windowTitle, message, dontShowAgain;
|
||||
|
||||
GetBundleString(NS_ConvertASCIItoUCS2("Title"), windowTitle);
|
||||
GetBundleString(NS_ConvertASCIItoUCS2("LeaveSiteMessage"), message);
|
||||
GetBundleString(NS_ConvertASCIItoUCS2("DontShowAgain"), dontShowAgain);
|
||||
|
||||
PRBool outCheckValue = PR_TRUE;
|
||||
dialog->AlertCheck(mWindow,
|
||||
windowTitle.GetUnicode(),
|
||||
message.GetUnicode(),
|
||||
dontShowAgain.GetUnicode(),
|
||||
&outCheckValue);
|
||||
|
||||
if (!outCheckValue) {
|
||||
mPref->SetBoolPref(LEAVE_SITE_PREF, PR_FALSE);
|
||||
NS_WITH_SERVICE(nsIPSMComponent, psm, PSM_COMPONENT_PROGID, &res);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
psm->PassPrefs();
|
||||
}
|
||||
}
|
||||
}
|
||||
// check to see if we are going from an insecure page to a secure one.
|
||||
else if (isNewSchemeSecure && !isOldSchemeSecure)
|
||||
{
|
||||
if ((mPref->GetBoolPref(ENTER_SITE_PREF, &boolpref) != 0))
|
||||
boolpref = PR_TRUE;
|
||||
|
||||
if (boolpref)
|
||||
{
|
||||
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &res);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
nsAutoString windowTitle, message, dontShowAgain;
|
||||
|
||||
GetBundleString(NS_ConvertASCIItoUCS2("Title"), windowTitle);
|
||||
GetBundleString(NS_ConvertASCIItoUCS2("EnterSiteMessage"), message);
|
||||
GetBundleString(NS_ConvertASCIItoUCS2("DontShowAgain"), dontShowAgain);
|
||||
|
||||
PRBool outCheckValue = PR_TRUE;
|
||||
dialog->AlertCheck(mWindow,
|
||||
windowTitle.GetUnicode(),
|
||||
message.GetUnicode(),
|
||||
dontShowAgain.GetUnicode(),
|
||||
&outCheckValue);
|
||||
|
||||
if (!outCheckValue)
|
||||
{
|
||||
mPref->SetBoolPref(ENTER_SITE_PREF, PR_FALSE);
|
||||
NS_WITH_SERVICE(nsIPSMComponent, psm, PSM_COMPONENT_PROGID, &res);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
psm->PassPrefs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mIsSecureDocument = isNewSchemeSecure;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsSecureBrowserUIImpl::CheckMixedContext(nsIURI* nextURI)
|
||||
{
|
||||
PRBool secure;
|
||||
|
||||
nsresult rv = IsURLHTTPS(nextURI, &secure);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!secure && mIsSecureDocument)
|
||||
{
|
||||
mIsDocumentBroken = PR_TRUE;
|
||||
mSecurityButton->SetAttribute( NS_ConvertASCIItoUCS2("level"), NS_ConvertASCIItoUCS2("broken") );
|
||||
|
||||
if (!mPref) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PRBool boolpref;
|
||||
if ((mPref->GetBoolPref(MIXEDCONTENT_PREF, &boolpref) != 0))
|
||||
boolpref = PR_TRUE;
|
||||
|
||||
if (boolpref && !mMixContentAlertShown)
|
||||
{
|
||||
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsAutoString windowTitle, message, dontShowAgain;
|
||||
|
||||
GetBundleString(NS_ConvertASCIItoUCS2("Title"), windowTitle);
|
||||
GetBundleString(NS_ConvertASCIItoUCS2("MixedContentMessage"), message);
|
||||
GetBundleString(NS_ConvertASCIItoUCS2("DontShowAgain"), dontShowAgain);
|
||||
|
||||
PRBool outCheckValue = PR_TRUE;
|
||||
|
||||
dialog->AlertCheck(mWindow,
|
||||
windowTitle.GetUnicode(),
|
||||
message.GetUnicode(),
|
||||
dontShowAgain.GetUnicode(),
|
||||
&outCheckValue);
|
||||
|
||||
if (!outCheckValue) {
|
||||
mPref->SetBoolPref(MIXEDCONTENT_PREF, PR_FALSE);
|
||||
NS_WITH_SERVICE(nsIPSMComponent, psm, PSM_COMPONENT_PROGID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
psm->PassPrefs();
|
||||
}
|
||||
|
||||
mMixContentAlertShown = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSecureBrowserUIImpl::CheckPost(nsIURI *actionURL, PRBool *okayToPost)
|
||||
{
|
||||
PRBool secure;
|
||||
|
||||
nsresult rv = IsURLHTTPS(actionURL, &secure);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// if we are posting to a secure link from a secure page, all is okay.
|
||||
if (secure && mIsSecureDocument)
|
||||
return NS_OK;
|
||||
|
||||
|
||||
PRBool boolpref;
|
||||
|
||||
// posting to a non https URL.
|
||||
if ((mPref->GetBoolPref(INSECURE_SUBMIT_PREF, &boolpref) != 0))
|
||||
boolpref = PR_TRUE;
|
||||
|
||||
if (boolpref) {
|
||||
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsAutoString windowTitle, message, dontShowAgain;
|
||||
|
||||
GetBundleString(NS_ConvertASCIItoUCS2("Title"), windowTitle);
|
||||
GetBundleString(NS_ConvertASCIItoUCS2("DontShowAgain"), dontShowAgain);
|
||||
|
||||
// posting to insecure webpage from a secure webpage.
|
||||
if (!secure && mIsSecureDocument && !mIsDocumentBroken) {
|
||||
GetBundleString(NS_ConvertASCIItoUCS2("PostToInsecure"), message);
|
||||
} else { // anything else, post generic warning
|
||||
GetBundleString(NS_ConvertASCIItoUCS2("PostToInsecureFromInsecure"), message);
|
||||
}
|
||||
|
||||
PRBool outCheckValue = PR_TRUE;
|
||||
dialog->ConfirmCheck(mWindow,
|
||||
windowTitle.GetUnicode(),
|
||||
message.GetUnicode(),
|
||||
dontShowAgain.GetUnicode(),
|
||||
&outCheckValue,
|
||||
okayToPost);
|
||||
|
||||
if (!outCheckValue) {
|
||||
mPref->SetBoolPref(INSECURE_SUBMIT_PREF, PR_FALSE);
|
||||
NS_WITH_SERVICE(nsIPSMComponent, psm, PSM_COMPONENT_PROGID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
psm->PassPrefs();
|
||||
}
|
||||
} else {
|
||||
*okayToPost = PR_TRUE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Hubbie Shaw
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsSecureBrowserUIImpl_h_
|
||||
#define nsSecureBrowserUIImpl_h_
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIDocumentLoaderObserver.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsISecureBrowserUI.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIFormSubmitObserver.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
#define NS_SECURE_BROWSER_DOCOBSERVER_CLASSNAME "Mozilla Secure Browser Doc Observer"
|
||||
|
||||
#define NS_SECURE_BROWSER_DOCOBSERVER_CID \
|
||||
{0x97c06c30, 0xa145, 0x11d3, \
|
||||
{0x8c, 0x7c, 0x00, 0x60, 0x97, 0x92, 0x27, 0x8c}}
|
||||
|
||||
#define NS_SECURE_BROWSER_DOCOBSERVER_PROGID "component://netscape/secure_browser_docobserver"
|
||||
|
||||
|
||||
class nsSecureBrowserUIImpl : public nsSecureBrowserUI,
|
||||
public nsIWebProgressListener,
|
||||
public nsIFormSubmitObserver,
|
||||
public nsIObserver
|
||||
{
|
||||
public:
|
||||
|
||||
nsSecureBrowserUIImpl();
|
||||
virtual ~nsSecureBrowserUIImpl();
|
||||
|
||||
static NS_METHOD Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_NSSECUREBROWSERUI
|
||||
|
||||
|
||||
// nsIObserver
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_IMETHOD Notify(nsIContent* formNode, nsIDOMWindow* window, nsIURI *actionURL);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> mWindow;
|
||||
nsCOMPtr<nsIDOMElement> mSecurityButton;
|
||||
nsCOMPtr<nsIDocumentLoaderObserver> mOldWebShellObserver;
|
||||
nsCOMPtr<nsIPref> mPref;
|
||||
nsCOMPtr<nsIStringBundle> mStringBundle;
|
||||
|
||||
nsCOMPtr<nsIURI> mCurrentURI;
|
||||
|
||||
PRBool mIsSecureDocument; // is https loaded
|
||||
PRBool mIsDocumentBroken; //
|
||||
PRBool mMixContentAlertShown;
|
||||
|
||||
PRBool mInitByLocationChange;
|
||||
|
||||
char* mLastPSMStatus;
|
||||
|
||||
|
||||
void GetBundleString(const nsString& name, nsString &outString);
|
||||
nsresult LoadStringBundle();
|
||||
|
||||
nsresult CheckProtocolContextSwitch( nsIURI* newURI, nsIURI* oldURI);
|
||||
nsresult CheckMixedContext(nsIURI* nextURI);
|
||||
nsresult CheckPost(nsIURI *actionURL, PRBool *okayToPost);
|
||||
nsresult IsURLHTTPS(nsIURI* aURL, PRBool *value);
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsSecureBrowserUIImpl_h_ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
22
mozilla/include/Makefile
Normal file
22
mozilla/include/Makefile
Normal file
@@ -0,0 +1,22 @@
|
||||
#! gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
#
|
||||
|
||||
DEPTH = ..
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
664
mozilla/include/abcom.h
Normal file
664
mozilla/include/abcom.h
Normal file
@@ -0,0 +1,664 @@
|
||||
/* -*- Mode: C; tab-width: 8; 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 _AB_COM_H_
|
||||
#define _AB_COM_H_
|
||||
|
||||
#include "xp_core.h"
|
||||
#include "msgcom.h"
|
||||
#include "abdefn.h"
|
||||
#include "dirprefs.h"
|
||||
|
||||
#ifdef XP_CPLUSPLUS
|
||||
class AB_Pane;
|
||||
class AB_ContainerPane;
|
||||
class AB_ContainerInfo;
|
||||
class AB_MailingListPane;
|
||||
class AB_PersonPane;
|
||||
#else
|
||||
typedef struct AB_Pane AB_Pane;
|
||||
typedef struct AB_ContainerPane AB_ContainerPane;
|
||||
typedef struct AB_ContainerInfo AB_ContainerInfo;
|
||||
typedef struct AB_MailingListPane AB_MailingListPane;
|
||||
typedef struct AB_PersonPane AB_PersonPane;
|
||||
#endif
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
#define AB_API extern "C"
|
||||
|
||||
#if defined(XP_MAC)
|
||||
#define FE_IMPLEMENTS_SHOW_PROPERTY_SHEET
|
||||
#endif
|
||||
|
||||
const ABID AB_ABIDUNKNOWN = 0; /* Find a better home for this somewhere! */
|
||||
|
||||
/* new errors added by mscott for the 2 pane AB UI. I will eventually name this enumerated type AB_Error */
|
||||
enum
|
||||
{
|
||||
AB_SUCCESS = 0,
|
||||
AB_FAILURE,
|
||||
AB_INVALID_PANE,
|
||||
AB_INVALID_CONTAINER,
|
||||
AB_INVALID_ATTRIBUTE,
|
||||
AB_OUT_OF_MEMORY
|
||||
};
|
||||
|
||||
/* these are the types of possible containers */
|
||||
typedef enum
|
||||
{
|
||||
AB_LDAPContainer,
|
||||
AB_MListContainer, /* a mailing list */
|
||||
AB_PABContainer /* a personal AB */
|
||||
} AB_ContainerType;
|
||||
|
||||
/* AB_ContainerAttributes define the types of information FEs can ask the BE about
|
||||
a AB_ContainerInfo in the ABContainerPane. */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
attribContainerType, /* mailing list? LDAP directory? PAB? */
|
||||
attribName, /* the name for the container */
|
||||
attribNumChildren, /* how many child containers does this container have? */
|
||||
attribDepth, /* container depth in the overall hierarchy. 0 == root ctr, 1 == one level below a root container, etc. */
|
||||
attribContainerInfo /* FEs might want to get the container Info * for a line in the container pane */
|
||||
} AB_ContainerAttribute;
|
||||
|
||||
typedef struct AB_ContainerAttribValue
|
||||
{
|
||||
AB_ContainerAttribute attrib; /* used to determine value of the union */
|
||||
union{
|
||||
char * string;
|
||||
int32 number; /* used by numchildren & depth */
|
||||
AB_ContainerType containerType;
|
||||
AB_ContainerInfo * container;
|
||||
} u;
|
||||
} AB_ContainerAttribValue;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AB_Drag_Not_Allowed = 0x00000000,
|
||||
AB_Require_Copy = 0x00000001,
|
||||
AB_Require_Move = 0x00000002,
|
||||
AB_Default_Drag = 0xFFFFFFFF
|
||||
} AB_DragEffect;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AB_attribUnknown = 0, /* unrecognized attribute */
|
||||
AB_attribEntryType, /* mailing list or person entry */
|
||||
AB_attribEntryID,
|
||||
AB_attribFullName,
|
||||
AB_attribNickName,
|
||||
AB_attribGivenName, /* all of the following are person entry specific */
|
||||
AB_attribMiddleName,
|
||||
AB_attribFamilyName,
|
||||
AB_attribCompanyName,
|
||||
AB_attribLocality,
|
||||
AB_attribRegion,
|
||||
AB_attribEmailAddress,
|
||||
AB_attribInfo,
|
||||
AB_attribHTMLMail,
|
||||
AB_attribExpandedName,
|
||||
AB_attribTitle,
|
||||
AB_attribPOAddress,
|
||||
AB_attribStreetAddress,
|
||||
AB_attribZipCode,
|
||||
AB_attribCountry,
|
||||
AB_attribWorkPhone,
|
||||
AB_attribFaxPhone,
|
||||
AB_attribHomePhone,
|
||||
AB_attribDistName,
|
||||
AB_attribSecurity,
|
||||
AB_attribCoolAddress,
|
||||
AB_attribUseServer,
|
||||
AB_attribPager,
|
||||
AB_attribCellularPhone,
|
||||
AB_attribDisplayName,
|
||||
AB_attribWinCSID, /* character set id */
|
||||
AB_attribOther /* any attrib with this value or higher is always a string type (our dyanmic attributes) */
|
||||
} AB_AttribID;
|
||||
|
||||
/* WARNING!!! WILL BE PHASING THIS STRUCTURE OUT!!!! */
|
||||
typedef struct AB_EntryAttributeItem{
|
||||
AB_AttribID id;
|
||||
char * description; /* resource string specifying a user-readable descript for the attrib i.e. "First Name" */
|
||||
XP_Bool sortable; /* is this attribute sortable? (may help FEs display the column if they know if it can be sorted or not */
|
||||
}AB_EntryAttributeItem;
|
||||
|
||||
typedef enum{
|
||||
AB_MailingList = 0,
|
||||
AB_Person
|
||||
} AB_EntryType;
|
||||
|
||||
typedef struct AB_AttributeValue
|
||||
{
|
||||
AB_AttribID attrib; /* we need this to know how to read the union */
|
||||
union{
|
||||
char * string;
|
||||
XP_Bool boolValue;
|
||||
AB_EntryType entryType; /* mailing list or person entry */
|
||||
int16 shortValue; /* use for server type or WinCSID field */
|
||||
} u;
|
||||
} AB_AttributeValue;
|
||||
|
||||
|
||||
/* New Column ID structure used to abstract the columns in the AB_Pane used by the FEs from the attributes thos columns actually
|
||||
represent. */
|
||||
typedef enum{
|
||||
AB_ColumnID0 = 0,
|
||||
AB_ColumnID1,
|
||||
AB_ColumnID2,
|
||||
AB_ColumnID3,
|
||||
AB_ColumnID4,
|
||||
AB_ColumnID5,
|
||||
AB_ColumnID6,
|
||||
AB_NumberOfColumns /* make sure this is always the last one!! */
|
||||
} AB_ColumnID;
|
||||
|
||||
typedef struct AB_ColumnInfo{
|
||||
AB_AttribID attribID; /* the attrib ID this column is displaying */
|
||||
char * displayString; /* column display string */
|
||||
XP_Bool sortable; /* is this column attribute sortable? i.e. phone number is not! */
|
||||
} AB_ColumnInfo;
|
||||
|
||||
|
||||
/**********************************************************************************************
|
||||
FE Call back functions. We'll show the types here...NOTE: FEs must now register their call back
|
||||
functions through these APIs so the back end knows which return to use.
|
||||
*********************************************************************************************/
|
||||
|
||||
/* FEs must register this function with the appropriate pane, it is called by the back end in
|
||||
response to the following commands: AB_PropertiesCmd, AB_AddUserCmd, AB_AddMailingListCmd */
|
||||
|
||||
/* typedef int AB_ShowPropertySheetForEntryFunc (MSG_Pane * pane, AB_EntryType entryType); */
|
||||
typedef int AB_ShowPropertySheetForEntryFunc (MSG_Pane * pane, MWContext * context);
|
||||
|
||||
int AB_SetShowPropertySheetForEntryFunc(
|
||||
MSG_Pane * abPane,
|
||||
AB_ShowPropertySheetForEntryFunc * func);
|
||||
|
||||
|
||||
/* BE sets the type for the DIR_Server and hands it to the FEs to be displayed & filled out in a
|
||||
pane. It is called by the back end in response to the following commands: AB_PropertiesCmd,
|
||||
AB_NewLDAPDirectory, AB_NewAddressBook. */
|
||||
|
||||
typedef int AB_ShowPropertySheetForDirFunc(DIR_Server * server, MWContext * context, XP_Bool newDirectory /* is it a new directory? */);
|
||||
|
||||
int AB_SetShowPropertySheetForDirFunc(
|
||||
MSG_Pane * abcPane, /* container pane */
|
||||
AB_ShowPropertySheetForDirFunc * func);
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
DON'T USE THIS FUNCTION!!!! THIS WILL BE PHASING OUT!!!!!! #mscott 01/21/98
|
||||
This is a callback into the FE instructing them to bring up a person entry pane or a
|
||||
mailing list pane. The back end has already created the pane. A type is included to let the FE
|
||||
determine if the pane is a mailing list or person entry pane. In addition, in the case of a mailing list
|
||||
pane, the FE must still initialize the mailing list pane before it can be used
|
||||
***************************************************************************************/
|
||||
#ifdef FE_IMPLEMENTS_SHOW_PROPERTY_SHEET
|
||||
extern int FE_ShowPropertySheetForAB2(
|
||||
MSG_Pane * pane, /* BE created mailing list or person entry pane */
|
||||
AB_EntryType entryType); /* mailing list or person entry */
|
||||
#endif
|
||||
|
||||
/***************************************************************************************
|
||||
None pane-specific APIs. These function work on many panes
|
||||
***************************************************************************************/
|
||||
|
||||
int AB_ClosePane(MSG_Pane * pane);
|
||||
|
||||
/****************************************************************************************
|
||||
Address Book Pane General APIs - creating, initializing, closing, changing containers,
|
||||
searching, etc.
|
||||
*****************************************************************************************/
|
||||
|
||||
int AB_CreateABPane(
|
||||
MSG_Pane ** abPane,
|
||||
MWContext * context,
|
||||
MSG_Master * master);
|
||||
|
||||
int AB_InitializeABPane(
|
||||
MSG_Pane * abPane,
|
||||
AB_ContainerInfo * abContainer);
|
||||
|
||||
|
||||
/* to change the container the abPane is currently displaying */
|
||||
int AB_ChangeABContainer(
|
||||
MSG_Pane * abPane,
|
||||
AB_ContainerInfo * container); /* the new containerInfo to display */
|
||||
|
||||
int AB_GetEntryIndex(
|
||||
MSG_Pane * abPane,
|
||||
ABID id, /* entry id in the database */
|
||||
MSG_ViewIndex * index); /* FE allocated, BE fills with index */
|
||||
|
||||
int AB_GetABIDForIndex(
|
||||
MSG_Pane * abPane,
|
||||
MSG_ViewIndex index,
|
||||
ABID * id); /* FE allocated. BE fills with the id you want */
|
||||
|
||||
int AB_SearchDirectoryAB2(
|
||||
MSG_Pane * abPane,
|
||||
char * searchString);
|
||||
|
||||
int AB_LDAPSearchResultsAB2(
|
||||
MSG_Pane * abPane,
|
||||
MSG_ViewIndex index,
|
||||
int32 num);
|
||||
|
||||
int AB_FinishSearchAB2(MSG_Pane * abPane);
|
||||
|
||||
int AB_CommandAB2(
|
||||
MSG_Pane * srcPane, /* NOTE: this can be a ABpane or an ABContainerPane!!! you can delete containers & entries */
|
||||
AB_CommandType command, /* delete or mailto are the only currently supported commands */
|
||||
MSG_ViewIndex * indices,
|
||||
int32 numIndices);
|
||||
|
||||
int AB_CommandStatusAB2(
|
||||
MSG_Pane * srcPane, /* NOTE: Can be an ABPane or an ABContainerPane!! */
|
||||
AB_CommandType command,
|
||||
MSG_ViewIndex * indices,
|
||||
int32 numIndices,
|
||||
XP_Bool * selectable_p,
|
||||
MSG_COMMAND_CHECK_STATE * selected_p,
|
||||
const char ** displayString,
|
||||
XP_Bool * plural_p);
|
||||
|
||||
/* still need to add registering and unregistering compose windows */
|
||||
|
||||
/****************************************************************************************
|
||||
AB_ContainerInfo General APIs - adding users and a sender. Doesn't require a pane.
|
||||
*****************************************************************************************/
|
||||
int AB_AddUserAB2(
|
||||
AB_ContainerInfo * abContainer, /* the container to add the person to */
|
||||
AB_AttributeValue * values, /* FE defined array of attribute values for the new user. FE must free this array */
|
||||
uint16 numItems,
|
||||
ABID * entryID); /* BE returns the ABID for this new user */
|
||||
|
||||
int AB_AddUserWithUIAB2(
|
||||
AB_ContainerInfo * abContainer,
|
||||
AB_AttributeValue * values,
|
||||
uint16 numItems,
|
||||
XP_Bool lastOneToAdd);
|
||||
|
||||
int AB_AddSenderAB2(
|
||||
AB_ContainerInfo * abContainer,
|
||||
char * author,
|
||||
char * url);
|
||||
|
||||
|
||||
/****************************************************************************************
|
||||
Drag and Drop Related APIs - vcards, ab lines, containers, etc.
|
||||
*****************************************************************************************/
|
||||
|
||||
int AB_DragEntriesIntoContainer(
|
||||
MSG_Pane * srcPane, /* could be an ABPane or ABCPane */
|
||||
const MSG_ViewIndex * srcIndices, /* indices of items to be dragged */
|
||||
int32 numIndices,
|
||||
AB_ContainerInfo * destContainer,
|
||||
AB_DragEffect request); /* copy or move? */
|
||||
|
||||
/* FE's should call this function to determine if the drag & drop they want to perform is
|
||||
valid or not. I would recommend calling it before the FE actually performs the drag & drop call */
|
||||
AB_DragEffect AB_DragEntriesIntoContainerStatus(
|
||||
MSG_Pane * abPane,
|
||||
const MSG_ViewIndex * indices,
|
||||
int32 numIndices,
|
||||
AB_ContainerInfo * destContainer,
|
||||
AB_DragEffect request); /* do you want to do a move? a copy? default drag? */
|
||||
|
||||
/****************************************************************************************
|
||||
Importing and Exporting - ABs from files, vcards...
|
||||
*****************************************************************************************/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AB_Filename, /* char * in import and export APIs contain an FE allocated/freed filename */
|
||||
AB_PromptForFileName, /* prompt for file name on import or export */
|
||||
AB_Vcard,
|
||||
AB_CommaList, /* comma separated list of email addresses */
|
||||
AB_RawData /* we don't know what it is, will try to extract email addresses */
|
||||
} AB_ImportExportType;
|
||||
|
||||
int AB_ImportData(
|
||||
AB_ContainerInfo * destContainer,
|
||||
const char * buffer, /* could be a filename or NULL (if type = prompt for filename) or a block of data to be imported */
|
||||
int32 bufSize, /* how big is the buffer? */
|
||||
AB_ImportExportType dataType); /* valid types: All */
|
||||
|
||||
/* returns TRUE if the container accepts imports of the data type and FALSE otherwise */
|
||||
XP_Bool AB_ImportDataStatus(
|
||||
AB_ContainerInfo * destContainer,
|
||||
AB_ImportExportType dataType);
|
||||
|
||||
/* exporting always occurs to a file unless the data type is vcard. Only valid export data types are: vcard,
|
||||
filename, prompt for filename */
|
||||
|
||||
int AB_ExportData(
|
||||
AB_ContainerInfo * srcContainer,
|
||||
char ** buffer, /* filename or NULL. Or if type = Vcard, the BE allocated vcard. FE responosible for freeing it?? */
|
||||
int32 * bufSize, /* ignored unless VCard is data type in which case FE allocates, BE fills */
|
||||
AB_ImportExportType dataType); /* valid types: filename, prompt for filename, vcard */
|
||||
|
||||
/****************************************************************************************
|
||||
ABContainer Pane --> Creation, Loading, getting line data for each container.
|
||||
*****************************************************************************************/
|
||||
int AB_CreateContainerPane(
|
||||
MSG_Pane ** abContainerPane, /* BE will pass back ptr to pane through this */
|
||||
MWContext * context,
|
||||
MSG_Master * master);
|
||||
|
||||
int AB_InitializeContainerPane(MSG_Pane * abContainerPane);
|
||||
|
||||
/* this will return MSG_VIEWINDEXNONE if the container info is not in the pane */
|
||||
MSG_ViewIndex AB_GetIndexForContainer(
|
||||
MSG_Pane * abContainerPane,
|
||||
AB_ContainerInfo * container); /* container you want the index for */
|
||||
|
||||
/* this will return NULL if the index is invalid */
|
||||
AB_ContainerInfo * AB_GetContainerForIndex(
|
||||
MSG_Pane * abContainerPane,
|
||||
const MSG_ViewIndex index);
|
||||
|
||||
/* the following set of APIs support getting/setting container pane line data out such as the container's
|
||||
name, type, etc. We are going to try a particular discipline for memory management of AB_ContainerAttribValues.
|
||||
For APIs which get an attribute value, the BE will actually allocate the struct. To free the space, the FE should
|
||||
call AB_FreeContainerAttribValue. For any API which sets an attribute value, the FE is responsible for allocating and
|
||||
de-allocating the data. */
|
||||
|
||||
int AB_GetContainerAttributeForPane(
|
||||
MSG_Pane * abContainerPane,
|
||||
MSG_ViewIndex index, /* index of container you want information for */
|
||||
AB_ContainerAttribute attrib, /* attribute FE wants to know */
|
||||
AB_ContainerAttribValue ** value); /* BE allocates struct. FE should call AB_FreeContainerAttribValue to free space when done */
|
||||
|
||||
int AB_SetContainerAttributeForPane(
|
||||
MSG_Pane * abContainerPane,
|
||||
MSG_ViewIndex index,
|
||||
AB_ContainerAttribValue * value); /* FE handles all memory allocation! */
|
||||
|
||||
int AB_GetContainerAttribute(
|
||||
AB_ContainerInfo * ctr,
|
||||
AB_ContainerAttribute attrib,
|
||||
AB_ContainerAttribValue ** value); /* BE allocates struct. FE should call AB_FreeContainerAttribValue to free space when donee */
|
||||
|
||||
int AB_SetContainerAttribute(
|
||||
AB_ContainerInfo * ctr,
|
||||
AB_ContainerAttribValue * value); /* FE handles all memory allocateion / deallocation! */
|
||||
|
||||
int AB_GetContainerAttributes(
|
||||
AB_ContainerInfo * ctr,
|
||||
AB_ContainerAttribute * attribsArray,
|
||||
AB_ContainerAttribValue ** valuesArray,
|
||||
uint16 * numItems);
|
||||
|
||||
int AB_SetContainerAttributes(
|
||||
AB_ContainerInfo * ctr,
|
||||
AB_ContainerAttribValue * valuesArray,
|
||||
uint16 numItems);
|
||||
|
||||
/* getting and setting multiple container attributes on a per container pane basis */
|
||||
int AB_GetContainerAttributesForPane(
|
||||
MSG_Pane * abContainerPane,
|
||||
MSG_ViewIndex index,
|
||||
AB_ContainerAttribute * attribsArray,
|
||||
AB_ContainerAttribValue ** valuesArray,
|
||||
uint16 * numItems);
|
||||
|
||||
int AB_SetContainerAttributesForPane(
|
||||
MSG_Pane * abContainerPane,
|
||||
MSG_ViewIndex index,
|
||||
AB_ContainerAttribValue * valuesArray,
|
||||
uint16 numItems);
|
||||
|
||||
int AB_FreeContainerAttribValue(AB_ContainerAttribValue * value); /* BE will free the attribute value */
|
||||
|
||||
int AB_FreeContainerAttribValues(AB_ContainerAttribValue * valuesArray, uint16 numItems);
|
||||
|
||||
XP_Bool AB_IsStringContainerAttribValue(AB_ContainerAttribValue * value); /* use this to determine if your attrib is a string attrib */
|
||||
|
||||
|
||||
/* Use the following two functions to build the combo box in the Address Window of all the root level containers.
|
||||
You first ask for the number of root level (PABs and LDAP directories). Use this number to allocate an array of
|
||||
AB_ContainerInfo ptrs. Give this array to the back end and we will fill it. FE can destroy array when done with it.
|
||||
FE shoud NOT be deleting the individual AB_ContainerInfo ptrs. */
|
||||
|
||||
int AB_GetNumRootContainers(
|
||||
MSG_Pane * abContainerPane,
|
||||
int32 * numRootContainers);
|
||||
|
||||
int AB_GetOrderedRootContainers(
|
||||
MSG_Pane * abContainerPane,
|
||||
AB_ContainerInfo ** ctrArray, /* FE Allocated & Freed */
|
||||
int32 * numCtrs); /* in - # of elements in ctrArray. out - BE fills with # root containers stored in ctrArray */
|
||||
|
||||
/* sometimes you want to get a handle on the DIR_Sever for a particular container. Both return NULL if for some
|
||||
reason there wasn't a DIR_Server. If the container is a mailing list, returns DIR_Server of the PAB the list is in.
|
||||
NOTE: If you modify any of the DIR_Server properties, you should call AB_UpdateDIRServerForContainer to make sure that the container
|
||||
(and hence any pane views on the container) are updated */
|
||||
|
||||
DIR_Server * AB_GetDirServerForContainer(AB_ContainerInfo * container);
|
||||
|
||||
/* Please don't call this function. It is going away!!! Use AB_UpdateDirServerForContainerPane instead!! */
|
||||
int AB_UpdateDIRServerForContainer(AB_ContainerInfo * container);
|
||||
|
||||
/* will create a new container in the container pane if the directory does not already exist. Otherwise updates the
|
||||
directory's container in the pane */
|
||||
int AB_UpdateDIRServerForContainerPane(
|
||||
MSG_Pane * abContainerPane,
|
||||
DIR_Server * directory);
|
||||
|
||||
|
||||
/*******************************************************************************************************************
|
||||
Old Column Header APIs. These will be phased out!!! Please don't use them
|
||||
******************************************************************************************************************/
|
||||
|
||||
int AB_GetNumEntryAttributesForContainer(
|
||||
AB_ContainerInfo * container,
|
||||
uint16 * numItems); /* BE will fill this integer with the number of available attributes for the container */
|
||||
|
||||
int AB_GetEntryAttributesForContainer(
|
||||
AB_ContainerInfo * container,
|
||||
AB_EntryAttributeItem * items, /* FE allocated array which BE fills with values */
|
||||
uint16 * maxItems); /* FE passes in # elements allocated in array. BE returns # elements filled in array */
|
||||
|
||||
/********************************************************************************************************************
|
||||
Our New Column Header APIs. We'll be phasing out AB_GetNumEntryAttributesForContainer and AB_GetEntryAttributesForContainer
|
||||
********************************************************************************************************************/
|
||||
|
||||
AB_ColumnInfo * AB_GetColumnInfo(
|
||||
AB_ContainerInfo * container,
|
||||
AB_ColumnID columnID);
|
||||
|
||||
int AB_GetNumColumnsForContainer(AB_ContainerInfo * container);
|
||||
|
||||
int AB_GetColumnAttribIDs(
|
||||
AB_ContainerInfo * container,
|
||||
AB_AttribID * attribIDs, /* FE allocated array of attribs. BE fills with values */
|
||||
int * numAttribs); /* FE passes in # elements allocated in array. BE returns # elements filled */
|
||||
|
||||
int AB_FreeColumnInfo(AB_ColumnInfo * columnInfo);
|
||||
|
||||
/****************************************************************************************
|
||||
AB Pane List Data -> how to get ab pane line attributes such as name, address, phone, etc.
|
||||
*****************************************************************************************/
|
||||
|
||||
/* to actually get an entry attribute */
|
||||
|
||||
int AB_GetEntryAttributeForPane(
|
||||
MSG_Pane * abPane,
|
||||
MSG_ViewIndex index,
|
||||
AB_AttribID attrib, /* what attribute do you want? */
|
||||
AB_AttributeValue ** valueArray); /* BE handles memory allocation. FE must call AB_FreeEntryAttributeValue when done */
|
||||
|
||||
int AB_GetEntryAttribute(
|
||||
AB_ContainerInfo * container,
|
||||
ABID entryid, /* an identifier or key used to name the object in the container */
|
||||
AB_AttribID attrib, /* attribute type the FE wants to know */
|
||||
AB_AttributeValue ** valueArray); /* BE handles memory allocation. FE must call AB_FreeEntryAttributeValue when done */
|
||||
|
||||
int AB_SetEntryAttribute(
|
||||
AB_ContainerInfo * container,
|
||||
ABID entryid, /* an identifier or key used to name the object in the container */
|
||||
AB_AttributeValue * value); /* FE handles all memory allocation */
|
||||
|
||||
int AB_SetEntryAttributeForPane(
|
||||
MSG_Pane * abPane,
|
||||
MSG_ViewIndex index,
|
||||
AB_AttributeValue * value); /* FE handles all memory allocation */
|
||||
|
||||
/* we also allow you to set entry attributes in batch by passing in an array of attribute values */
|
||||
int AB_SetEntryAttributes(
|
||||
AB_ContainerInfo * container,
|
||||
ABID entryID,
|
||||
AB_AttributeValue * valuesArray, /* FE allocated array of attribute values to set */
|
||||
uint16 numItems); /* FE passes in # items in array */
|
||||
|
||||
int AB_SetEntryAttributesForPane(
|
||||
MSG_Pane * abPane,
|
||||
MSG_ViewIndex index,
|
||||
AB_AttributeValue * valuesArray,
|
||||
uint16 numItems);
|
||||
|
||||
int AB_GetEntryAttributes(
|
||||
AB_ContainerInfo * container,
|
||||
ABID entryID,
|
||||
AB_AttribID * attribs, /* FE allocated array of attribs that you want */
|
||||
AB_AttributeValue ** values, /* BE allocates & fills an array of values for the input array of attribs */
|
||||
uint16 * numItems); /* IN: size of attribs array. OUT: # of values in value array */
|
||||
|
||||
int AB_GetEntryAttributesForPane(
|
||||
MSG_Pane * abPane,
|
||||
MSG_ViewIndex index,
|
||||
AB_AttribID * attribs, /* FE allocated array of attribs that you want */
|
||||
AB_AttributeValue ** values,
|
||||
uint16 * numItems);
|
||||
|
||||
/* Memory allocation APIs for setting/getting entry attribute values */
|
||||
int AB_FreeEntryAttributeValue(AB_AttributeValue * value /* pointer to a value */);
|
||||
int AB_FreeEntryAttributeValues(AB_AttributeValue * values /* array of values */, uint16 numItems);
|
||||
|
||||
int AB_CopyEntryAttributeValue(
|
||||
AB_AttributeValue * srcValue, /* already allocated attribute value you want to copy from */
|
||||
AB_AttributeValue * destValue); /* already allocated attribute value you want to copy into */
|
||||
|
||||
XP_Bool AB_IsStringEntryAttributeValue(AB_AttributeValue * value);
|
||||
|
||||
/****************************************************************************************
|
||||
Sorting
|
||||
*****************************************************************************************/
|
||||
|
||||
/* sorting by first name is a global setting. It is set per abPane and does not change
|
||||
when you load a new container into the abPane */
|
||||
|
||||
XP_Bool AB_GetSortByFirstNameAB2(MSG_Pane * abPane); /* is the pane sorting by first name? */
|
||||
|
||||
void AB_SortByFirstNameAB2(
|
||||
MSG_Pane * abPane,
|
||||
XP_Bool sortByFirstName); /* true for sort by first, false for last first */
|
||||
|
||||
/* Insert our sort by column stuff here */
|
||||
int AB_SortByAttribute(
|
||||
MSG_Pane * abPane,
|
||||
AB_AttribID id, /* attribute we want to sort by */
|
||||
XP_Bool sortAscending);
|
||||
|
||||
int AB_GetPaneSortedByAB2(
|
||||
MSG_Pane * abPane,
|
||||
AB_AttribID * attribID); /* BE fills with the attribute we are sorting by */
|
||||
|
||||
|
||||
XP_Bool AB_GetPaneSortedAscendingAB2(MSG_Pane * abPane);
|
||||
|
||||
/*****************************************************************************************
|
||||
APIs for the Mailing List Pane. In addition to these, the mailing list pane responds to
|
||||
previous AB APIs such as AB_Close, MSG_GetNumLines().
|
||||
****************************************************************************************/
|
||||
int AB_InitializeMailingListPaneAB2(MSG_Pane * mailingListPane);
|
||||
|
||||
AB_ContainerInfo * AB_GetContainerForMailingList(MSG_Pane * mailingListPane);
|
||||
|
||||
/* this could return ABID = 0 for a new entry that is not in the database */
|
||||
ABID AB_GetABIDForMailingListIndex(
|
||||
MSG_Pane * mailingListPane,
|
||||
const MSG_ViewIndex index);
|
||||
|
||||
MSG_ViewIndex AB_GetMailingListIndexForABID(
|
||||
MSG_Pane * mailingListPane,
|
||||
ABID entryID); /* this function could return MSG_VIEWINDEXNONE if entryID = 0 or not in list */
|
||||
|
||||
/* Use these two APIs to get Mailing List ENTRY attributes (i.e. people or other mailing list attributes in this mailing list) */
|
||||
int AB_SetMailingListEntryAttributes(
|
||||
MSG_Pane * pane,
|
||||
const MSG_ViewIndex index,
|
||||
AB_AttributeValue * valuesArray, /* FE allocated array of attribute values you want to set */
|
||||
uint16 numItems);
|
||||
|
||||
int AB_GetMailingListEntryAttributes(
|
||||
MSG_Pane * mailingListPane,
|
||||
const MSG_ViewIndex index,
|
||||
AB_AttribID * attribs, /* FE allocated & freed array of attribs you want */
|
||||
AB_AttributeValue ** values, /* BE allocates & fills values for the input array of attribs */
|
||||
uint16 * numItems); /* FE provides # attribs in array. BE fills with # values returned in values */
|
||||
|
||||
/* Use these two APIs to Set and Get the Mailing List properties. */
|
||||
int AB_GetMailingListAttributes(
|
||||
MSG_Pane * mailingListPane,
|
||||
AB_AttribID * attribs, /* FE allocated array of attribs */
|
||||
AB_AttributeValue ** values, /* BE allocates & fills values. FE must call a free to the back end */
|
||||
uint16 * numItems);
|
||||
|
||||
int AB_SetMailingListAttributes(
|
||||
MSG_Pane * mailingListPane,
|
||||
AB_AttributeValue * valuesArray, /* FE allocated array of attribute values you want to set */
|
||||
uint16 numItems);
|
||||
|
||||
|
||||
/*******************************************************************************************
|
||||
APIs for the person entry pane aka the person property sheets. The person entry pane is created
|
||||
by the back end and given to the front end in the call FE_ShowPropertySheetFor. In the current
|
||||
incarnation, person atributes are set and retrieved through the person entry pane and NOT through
|
||||
the AB_ContainerInfo the person is in. If you "cheat" and go through the container directly, you may
|
||||
not be getting the correct information. When the person entry pane is committed, the changes are pushed
|
||||
back into the container. During the commit process, if it is a new person then a new entry is made in the
|
||||
database.
|
||||
********************************************************************************************/
|
||||
AB_ContainerInfo * AB_GetContainerForPerson(MSG_Pane * personPane);
|
||||
|
||||
ABID AB_GetABIDForPerson(MSG_Pane * personPane); /* could return 0 if new user */
|
||||
|
||||
/* get and set the person attributes here */
|
||||
int AB_SetPersonEntryAttributes(
|
||||
MSG_Pane * personPane,
|
||||
AB_AttributeValue * valuesArray,
|
||||
uint16 numItems);
|
||||
|
||||
int AB_GetPersonEntryAttributes(
|
||||
MSG_Pane * personPane,
|
||||
AB_AttribID * attribs, /* FE allocted & freed array of attribs they want */
|
||||
AB_AttributeValue ** values, /* BE allocates & fills values */
|
||||
uint16 * numItems); /* in - FE provides # of attribs. out - BE fills with # values */
|
||||
|
||||
int AB_CommitChanges(MSG_Pane * pane); /* commits changes to a mailing list pane or a person entry pane! */
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* _AB_COM_H */
|
||||
200
mozilla/include/abdefn.h
Normal file
200
mozilla/include/abdefn.h
Normal file
@@ -0,0 +1,200 @@
|
||||
/* -*- 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 _ABDefn_H_
|
||||
#define _ABDefn_H_
|
||||
|
||||
/* max lengths for address book fields */
|
||||
const int kMaxFullNameLength = 256; /* common name */
|
||||
const int kMaxNameLength = 64; /* given, middle, family */
|
||||
const int kMaxCompanyLength = 128; /* company name */
|
||||
const int kMaxLocalityLength = 128; /* city */
|
||||
const int kMaxRegionLength = 128; /* state */
|
||||
const int kMaxCountryLength = 128; /* state */
|
||||
const int kMaxEmailAddressLength = 256;
|
||||
const int kMaxInfo = 1024;
|
||||
const int kMaxTitle = 64;
|
||||
const int kMaxAddress = 128;
|
||||
const int kMaxZipCode = 40;
|
||||
const int kMaxPhone = 32;
|
||||
const int32 kMaxDN = 32768;
|
||||
const int kMaxCoolAddress = 256;
|
||||
const int kMaxAddressEntry = 1000;
|
||||
|
||||
const short kDefaultDLS = 0;
|
||||
const short kSpecificDLS = 1;
|
||||
const short kHostOrIPAddress = 2;
|
||||
|
||||
typedef uint32 ABID;
|
||||
|
||||
/* This structure represents a single line in the address book pane
|
||||
*/
|
||||
typedef struct AB_EntryLineTag
|
||||
{
|
||||
ABID entryType; /* type of entry either person or list */
|
||||
char fullname[256];
|
||||
char emailAddress[256];
|
||||
char companyName[128];
|
||||
char nickname[64];
|
||||
char locality[128];
|
||||
char workPhone[32];
|
||||
#ifdef XP_CPLUSPLUS
|
||||
public:
|
||||
void Initialize();
|
||||
#endif
|
||||
} AB_EntryLine;
|
||||
|
||||
typedef struct PersonEntryTag {
|
||||
char * pNickName;
|
||||
char * pGivenName;
|
||||
char * pMiddleName;
|
||||
char * pFamilyName;
|
||||
char * pCompanyName;
|
||||
char * pLocality;
|
||||
char * pRegion;
|
||||
char * pEmailAddress;
|
||||
char * pInfo;
|
||||
XP_Bool HTMLmail;
|
||||
char * pTitle;
|
||||
char * pPOAddress;
|
||||
char * pAddress;
|
||||
char * pZipCode;
|
||||
char * pCountry;
|
||||
char * pWorkPhone;
|
||||
char * pFaxPhone;
|
||||
char * pHomePhone;
|
||||
char * pDistName;
|
||||
short Security;
|
||||
char * pCoolAddress;
|
||||
short UseServer;
|
||||
int16 WinCSID;
|
||||
|
||||
|
||||
#ifdef XP_CPLUSPLUS
|
||||
public:
|
||||
void Initialize();
|
||||
void CleanUp();
|
||||
#endif
|
||||
} PersonEntry;
|
||||
|
||||
|
||||
typedef struct MailingListEntryTag {
|
||||
char * pFullName;
|
||||
char * pNickName;
|
||||
char * pInfo;
|
||||
char * pDistName;
|
||||
int16 WinCSID;
|
||||
|
||||
#ifdef XP_CPLUSPLUS
|
||||
|
||||
public:
|
||||
void Initialize();
|
||||
void CleanUp();
|
||||
#endif
|
||||
} MailingListEntry;
|
||||
|
||||
const ABID ABTypeAll = 35;
|
||||
const ABID ABTypePerson = 36;
|
||||
const ABID ABTypeList = 37;
|
||||
|
||||
const unsigned long ABTypeEntry = 0x70634944; /* ASCII - 'pcID' */
|
||||
const unsigned long ABFullName = 0x636E2020; /* ASCII - 'cn ' */
|
||||
const unsigned long ABNickname = 0x6E69636B; /* ASCII - 'nick' */
|
||||
const unsigned long ABEmailAddress = 0x6D61696C; /* ASCII - 'mail' */
|
||||
const unsigned long ABLocality = 0x6C6F6320; /* ASCII - 'loc ' */
|
||||
const unsigned long ABCompany = 0x6F726720; /* ASCII - 'org ' */
|
||||
|
||||
/* defines for vcard support */
|
||||
#define vCardClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCard"
|
||||
#define vCardMimeFormat "text/x-vcard"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
||||
/* FILE MENU
|
||||
=========
|
||||
*/
|
||||
AB_NewMessageCmd, /* Send a new message to the selected entries */
|
||||
|
||||
AB_ImportCmd, /* import a file into the address book */
|
||||
|
||||
AB_SaveCmd, /* export to a file */
|
||||
|
||||
AB_CloseCmd, /* close the address book window */
|
||||
|
||||
AB_NewAddressBook, /* Create a new personal address book */
|
||||
|
||||
AB_NewLDAPDirectory, /* Create a new LDAP directory */
|
||||
|
||||
|
||||
/* EDIT MENU
|
||||
=========
|
||||
*/
|
||||
|
||||
AB_UndoCmd, /* Undoes the last operation. */
|
||||
|
||||
AB_RedoCmd, /* Redoes the last undone operation. */
|
||||
|
||||
AB_DeleteCmd, /* Causes the given entries to be
|
||||
deleted. */
|
||||
|
||||
AB_DeleteAllCmd, /* Causes all occurrences of the given entries to be deleted. */
|
||||
|
||||
AB_LDAPSearchCmd, /* Perform an LDAP search */
|
||||
|
||||
|
||||
/* VIEW/SORT MENUS
|
||||
===============
|
||||
*/
|
||||
|
||||
AB_SortByTypeCmd, /* Sort alphabetized by type. */
|
||||
AB_SortByFullNameCmd, /* Sort alphabetizedby full name. */
|
||||
AB_SortByLocality, /* Sort by state */
|
||||
AB_SortByNickname, /* Sort by nickname */
|
||||
AB_SortByEmailAddress, /* Sort by email address */
|
||||
AB_SortByCompanyName, /* Sort by email address */
|
||||
AB_SortAscending, /* Sort current column ascending */
|
||||
AB_SortDescending, /* Sort current column descending */
|
||||
|
||||
/* these are the new sort command IDs added for the 2 pane AB. Use these instead of the previous ones...*/
|
||||
AB_SortByColumnID0,
|
||||
AB_SortByColumnID1,
|
||||
AB_SortByColumnID2,
|
||||
AB_SortByColumnID3,
|
||||
AB_SortByColumnID4,
|
||||
AB_SortByColumnID5,
|
||||
AB_SortByColumnID6,
|
||||
|
||||
/* ITEM MENU
|
||||
============
|
||||
*/
|
||||
|
||||
AB_AddUserCmd, /* Add a user to the address book */
|
||||
AB_AddMailingListCmd, /* Add a mailing list to the address book */
|
||||
AB_PropertiesCmd, /* Get the properties of an entry */
|
||||
AB_CallCmd, /* Call the entry using CallPoint */
|
||||
|
||||
AB_ImportLdapEntriesCmd, /* Add a user to the AB from an LDAP directory */
|
||||
|
||||
/* Mailing List Pane Specific Commands!!! */
|
||||
AB_InsertLineCmd, /* Insert a blank entry line into the mailing list pane */
|
||||
AB_ReplaceLineCmd /* Replace the entry in the mailing list pane with a blank entry */
|
||||
|
||||
} AB_CommandType;
|
||||
|
||||
#endif
|
||||
449
mozilla/include/addrbook.h
Normal file
449
mozilla/include/addrbook.h
Normal file
@@ -0,0 +1,449 @@
|
||||
/* -*- 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 _AddrBook_H_
|
||||
#define _AddrBook_H_
|
||||
|
||||
#include "xp_core.h"
|
||||
#include "msgcom.h"
|
||||
#include "abdefn.h"
|
||||
#include "dirprefs.h"
|
||||
|
||||
#ifdef XP_CPLUSPLUS
|
||||
class MLPane;
|
||||
class ABPane;
|
||||
class AddressPane;
|
||||
class ABook;
|
||||
#else
|
||||
typedef struct MLPane MLPane;
|
||||
typedef struct ABPane ABPane;
|
||||
typedef struct AddressPane AddressPane;
|
||||
typedef struct ABook ABook;
|
||||
#endif
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
#define AB_kGromitDbFileName "da5id.nab"
|
||||
#define AB_CONFIG_USE_GROMIT_FILE_FORMAT 1
|
||||
|
||||
/****************************************************************************/
|
||||
/* Get the address book .*/
|
||||
/****************************************************************************/
|
||||
ABook* FE_GetAddressBook(MSG_Pane* pane);
|
||||
|
||||
/****************************************************************************/
|
||||
/* This is a callback into the FE to bring up a modal property sheet */
|
||||
/* for modifying an existing entry or creating a new one from a */
|
||||
/* person structure. If entryId != MSG_MESSAGEIDNONE then it is the */
|
||||
/* entryID of the entry to modify. Each FE should Return TRUE if the user */
|
||||
/* hit ok return FALSE if they hit cancel and return -1 if there was a */
|
||||
/* problem creating the window or something */
|
||||
/****************************************************************************/
|
||||
int FE_ShowPropertySheetFor (MWContext* context, ABID entryID,
|
||||
PersonEntry* pPerson);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Return whether or not to attach the users */
|
||||
/* vcard to outgoing messages */
|
||||
/****************************************************************************/
|
||||
XP_Bool AB_AttachUsersvCard(void);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Convert the address book error code to .*/
|
||||
/****************************************************************************/
|
||||
int AB_ConvertABErrToMKErr(uint32 err);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Create and initialize the address book pane which is the a view on an */
|
||||
/* address book. It will provide a sorted list of all the address book */
|
||||
/* entries ids . This is intended to be used in a two step */
|
||||
/* process of create and then initialize */
|
||||
/****************************************************************************/
|
||||
int AB_InitAddressBookPane(ABPane** ppABookPane,
|
||||
DIR_Server* dir,
|
||||
ABook* pABook,
|
||||
MWContext* context,
|
||||
MSG_Master* master,
|
||||
unsigned long sortBy,
|
||||
XP_Bool sortForward);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Create the address book pane which is the a view on an */
|
||||
/* address book. */
|
||||
/****************************************************************************/
|
||||
int AB_CreateAddressBookPane(ABPane** ppABookPane,
|
||||
MWContext* context,
|
||||
MSG_Master* master);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Initialize the address book pane which is the a view on an */
|
||||
/* address book. It will provide a sorted list of all the address book */
|
||||
/* entries ids .*/
|
||||
/****************************************************************************/
|
||||
int AB_InitializeAddressBookPane(ABPane* ppABookPane,
|
||||
DIR_Server* dir,
|
||||
ABook* pABook,
|
||||
unsigned long sortBy,
|
||||
XP_Bool sortForward);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Close the address book pane. Called when the view on an address book */
|
||||
/* is being closed */
|
||||
/****************************************************************************/
|
||||
int AB_CloseAddressBookPane(ABPane** ppABookPane);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* Create and initialize a mailing list pane which is the a view on an */
|
||||
/* mailing list. It will provide a sorted view of all the entries in a */
|
||||
/* mailing list. This is intended to be used in as a one one step process */
|
||||
/****************************************************************************/
|
||||
int AB_InitMailingListPane(MLPane** ppABookPane,
|
||||
ABID* listID,
|
||||
DIR_Server* dir,
|
||||
ABook* pABook,
|
||||
MWContext* context,
|
||||
MSG_Master* master,
|
||||
unsigned long sortBy,
|
||||
XP_Bool sortForward);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Create a mailing list pane which is the a view on an */
|
||||
/* mailing list. This is intended to be used in a two step */
|
||||
/* process of create and then initialize */
|
||||
/****************************************************************************/
|
||||
int AB_CreateMailingListPane(MLPane** ppABookPane,
|
||||
MWContext* context,
|
||||
MSG_Master* master);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Initialize a mailing list pane which is the a view on an */
|
||||
/* mailing list. It will provide a sorted view of all the entries in a */
|
||||
/* mailing list.*/
|
||||
/****************************************************************************/
|
||||
int AB_InitializeMailingListPane(MLPane* pABookPane,
|
||||
ABID* listID,
|
||||
DIR_Server* dir,
|
||||
ABook* pABook);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Close the mailing list pane. Called when the view on an mailing list */
|
||||
/* is being closed */
|
||||
/****************************************************************************/
|
||||
int AB_CloseMailingListPane(MLPane** ppMLPane);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Register a compose window with the address book */
|
||||
/* The composition pane should do this everytime it opens */
|
||||
/* so that name completion can take place */
|
||||
/****************************************************************************/
|
||||
int AB_RegisterComposeWindow(ABook* pABook, DIR_Server* directory);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Unregister a compose window with the address book */
|
||||
/* The composition pane should do this when it is getting closed */
|
||||
/****************************************************************************/
|
||||
int AB_UnregisterComposeWindow(ABook* pABook, DIR_Server* directory);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Change the Current directory */
|
||||
/****************************************************************************/
|
||||
int AB_ChangeDirectory(ABPane* pABookPane, DIR_Server* directory);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Begin a search on the LDAP directory */
|
||||
/****************************************************************************/
|
||||
int AB_SearchDirectory(ABPane* pABookPane, char* searchString);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Process LDAP search results*/
|
||||
/****************************************************************************/
|
||||
int AB_LDAPSearchResults(ABPane* pABookPane, MSG_ViewIndex index, int32 num);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Finish an LDAP search */
|
||||
/****************************************************************************/
|
||||
int AB_FinishSearch(ABPane* pABookPane, MWContext* context);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Create and initialize the address book database */
|
||||
/****************************************************************************/
|
||||
int AB_InitAddressBook(DIR_Server* directory, ABook** ppABook);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* Create and initialize the address book database */
|
||||
/* upgrading the old html address book if we need to*/
|
||||
/****************************************************************************/
|
||||
int AB_InitializeAddressBook(DIR_Server* directory, ABook** ppABook,
|
||||
const char * pOldHTMLBook);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* Close the address book database */
|
||||
/****************************************************************************/
|
||||
int AB_CloseAddressBook(ABook** ppABook);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Add a person entry to the database */
|
||||
/****************************************************************************/
|
||||
int AB_AddUser(DIR_Server* dir, ABook* pABook, PersonEntry* pPerson,
|
||||
ABID* entryID);
|
||||
int AB_AddUserWithUI (MWContext *context, PersonEntry *person,
|
||||
DIR_Server *pab, XP_Bool lastOneToAdd);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Add an entry to the database from a url*/
|
||||
/****************************************************************************/
|
||||
int AB_AddSenderToAddBook(ABook* pABook, MWContext* context, char* author,
|
||||
char* url);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Add a mailing list to the database */
|
||||
/****************************************************************************/
|
||||
int AB_AddMailingList(DIR_Server* dir, ABook* pABook,
|
||||
MailingListEntry* pABList, ABID* entryID);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Perform a command on the selected indices */
|
||||
/* Right now this will only work on delete and mail to */
|
||||
/****************************************************************************/
|
||||
int AB_Command (ABPane* pane, AB_CommandType command,
|
||||
MSG_ViewIndex* indices, int32 numindices);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Before the front end displays any menu (each time), it should call this */
|
||||
/* function for each command on that menu to determine how it should be */
|
||||
/* displayed. */
|
||||
/****************************************************************************/
|
||||
int AB_CommandStatus (ABPane* pane,
|
||||
AB_CommandType command,
|
||||
MSG_ViewIndex* indices, int32 numindices,
|
||||
XP_Bool *selectable_p,
|
||||
MSG_COMMAND_CHECK_STATE *selected_p,
|
||||
const char **display_string,
|
||||
XP_Bool *plural_p);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Get and Set how full names are constructed for people entries */
|
||||
/* first last or last first */
|
||||
/****************************************************************************/
|
||||
XP_Bool AB_GetSortByFirstName(ABook* pABook);
|
||||
void AB_SetSortByFirstName(ABook* pABook, XP_Bool sortby);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Import Export various formats that will prompt for filename */
|
||||
/****************************************************************************/
|
||||
int AB_ImportFromFile(ABPane* pABookPane, MWContext* context);
|
||||
int AB_ExportToFile(ABPane* pABookPane, MWContext* context);
|
||||
|
||||
/****************************************************************************/
|
||||
/* This is only used right now for drop/paste of a vcard */
|
||||
/****************************************************************************/
|
||||
int AB_ImportFromVcard(AddressPane* pABookPane, const char* pVcard);
|
||||
|
||||
/****************************************************************************/
|
||||
/* This is only used right now for drop of a vcard */
|
||||
/* It it a helper function that can be called by the FE to */
|
||||
/* convert a vcard to an valid rfc822 address that can be used */
|
||||
/* in the address widget of the compose window */
|
||||
/****************************************************************************/
|
||||
int AB_ConvertVCardsToExpandedName(ABook* pABook, const char* vCardString,
|
||||
XP_List ** ppEntries, int32 * numEntries);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Import Export various formats that wont do any prompting */
|
||||
/* This is needed for the command line interface and automatic upgrading */
|
||||
/****************************************************************************/
|
||||
int AB_ImportFromFileNamed(ABook* pABook, char* filename);
|
||||
int AB_ExportToFileNamed(ABook* pABook, char* filename);
|
||||
|
||||
/****************************************************************************/
|
||||
/* This function is only called from the backend. */
|
||||
/* It is used to process the addbook url that is only used in mimevcrd.c */
|
||||
/* It probably will never be called by an FE */
|
||||
/****************************************************************************/
|
||||
int AB_ImportFromVcardURL(ABook* pABook, MWContext* context, const char* pVcard);
|
||||
|
||||
/****************************************************************************/
|
||||
/* This will create a buffer with a vcard in it. It is used for constructing */
|
||||
/* a buffer that can be used in drag/drop or copy to the clipboard */
|
||||
/****************************************************************************/
|
||||
int AB_ExportToVCard(ABook* pABook, DIR_Server* dir, ABID entryID,
|
||||
char** ppVcard);
|
||||
int AB_ExportToVCardFromPerson(ABook* pABook, PersonEntry* pPerson,
|
||||
char** ppVcard);
|
||||
|
||||
/****************************************************************************/
|
||||
/* This will create a temp file for a vcard. This function is only called */
|
||||
/* from the backend compose window for constructing a vcard attachment */
|
||||
/* It probably will never be called by an FE */
|
||||
/****************************************************************************/
|
||||
int AB_ExportToVCardTempFile(ABook* pABook, DIR_Server* dir, ABID entryID,
|
||||
char** filename);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Operations on panes/view */
|
||||
/****************************************************************************/
|
||||
|
||||
/****************************************************************************/
|
||||
/* Get the unique database id at a particular pane index */
|
||||
/****************************************************************************/
|
||||
ABID AB_GetEntryIDAt(AddressPane* pABookPane, uint32 index);
|
||||
uint32 AB_GetIndexOfEntryID (AddressPane* pABookPane, ABID entryID);
|
||||
int AB_GetEntryLine (ABPane * pABookPane, uint32 index,
|
||||
AB_EntryLine * pEntryLine);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Get info about how a pane is sorted */
|
||||
/****************************************************************************/
|
||||
XP_Bool AB_GetPaneSortedAscending(ABPane * pABookPane);
|
||||
ABID AB_GetPaneSortedBy(ABPane * pABookPane);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Get number of entries */
|
||||
/* For the address book you can ask for ALL, people, or mailing lists */
|
||||
/* For mailing list panes you will only be returned ALL */
|
||||
/****************************************************************************/
|
||||
int AB_GetEntryCount(DIR_Server* dir, ABook* pABook, uint32* count,
|
||||
ABID etype, ABID listID);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Modify information for an entry (person or mailing list) */
|
||||
/****************************************************************************/
|
||||
int AB_ModifyUser(DIR_Server* dir, ABook* pABook, ABID entryID, PersonEntry* pPerson);
|
||||
int AB_ModifyMailingList(DIR_Server* dir, ABook* pABook, ABID entryID,
|
||||
MailingListEntry* pEntry);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* Modify information for a mailing list that has been modified */
|
||||
/* but not committed in a mailing list pane */
|
||||
/****************************************************************************/
|
||||
int AB_ModifyMailingListAndEntries(MLPane* pMLPane, MailingListEntry* pABList);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Modify information for a mailing list that has been modified */
|
||||
/* but not committed in a mailing list pane. Some of the error checking */
|
||||
/* that was perfomed in add/replace in a mailing list had to be moved to */
|
||||
/* here. The fe's should be calling this function instead of the one above */
|
||||
/****************************************************************************/
|
||||
int AB_ModifyMailingListAndEntriesWithChecks(MLPane* pMLPane, MailingListEntry* pList,
|
||||
MSG_ViewIndex *index, MSG_ViewIndex begIndex);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Get information for every entry (person or mailing list) */
|
||||
/****************************************************************************/
|
||||
int AB_GetType(DIR_Server* dir, ABook* pABook, ABID entryID, ABID* type);
|
||||
int AB_GetFullName(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
|
||||
int AB_GetNickname(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Get information for every person entry */
|
||||
/****************************************************************************/
|
||||
int AB_GetGivenName(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
|
||||
int AB_GetMiddleName(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
|
||||
int AB_GetFamilyName(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
|
||||
int AB_GetCompanyName(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
|
||||
int AB_GetLocality(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
|
||||
int AB_GetRegion(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
|
||||
int AB_GetEmailAddress(DIR_Server* dir, ABook* pABook, ABID entryID, char* paddress);
|
||||
int AB_GetInfo(DIR_Server* dir, ABook* pABook, ABID entryID, char* pinfo);
|
||||
int AB_GetHTMLMail(DIR_Server* dir, ABook* pABook, ABID entryID, XP_Bool* pHTML);
|
||||
int AB_GetExpandedName(DIR_Server* dir, ABook* pABook, ABID entryID, char** pname);
|
||||
int AB_GetTitle(DIR_Server* dir, ABook* pABook, ABID entryID, char* ptitle);
|
||||
int AB_GetPOAddress(DIR_Server* dir, ABook* pABook, ABID entryID, char* ppoaddress);
|
||||
int AB_GetStreetAddress(DIR_Server* dir, ABook* pABook, ABID entryID, char* pstreet);
|
||||
int AB_GetZipCode(DIR_Server* dir, ABook* pABook, ABID entryID, char* pzip);
|
||||
int AB_GetCountry(DIR_Server* dir, ABook* pABook, ABID entryID, char* pcountry);
|
||||
int AB_GetWorkPhone(DIR_Server* dir, ABook* pABook, ABID entryID, char* pphone);
|
||||
int AB_GetFaxPhone(DIR_Server* dir, ABook* pABook, ABID entryID, char* pphone);
|
||||
int AB_GetHomePhone(DIR_Server* dir, ABook* pABook, ABID entryID, char* pphone);
|
||||
int AB_GetDistName(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
|
||||
int AB_GetSecurity(DIR_Server* dir, ABook* pABook, ABID entryID, short* security);
|
||||
int AB_GetCoolAddress(DIR_Server* dir, ABook* pABook, ABID entryID, char* paddress);
|
||||
int AB_GetUseServer(DIR_Server* dir, ABook* pABook, ABID entryID, short* use);
|
||||
|
||||
int AB_GetEntryIDForPerson(DIR_Server* dir, ABook* pABook, ABID* entryID,
|
||||
PersonEntry* pPerson);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Add/Remove entries for a mailing list */
|
||||
/****************************************************************************/
|
||||
int AB_GetEntryCountInMailingList(MLPane* pMLPane, uint32* count);
|
||||
int AB_AddIDToMailingListAt(MLPane* pMLPane, ABID entryID, MSG_ViewIndex index);
|
||||
int AB_RemoveIDFromMailingListAt(MLPane* pMLPane, MSG_ViewIndex index);
|
||||
int AB_ReplaceIDInMailingListAt(MLPane* pMLPane, ABID entryID, MSG_ViewIndex index);
|
||||
int AB_AddPersonToMailingListAt(MLPane* pMLPane, PersonEntry* person,
|
||||
MSG_ViewIndex index, ABID* entryID);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Find index to first entry in a pane that matches the typedown */
|
||||
/****************************************************************************/
|
||||
int AB_GetIndexMatchingTypedown(ABPane* pABookPane,
|
||||
MSG_ViewIndex* index, const char* aValue, MSG_ViewIndex startIndex);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Return the id of the name/nickname entries that match a string. If we */
|
||||
/* find a nickname that uniquely matches then return otherwise check the */
|
||||
/* full name field. */
|
||||
/****************************************************************************/
|
||||
int AB_GetIDForNameCompletion(ABook* pABook, DIR_Server* dir, ABID* entryID,
|
||||
ABID* field, const char* aValue);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Return a string of expanded addresses from the address book */
|
||||
/****************************************************************************/
|
||||
char* AB_ExpandHeaderString(ABook* pABook, const char* addresses,
|
||||
XP_Bool expandfull);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Return the ids of mailing lists that a entry is a member of */
|
||||
/* This was mentioned at one time as a requirement in the ui but it may */
|
||||
/* go away */
|
||||
/****************************************************************************/
|
||||
int AB_GetMailingListsContainingID(ABook* pABook, MSG_ViewIndex* plist,
|
||||
ABID entryID);
|
||||
|
||||
/****************************************************************************/
|
||||
/* This should not be called by any of the fes. I placed it here so it */
|
||||
/* could be called in the backend by other functions such as those in libmsg */
|
||||
/* This allows for an increase in performance when adding a bunch of entries */
|
||||
/* to the database */
|
||||
/****************************************************************************/
|
||||
int AB_SetIsImporting(ABook* pABook, XP_Bool isImporting);
|
||||
|
||||
/****************************************************************************/
|
||||
/* This should not be called by any of the fes. I placed it here so it */
|
||||
/* could be called in the backend by other functions in libmsg */
|
||||
/* This will set the wantsHTML boolean to be set for all address book */
|
||||
/* entries with that match the name and email address. */
|
||||
/****************************************************************************/
|
||||
int AB_SetHTMLForPerson(DIR_Server* dir, ABook* pABook, PersonEntry* pPerson);
|
||||
|
||||
/****************************************************************************/
|
||||
/* This should not be called by any of the fes. I placed it here so it */
|
||||
/* could be called in the backend by other functions in libmsg */
|
||||
/* This will break a name apart into first name and last name. */
|
||||
/* Be sure and set the WinCSID in the person structure */
|
||||
/****************************************************************************/
|
||||
int AB_BreakApartFirstName (ABook* pABook, PersonEntry* pPerson);
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif
|
||||
7878
mozilla/include/allxpstr.h
Normal file
7878
mozilla/include/allxpstr.h
Normal file
File diff suppressed because it is too large
Load Diff
7878
mozilla/include/allxpstr.rc
Normal file
7878
mozilla/include/allxpstr.rc
Normal file
File diff suppressed because it is too large
Load Diff
700
mozilla/include/bkmks.h
Normal file
700
mozilla/include/bkmks.h
Normal file
@@ -0,0 +1,700 @@
|
||||
/* -*- 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 BKMKS_H
|
||||
#define BKMKS_H
|
||||
|
||||
#include "xp_mcom.h"
|
||||
#include "ntypes.h"
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
#define BM_LAST_CELL 0xFFFF /* See BMFE_RefreshCells */
|
||||
|
||||
typedef time_t BM_Date;
|
||||
|
||||
typedef enum {
|
||||
BM_Cmd_Invalid, /* XFE in particular likes to have an invalid
|
||||
ID code as one of the entries here...*/
|
||||
|
||||
BM_Cmd_Open, /* Open a new bookmark file. */
|
||||
|
||||
BM_Cmd_ImportBookmarks, /* Import entries from another bookmark
|
||||
file. */
|
||||
|
||||
BM_Cmd_SaveAs, /* Save these bookmarks into another file. */
|
||||
|
||||
BM_Cmd_Close, /* Close the bookmarks window. (NYI ###) */
|
||||
|
||||
BM_Cmd_Undo, /* Undo the last command. */
|
||||
BM_Cmd_Redo, /* Redo the last undone command. */
|
||||
|
||||
BM_Cmd_Cut, /* Cut the selected bookmarks. */
|
||||
BM_Cmd_Copy, /* Copy the selected bookmarks. */
|
||||
BM_Cmd_Paste, /* Paste in the most recent cut/copy. */
|
||||
BM_Cmd_Delete, /* Delete the selected bookmarks without
|
||||
affecting the clipboard. */
|
||||
|
||||
BM_Cmd_SelectAllBookmarks, /* Select every bookmark in the window. */
|
||||
|
||||
BM_Cmd_Find, /* Find a string. */
|
||||
|
||||
BM_Cmd_FindAgain, /* Find the same string again. */
|
||||
|
||||
BM_Cmd_BookmarkProps, /* Bring up the properties window. */
|
||||
|
||||
BM_Cmd_GotoBookmark, /* Load the selected bookmark in a browser
|
||||
window. */
|
||||
|
||||
/* Sort the bookmarks. NYI### */
|
||||
BM_Cmd_Sort_Name,
|
||||
BM_Cmd_Sort_Name_Asc,
|
||||
|
||||
BM_Cmd_Sort_Address,
|
||||
BM_Cmd_Sort_Address_Asc,
|
||||
|
||||
BM_Cmd_Sort_AddDate,
|
||||
BM_Cmd_Sort_AddDate_Asc,
|
||||
|
||||
BM_Cmd_Sort_LastVisit,
|
||||
BM_Cmd_Sort_LastVisit_Asc,
|
||||
|
||||
BM_Cmd_Sort_Natural,
|
||||
|
||||
|
||||
BM_Cmd_InsertBookmark, /* Insert a new bookmark (or a new address if
|
||||
in addressbook). */
|
||||
|
||||
BM_Cmd_InsertHeader, /* Insert a new header. */
|
||||
|
||||
BM_Cmd_InsertSeparator, /* Insert a separator. */
|
||||
|
||||
BM_Cmd_MakeAlias, /* Make an alias of this bookmark. */
|
||||
|
||||
BM_Cmd_SetAddHeader, /* Make the current header be the one where new
|
||||
bookmarks are added. */
|
||||
|
||||
BM_Cmd_SetMenuHeader /* Make the current header be the one which the
|
||||
pulldown menu is created from. */
|
||||
|
||||
} BM_CommandType;
|
||||
#define BM_Cmd_SortBookmarks BM_Cmd_Sort_Name
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BM_Sort_NONE = -1,
|
||||
|
||||
BM_Sort_Name,
|
||||
BM_Sort_Name_Asc,
|
||||
|
||||
BM_Sort_Address,
|
||||
BM_Sort_Address_Asc,
|
||||
|
||||
BM_Sort_AddDate,
|
||||
BM_Sort_AddDate_Asc,
|
||||
|
||||
BM_Sort_LastVisit,
|
||||
BM_Sort_LastVisit_Asc,
|
||||
|
||||
BM_Sort_Natural
|
||||
|
||||
} BM_SortType;
|
||||
|
||||
/* The various types of bookmark entries (as returned by BM_GetType). */
|
||||
|
||||
typedef uint16 BM_Type;
|
||||
|
||||
#define BM_TYPE_HEADER 0x0001
|
||||
#define BM_TYPE_URL 0x0002
|
||||
#define BM_TYPE_ADDRESS 0x0004
|
||||
#define BM_TYPE_SEPARATOR 0x0008
|
||||
#define BM_TYPE_ALIAS 0x0010
|
||||
|
||||
|
||||
/* This represents one line in the bookmarks window -- a URL, a
|
||||
separater, an addressbook entry, a header, etc. It's also already
|
||||
defined in ntypes.h, and some compilers bitch and moan about seeing it
|
||||
twice, so I've commented it out here. */
|
||||
/* typedef struct BM_Entry_struct BM_Entry; */
|
||||
|
||||
|
||||
|
||||
/* information for the find dialog */
|
||||
typedef struct BM_FindInfo {
|
||||
char* textToFind;
|
||||
XP_Bool checkNickname; /* Meaningful only in addressbook */
|
||||
XP_Bool checkName;
|
||||
XP_Bool checkLocation;
|
||||
XP_Bool checkDescription;
|
||||
XP_Bool matchCase;
|
||||
XP_Bool matchWholeWord;
|
||||
|
||||
BM_Entry* lastEntry;
|
||||
} BM_FindInfo;
|
||||
|
||||
struct BM_Entry_Focus {
|
||||
BM_Entry* saveFocus;
|
||||
XP_Bool foundSelection;
|
||||
};
|
||||
|
||||
extern XP_Bool BM_IsHeader(BM_Entry* entry);
|
||||
extern XP_Bool BM_IsUrl(BM_Entry* entry);
|
||||
extern XP_Bool BM_IsAddress(BM_Entry* entry);
|
||||
extern XP_Bool BM_IsSeparator(BM_Entry* entry);
|
||||
extern XP_Bool BM_IsAlias(BM_Entry* entry);
|
||||
extern XP_Bool BM_IsFolded(BM_Entry* entry);
|
||||
extern XP_Bool BM_IsSelected(BM_Entry* entry);
|
||||
|
||||
|
||||
/* Returns the state of whether this is a "changed URL"; that is, a URL whose
|
||||
contents have apparently changed since we last visited it. */
|
||||
|
||||
#define BM_CHANGED_YES 1
|
||||
#define BM_CHANGED_NO 0
|
||||
#define BM_CHANGED_UNKNOWN -1
|
||||
|
||||
extern int32 BM_GetChangedState(BM_Entry* entry);
|
||||
|
||||
|
||||
|
||||
/* Get/Set the header that is to be the root of the pulldown menu. */
|
||||
extern BM_Entry* BM_GetMenuHeader(MWContext* context);
|
||||
extern void BM_SetMenuHeader(MWContext* context, BM_Entry* entry);
|
||||
|
||||
/* Get/Set the header that is to be the container of new items added from
|
||||
browser windows. */
|
||||
extern BM_Entry* BM_GetAddHeader(MWContext* context);
|
||||
extern void BM_SetAddHeader(MWContext* context, BM_Entry* entry);
|
||||
|
||||
|
||||
typedef void (*EntryFunc)(MWContext* context, BM_Entry* entry, void* closure);
|
||||
|
||||
|
||||
/* Executes the given function on every single entry in the bookmark file. */
|
||||
extern void BM_EachEntryDo(MWContext* context, EntryFunc func, void* closure);
|
||||
|
||||
/* Executes the given function for every entry that is selected. */
|
||||
extern void BM_EachSelectedEntryDo(MWContext* context, EntryFunc func,
|
||||
void* closure);
|
||||
|
||||
/* Executes the given function for every entry that is selected and is not a
|
||||
descendent of a header that is not folded or selected. */
|
||||
extern void BM_EachProperSelectedEntryDo(MWContext* context, EntryFunc func,
|
||||
void* closure, struct BM_Entry_Focus* bmFocus);
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* Front end stubs -- each FE needs to implement these. */
|
||||
|
||||
/* Refresh each cell between and including first and last in the bookmarks
|
||||
widget (if now is TRUE, the FE is expected to redraw them BEFORE returning,
|
||||
otherwise the FE can simply invalidate them and wait for the redraw to
|
||||
happen). If BM_LAST_CELL is passed in as last, then it means paint from
|
||||
the first to the end. */
|
||||
extern void BMFE_RefreshCells(MWContext* context, int32 first, int32 last,
|
||||
XP_Bool now);
|
||||
|
||||
|
||||
/* Resize the widget to accomodate "visibleCount" number of entries vertically
|
||||
and the width of widest entry the actual widget should NOT change size, just
|
||||
the size of the scrollable area under it */
|
||||
extern void BMFE_SyncDisplay(MWContext* context);
|
||||
|
||||
|
||||
/* measure the item and assign the width and height required to draw it into
|
||||
the widget into width and height. This is used only by BM_WidestEntry(); if
|
||||
you don't need that call, you can just make this an empty stub. */
|
||||
extern void BMFE_MeasureEntry(MWContext* context, BM_Entry* entry,
|
||||
uint32* width, uint32* height);
|
||||
|
||||
/* Save the given bucket o' bits as the clipboard. This same bucket needs to
|
||||
be returned later if BMFE_GetClipContents() is called. */
|
||||
extern void BMFE_SetClipContents(MWContext* context, void* buffer,
|
||||
int32 length);
|
||||
|
||||
|
||||
/* return the clipboard contents */
|
||||
extern void* BMFE_GetClipContents(MWContext* context, int32* length);
|
||||
|
||||
|
||||
/* Copy the selected items from a history window to the clipboard (as bookmarks) */
|
||||
extern char *BM_ClipCopyHistorySelection( void *pHistCsr, uint32 *pSelections, int iCount, int *pSize, XP_Bool bLongFormat );
|
||||
|
||||
/* Insert the block into the list */
|
||||
extern void BM_DropBlockL( MWContext *pContext, char *pData, BM_Entry *firstSelected );
|
||||
|
||||
/* Create the bookmarks property window. If one already exists, just bring it
|
||||
to the front. This will always be immediately followed by a call to
|
||||
BMFE_EditItem(). */
|
||||
extern void BMFE_OpenBookmarksWindow(MWContext* context);
|
||||
|
||||
|
||||
/* Edit the given item in the bookmarks property window. If there is no
|
||||
bookmarks property window currently, then the FE should ignore this call.
|
||||
If the bookmarks property window is currently displaying some other entry,
|
||||
then it should save any changes made to that entry (by calling BM_SetName,
|
||||
etc.) before loading up this entry. */
|
||||
extern void BMFE_EditItem(MWContext* context, BM_Entry* entry);
|
||||
|
||||
/* The given entry is no longer valid (i.e., the user just deleted it). So,
|
||||
the given pointer is about to become invalid, and the FE should remove any
|
||||
references to it it may have. In particular, if it is the one being edited
|
||||
in the bookmarks property window, then the FE should clear that window. */
|
||||
extern void BMFE_EntryGoingAway(MWContext* context, BM_Entry* entry);
|
||||
|
||||
|
||||
/* The user has requested to view the given url. Show it to him in, using some
|
||||
appropriate context. Url may be targeted to a different window */
|
||||
extern void BMFE_GotoBookmark(MWContext* context,
|
||||
const char* url, const char* target);
|
||||
|
||||
|
||||
/* Create the find dialog, and fill it in as specified in the given
|
||||
structure. When the user hits the "Find" button in the dialog, call
|
||||
BM_DoFindBookmark. */
|
||||
extern void* BMFE_OpenFindWindow(MWContext* context, BM_FindInfo* findInfo);
|
||||
|
||||
|
||||
/* Make sure that the given entry is visible. */
|
||||
extern void BMFE_ScrollIntoView(MWContext* context, BM_Entry* entry);
|
||||
|
||||
|
||||
/* The list of bookmarks has changed somehow, so any "bookmarks" menu needs to
|
||||
be recreated. This should be a cheap call, just setting a flag in the FE so
|
||||
that it knows to recreate the menu later (like, when the user tries to view
|
||||
it). Recreating it immediately would be bad, because this can get called
|
||||
much more often than is reasonable. */
|
||||
extern void BMFE_BookmarkMenuInvalid(MWContext* context);
|
||||
|
||||
|
||||
/* We're in the process of doing a What's Changed operation. The What's
|
||||
Changed window should update to display the URL, the percentage (calculate
|
||||
as done*100/total), and the total estimated time (given here as a
|
||||
pre-formatted string). The What's Changed window should end up looking
|
||||
something like this:
|
||||
|
||||
Checking <URL>... (<13> left)
|
||||
{===================== } (progress bar)
|
||||
|
||||
Estimated time remaining: <2 hours 13 minutes>
|
||||
(Remaining time depends on the sites selected and
|
||||
the network traffic).
|
||||
|
||||
|
||||
[ Cancel ]
|
||||
|
||||
It's up to the FE to notice the first time this is called and change its
|
||||
window to display the info instead of the initial What's Changed screen.
|
||||
|
||||
If the user ever hits Cancel (or does something equivilant, like destroys
|
||||
the window), the FE must call BM_CancelWhatsChanged(). */
|
||||
|
||||
extern void BMFE_UpdateWhatsChanged(MWContext* context,
|
||||
const char* url, /* If NULL, just display
|
||||
"Checking..." */
|
||||
int32 done, int32 total,
|
||||
const char* totaltime);
|
||||
|
||||
|
||||
|
||||
/* We've finished processing What's Changed. The What's Changed window should
|
||||
change to display the summary of what happened. It should look something
|
||||
like this:
|
||||
|
||||
Done checking <157> Bookmarks.
|
||||
<134> documents were reached.
|
||||
<27> documents have changed and are marked in blue.
|
||||
|
||||
[ OK ]
|
||||
|
||||
When the user clicks on the OK, the FE should just take down the window.
|
||||
(It doesn't matter if the FE calls BM_CancelWhatsChanged(); it will be a
|
||||
no-op in this situtation.) */
|
||||
|
||||
extern void BMFE_FinishedWhatsChanged(MWContext* context, int32 totalchecked,
|
||||
int32 numreached, int32 numchanged);
|
||||
|
||||
#ifdef XP_WIN
|
||||
/* The current bookmarks file is about to change */
|
||||
extern void BMFE_ChangingBookmarksFile(void);
|
||||
|
||||
/* The current bookmarks file has been changed */
|
||||
extern void BMFE_ChangedBookmarksFile(void);
|
||||
#endif
|
||||
|
||||
#ifdef XP_UNIX
|
||||
/* Use these to know when to allow refresh */
|
||||
extern void BMFE_StartBatch(MWContext* context);
|
||||
extern void BMFE_EndBatch(MWContext* context);
|
||||
#endif
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
|
||||
/* Initialize a new bookmarks context. (returns negative on failure) */
|
||||
extern int BM_InitializeBookmarksContext(MWContext* context);
|
||||
|
||||
|
||||
/* Prepare to destroy a bookmarks context. Will save any changes that have
|
||||
been made. */
|
||||
extern void BM_CleanupBookmarksContext(MWContext* context);
|
||||
|
||||
|
||||
/* Set some FE data to associate with a bookmarks context. */
|
||||
extern void BM_SetFEData(MWContext* context, void* data);
|
||||
|
||||
/* Get the FE data previously associated with a context. */
|
||||
extern void* BM_GetFEData(MWContext* context);
|
||||
|
||||
|
||||
/* Create a new url entry. */
|
||||
extern BM_Entry* BM_NewUrl(const char* name, const char* address,
|
||||
const char* content_type, BM_Date last_visit);
|
||||
|
||||
/* Create a new header. */
|
||||
extern BM_Entry* BM_NewHeader(const char* name);
|
||||
|
||||
|
||||
/* Create a copy of an existing bookmark. If the bookmark is a folder
|
||||
it will also contain a copy of all of the bookmarks in the folder.*/
|
||||
extern BM_Entry* BM_CopyBookmark(MWContext* context, BM_Entry* original);
|
||||
|
||||
/* Frees an entry. This should never be called unless you are sure the entry
|
||||
has not been added to some header, and is not the object of some alias. In
|
||||
other words, be sure nothing could possibly have a pointer to this it.
|
||||
If the object is a header, this will also free all of its descendents. */
|
||||
extern void BM_FreeEntry(MWContext* context, BM_Entry* entry);
|
||||
|
||||
|
||||
/* Get the type of this bookmark. (Returns one of the BM_TYPE_* values.) */
|
||||
extern BM_Type BM_GetType(BM_Entry* entry);
|
||||
|
||||
extern char* BM_GetName(BM_Entry* entry);
|
||||
|
||||
extern char* BM_GetAddress(BM_Entry* entry);
|
||||
extern char* BM_GetTarget(BM_Entry* entry, XP_Bool recurse);
|
||||
extern char* BM_GetDescription(BM_Entry* entry);
|
||||
|
||||
extern char* BM_GetNickName(BM_Entry* entry); /* Only meaningful in address
|
||||
book. */
|
||||
|
||||
/* Get the full name and address of the given entry (which must be an
|
||||
address book entry or header). Result is returned in a newly allocated
|
||||
string; free it with XP_FREE() when through. */
|
||||
extern char* BM_GetFullAddress(MWContext* context, BM_Entry* entry);
|
||||
|
||||
/* These return prettily formated info about the bookmark. They each
|
||||
return the result in a staticly allocated string, so if you call the
|
||||
same function twice the results get stomped. */
|
||||
extern char* BM_PrettyLastVisitedDate(BM_Entry* entry);
|
||||
extern char* BM_PrettyAddedOnDate(BM_Entry* entry);
|
||||
extern char* BM_PrettyAliasCount(MWContext* context, BM_Entry* entry);
|
||||
|
||||
|
||||
/* Get the root node of a context. */
|
||||
extern BM_Entry* BM_GetRoot(MWContext* context);
|
||||
|
||||
|
||||
/* Given a node, return the first of its children (if any). */
|
||||
extern BM_Entry* BM_GetChildren(BM_Entry* entry);
|
||||
|
||||
/* Given a node, return the next node that has the same parent (if any). */
|
||||
extern BM_Entry* BM_GetNext(BM_Entry* entry);
|
||||
|
||||
/* Given a node, returns its parent (or NULL if this is the root) */
|
||||
extern BM_Entry* BM_GetParent(BM_Entry* entry);
|
||||
|
||||
/* Does this node have a sibling somewhere below it? */
|
||||
extern XP_Bool BM_HasNext(BM_Entry* entry);
|
||||
|
||||
/* Does this node have a sibling somewhere above it? Note that there is *not*
|
||||
an API to actually get that sibling, as this is not a simple call. However,
|
||||
determing the existance of such a child is easy, and that's what Windows
|
||||
needs to paint its pipes. */
|
||||
extern XP_Bool BM_HasPrev(BM_Entry* entry);
|
||||
|
||||
|
||||
|
||||
/* Routines to change the name/address/description of an entry. These routines
|
||||
will take care of updating the display as necessary. */
|
||||
extern void BM_SetName(MWContext* context, BM_Entry* entry,
|
||||
const char* newName);
|
||||
extern void BM_SetAddress(MWContext* context, BM_Entry* entry,
|
||||
const char* newAddress);
|
||||
extern void BM_SetTarget(MWContext* context, BM_Entry* entry,
|
||||
const char* newTarget);
|
||||
extern void BM_SetDescription(MWContext* context, BM_Entry* entry,
|
||||
const char* newDesc);
|
||||
|
||||
/* Only meaningful in addressbook (on an address or header or alias to same) */
|
||||
extern XP_Bool BM_SetNickName(MWContext* context, BM_Entry* entry,
|
||||
const char* newName);
|
||||
|
||||
/* The user just hit "Cancel" on the properties window, which was editing
|
||||
the given item. This gives the bookmarks code a chance to delete the
|
||||
item if it was just newly created. */
|
||||
extern void BM_CancelEdit(MWContext* context, BM_Entry* entry);
|
||||
|
||||
|
||||
/* fold or unfold the header according to "fold" and all its subfolders if
|
||||
foldAll is TRUE */
|
||||
extern void BM_FoldHeader(MWContext* context, BM_Entry* entry, XP_Bool fold,
|
||||
XP_Bool refresh, XP_Bool foldAll);
|
||||
|
||||
|
||||
/* clear all the selection flags, and cause a redisplay if refresh is set. */
|
||||
extern void BM_ClearAllSelection(MWContext* context, XP_Bool refresh);
|
||||
|
||||
/* Clear all the child selections of the passes header and redisplay if refresh
|
||||
is set. */
|
||||
extern void BM_ClearAllChildSelection(MWContext* context, BM_Entry* at,
|
||||
XP_Bool refresh);
|
||||
|
||||
/* Select everything. */
|
||||
extern void BM_SelectAll(MWContext* context, XP_Bool refresh);
|
||||
|
||||
|
||||
/* selects the item, call BMFE_Refresh on it if "refresh" and calls
|
||||
BM_ClearSelection first if extend is FALSE */
|
||||
extern void BM_SelectItem(MWContext* context, BM_Entry* item, XP_Bool refresh,
|
||||
XP_Bool extend, XP_Bool select);
|
||||
|
||||
/* Adds a range of bookmarks to the current selection. To be called by the FE
|
||||
when the user Shift-Clicks in the window. This will unselect everything and
|
||||
then select a range of bookmarks, from the last bookmark that was selected
|
||||
with BM_SelectItem to the one given here. */
|
||||
extern void BM_SelectRangeTo(MWContext* context, BM_Entry* item);
|
||||
|
||||
/* toggles the selected state of the item, call BMFE_Refresh on it if "refresh"
|
||||
and calls BM_ClearSelection if extend is FALSE */
|
||||
extern void BM_ToggleItem(MWContext* context, BM_Entry* item, XP_Bool refresh,
|
||||
XP_Bool extend );
|
||||
|
||||
/* returns the first selected entry */
|
||||
extern BM_Entry* BM_FirstSelectedItem(MWContext* context);
|
||||
|
||||
|
||||
extern BM_Date BM_GetLastVisited(BM_Entry *);
|
||||
extern BM_Date BM_GetAdditionDate(BM_Entry *);
|
||||
|
||||
/* return the number of bookmarks */
|
||||
extern int32 BM_GetCount(MWContext* context);
|
||||
|
||||
/* return the number of visible bookmarks */
|
||||
extern int32 BM_GetVisibleCount(MWContext* context);
|
||||
|
||||
/* returns an integer index of the item in the list */
|
||||
extern int32 BM_GetIndex(MWContext* context, BM_Entry* item);
|
||||
|
||||
/* returns an integer index of the item in the list and does not pay attention
|
||||
to the is_folded value */
|
||||
extern int32 BM_GetUnfoldedIndex(MWContext* context, BM_Entry* item);
|
||||
|
||||
/* returns the object associated with the index returned by BM_GetIndex() */
|
||||
extern BM_Entry* BM_AtIndex(MWContext* context, int32 index);
|
||||
|
||||
/* returns the object associated with the index returned by
|
||||
BM_GetUnfoldedIndex() */
|
||||
extern BM_Entry* BM_AtUnfoldedIndex(MWContext* context, int32 index);
|
||||
|
||||
|
||||
/* returns an integer depth of the item in the list starting
|
||||
at zero */
|
||||
extern int32 BM_GetDepth(MWContext* context, BM_Entry* item);
|
||||
|
||||
|
||||
/* Execute a find operation according to the data in the given structure. This
|
||||
will cause the appropriate entry to be selected and made visible. */
|
||||
extern void BM_DoFindBookmark(MWContext* context, BM_FindInfo* findInfo);
|
||||
|
||||
/* For addressbook only: find and return the entry (if any) for the e-mail
|
||||
address within the given mailto: url. (used by libmsg) */
|
||||
extern BM_Entry* BM_FindAddress(MWContext* context, const char* mailtourl);
|
||||
|
||||
|
||||
/* For addressbook only: edit the entry for the e-mail address within the
|
||||
given mailto: url, creating the entry if necessary. (used by libmsg) */
|
||||
extern void BM_EditAddress(MWContext* context, const char* mailtourl);
|
||||
|
||||
|
||||
/* For addressbook only: if the given list of addresses includes a nickname
|
||||
from the addresses, then return a new string with the addresses expanded.
|
||||
If expandfull is True, then all mailing list entries are expanded too,
|
||||
otherwise, mailing list entries are only expanded to include their name.
|
||||
(used by libmsg). */
|
||||
extern char* BM_ExpandHeaderString(MWContext* context, const char* value,
|
||||
XP_Bool expandfull);
|
||||
|
||||
|
||||
/* Checks every bookmark context for a url and updates the last accessed
|
||||
time. (For use by global history code; FE's probably don't need this.) */
|
||||
extern void BM_UpdateBookmarksTime(URL_Struct* URL_s, BM_Date cur_time);
|
||||
|
||||
/* returns TRUE if the second argument is a direct descendent of the first
|
||||
argument, returns FALSE otherwise */
|
||||
extern XP_Bool BM_IsDescendent(MWContext* context, BM_Entry* parent,
|
||||
BM_Entry* possible_child);
|
||||
|
||||
|
||||
/* The front end can use this call to determine what the indentation depth is
|
||||
needed to display all the icons in the bookmarks. The XFE uses this to
|
||||
dynamically resize the icon column. In true C style, the number returned is
|
||||
actually one bigger than the biggest depth the FE will ever get. */
|
||||
extern int BM_GetMaxDepth(MWContext* context);
|
||||
|
||||
|
||||
/* This is called during a drag operation. The user is dragging some bookmarks
|
||||
and is currently pointing at the given line. (If under is True, then the
|
||||
user is really pointing between the given line and the next line.) This
|
||||
returns TRUE if the FE should draw a box around the given line, and FALSE if
|
||||
it should underline it. */
|
||||
extern XP_Bool BM_IsDragEffectBox(MWContext* context, int line, XP_Bool under);
|
||||
|
||||
|
||||
/* Actually do a drop in a drag-n-drop reordering operation. The arguments are
|
||||
the same as BM_IsDragEffectBox(); the selected items will be moved. */
|
||||
extern void BM_DoDrop(MWContext* ctnx, int line, XP_Bool under);
|
||||
|
||||
|
||||
|
||||
|
||||
/* find and return the widest visible entry in the bookmarks tree. This makes
|
||||
sense only if your FE has defined a meaningful BMFE_MeasureEntry(). */
|
||||
extern BM_Entry* BM_WidestEntry(MWContext* context);
|
||||
|
||||
|
||||
|
||||
/* insert an item after another item in the bm if the insert_after item is NULL
|
||||
or not found the item will be inserted at the end of the list */
|
||||
extern void BM_InsertItemAfter(MWContext* context, BM_Entry* insert_after,
|
||||
BM_Entry* insertee);
|
||||
|
||||
/* insert an item in a header if "insert_after" is a Header type, or after the
|
||||
item if "insert after" is not a header type. if the insert_after item is
|
||||
NULL or not found the item will be inserted at the end of the bm */
|
||||
extern void BM_InsertItemInHeaderOrAfterItem(MWContext* context,
|
||||
BM_Entry* insert_after,
|
||||
BM_Entry* insertee );
|
||||
|
||||
/* Cause the given item to be inserted at the end of the given header. The
|
||||
header passed in here is usually BM_GetAddHeader(). */
|
||||
extern void BM_AppendToHeader(MWContext* context, BM_Entry* header,
|
||||
BM_Entry* entry);
|
||||
|
||||
extern void BM_PrependChildToHeader(MWContext* context, BM_Entry* parent, BM_Entry* child);
|
||||
|
||||
/* Removes the given item from bookmarks without deleting it*/
|
||||
extern void BM_RemoveChildFromHeader(MWContext* context, BM_Entry* parent, BM_Entry* child);
|
||||
|
||||
/* Cause the given bookmark to be displayed in a browser window somewhere.
|
||||
The given item must be an URL (BM_IsUrl must return TRUE). */
|
||||
extern void BM_GotoBookmark(MWContext* context, BM_Entry* item);
|
||||
|
||||
|
||||
/* Reads the hostlist from disk, what else? Pass in the bm filename and a
|
||||
relative URL which represents the original location of the html file. If
|
||||
you are reading the default bm you should pass in a file URL of the form
|
||||
file://localhost/PATH */
|
||||
extern void BM_ReadBookmarksFromDisk(MWContext* context, const char* filename,
|
||||
const char* relative_url);
|
||||
|
||||
/* saves the bm to a file. If the given filename is NULL, then save it back to
|
||||
where it was loaded from and only if changes have been made. Returns
|
||||
negative on failure. */
|
||||
extern int32 BM_SaveBookmarks(MWContext* context, const char* filename);
|
||||
|
||||
|
||||
/* Returns the filename that the bookmarks are saved in. */
|
||||
extern const char* BM_GetFileName(MWContext* context);
|
||||
|
||||
/* read in a new bookmarks file (esp for LI use). */
|
||||
extern void BM_Open_File(MWContext* context, char* newFile);
|
||||
|
||||
/* ability to set the modified to true or false (esp for LI use). */
|
||||
extern void BM_SetModified(MWContext* context, XP_Bool mod);
|
||||
|
||||
/* Whether the file will be written when Save is called. */
|
||||
extern XP_Bool BM_Modified(MWContext* context);
|
||||
|
||||
/* Convert a number of selections in a bm list into a block of memory that the
|
||||
user can use for cut and paste operations */
|
||||
extern char* BM_ConvertSelectionsToBlock(MWContext* context,
|
||||
XP_Bool bLongFormat,
|
||||
int32* lTotalLen);
|
||||
|
||||
/* Take a block of memory and insert the bm items it represents into the
|
||||
current bm */
|
||||
extern void BM_InsertBlockAt(MWContext* context, char* pOriginalBlock,
|
||||
BM_Entry* addTo, XP_Bool bLongFormat,
|
||||
int32 lTotalLen);
|
||||
|
||||
|
||||
/* select all aliases for an entry */
|
||||
extern void BM_SelectAliases(MWContext* context, BM_Entry* forEntry );
|
||||
|
||||
|
||||
/* Count how many aliases there are to the given entry. */
|
||||
extern int32 BM_CountAliases(MWContext* context, BM_Entry* forEntry);
|
||||
|
||||
|
||||
/* Make an alias for each of the currently selected entries. */
|
||||
extern void BM_MakeAliases(MWContext* context);
|
||||
|
||||
|
||||
/* Returns the real item that an alias points to. The given entry must be an
|
||||
alias (BM_IsAlias must return TRUE on it). */
|
||||
extern BM_Entry* BM_GetAliasOriginal(BM_Entry*);
|
||||
|
||||
|
||||
|
||||
/* Start a What's Changed operation. Before calling this routine, it's up to
|
||||
the FE to present a dialog like this when What's Changed starts:
|
||||
|
||||
Look for documents that have changed on:
|
||||
(o) All bookmarks
|
||||
( ) Selected bookmarks
|
||||
|
||||
[ Start Checking ] [ Cancel ]
|
||||
|
||||
Then the FE calls this routine when the user clicks Start Checking. The FE
|
||||
will immediately get called via BMFE_UpdateWhatsChanged(), and the FE should
|
||||
change the dialog box's appearance to match. */
|
||||
extern int BM_StartWhatsChanged(MWContext* context,
|
||||
XP_Bool do_only_selected);
|
||||
|
||||
|
||||
/* Cancel a running What's Changed operation. */
|
||||
extern int BM_CancelWhatsChanged(MWContext* context);
|
||||
|
||||
|
||||
|
||||
/* Returns whether the given command can be executed right now. Should be
|
||||
used to decide whether to disable a menu item for this command. */
|
||||
extern XP_Bool BM_FindCommandStatus(MWContext* context,
|
||||
BM_CommandType command);
|
||||
|
||||
/* Execute the given command. */
|
||||
extern void BM_ObeyCommand(MWContext* context, BM_CommandType command );
|
||||
|
||||
/* Clean up the undo queue */
|
||||
void BM_ResetUndo(MWContext * context);
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* BMLIST_H */
|
||||
159
mozilla/include/cdefs.h
Normal file
159
mozilla/include/cdefs.h
Normal file
@@ -0,0 +1,159 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Berkeley Software Design, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cdefs.h 8.7 (Berkeley) 1/21/94
|
||||
*/
|
||||
|
||||
#ifndef _CDEFS_H_
|
||||
#define _CDEFS_H_
|
||||
|
||||
#ifdef __BEGIN_DECLS
|
||||
#undef __BEGIN_DECLS
|
||||
#endif
|
||||
#ifdef __END_DECLS
|
||||
#undef __END_DECLS
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define __BEGIN_DECLS extern "C" {
|
||||
#define __END_DECLS }
|
||||
#else
|
||||
#define __BEGIN_DECLS
|
||||
#define __END_DECLS
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
|
||||
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
|
||||
* The __CONCAT macro is a bit tricky -- make sure you don't put spaces
|
||||
* in between its arguments. __CONCAT can also concatenate double-quoted
|
||||
* strings produced by the __STRING macro, but this only works with ANSI C.
|
||||
*/
|
||||
#undef __P
|
||||
#undef __CONCAT
|
||||
#undef __STRING
|
||||
|
||||
#if defined(__STDC__) || defined(__cplusplus) || defined(_WINDOWS) || defined(XP_OS2)
|
||||
#define __P(protos) protos /* full-blown ANSI C */
|
||||
#define __CONCAT(x,y) x ## y
|
||||
#define __STRING(x) #x
|
||||
|
||||
#define __const const /* define reserved names to standard */
|
||||
#define __signed signed
|
||||
#define __volatile volatile
|
||||
#ifndef _WINDOWS
|
||||
#if defined(__cplusplus)
|
||||
#define __inline inline /* convert to C++ keyword */
|
||||
#else
|
||||
#ifndef __GNUC__
|
||||
#define __inline /* delete GCC keyword */
|
||||
#endif /* !__GNUC__ */
|
||||
#endif /* !__cplusplus */
|
||||
#endif /* !_WINDOWS */
|
||||
|
||||
#else /* !(__STDC__ || __cplusplus) */
|
||||
#define __P(protos) () /* traditional C preprocessor */
|
||||
#define __CONCAT(x,y) x/**/y
|
||||
#define __STRING(x) "x"
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __const /* delete pseudo-ANSI C keywords */
|
||||
#define __inline
|
||||
#define __signed
|
||||
#define __volatile
|
||||
/*
|
||||
* In non-ANSI C environments, new programs will want ANSI-only C keywords
|
||||
* deleted from the program and old programs will want them left alone.
|
||||
* When using a compiler other than gcc, programs using the ANSI C keywords
|
||||
* inline, signed etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
|
||||
* When using "gcc -traditional", we assume that this is the intent; if
|
||||
* __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
|
||||
*/
|
||||
#ifndef NO_ANSI_KEYWORDS
|
||||
#define inline /* delete ANSI C keywords */
|
||||
#define signed
|
||||
#define volatile
|
||||
#endif
|
||||
#endif /* !__GNUC__ */
|
||||
#endif /* !(__STDC__ || __cplusplus) */
|
||||
|
||||
/*
|
||||
* GCC1 and some versions of GCC2 declare dead (non-returning) and
|
||||
* pure (no side effects) functions using "volatile" and "const";
|
||||
* unfortunately, these then cause warnings under "-ansi -pedantic".
|
||||
* GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
|
||||
* these work for GNU C++ (modulo a slight glitch in the C++ grammar
|
||||
* in the distribution version of 2.5.5).
|
||||
*/
|
||||
#if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5
|
||||
#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
#define __dead __volatile
|
||||
#define __pure __const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Delete pseudo-keywords wherever they are not available or needed. */
|
||||
#ifndef __dead
|
||||
#define __dead
|
||||
#define __pure
|
||||
#endif
|
||||
|
||||
#ifdef AIXV3
|
||||
/* Wont compile without const. Need a cleaner way to handle this. */
|
||||
#ifdef const
|
||||
#undef const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* !_CDEFS_H_ */
|
||||
76
mozilla/include/cgi.h
Normal file
76
mozilla/include/cgi.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* -*- 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 __cgi_h_
|
||||
#define __cgi_h_
|
||||
|
||||
/*
|
||||
** CGI assist library. Portability layer for writing correctly behaving
|
||||
** CGI programs.
|
||||
*/
|
||||
#include "ds.h"
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
/*
|
||||
** Read in the input, generating a single long string out of it. CGI
|
||||
** programs normally get the value of various forms elements as input.
|
||||
*/
|
||||
extern char *CGI_GatherInput(FILE *in);
|
||||
|
||||
/*
|
||||
** Given a null terminated string, compress it in place, converting
|
||||
** "funny characters" into their ascii equivalent. Maps "+" to space and
|
||||
** %xx to the binary version of xx, where xx is a pair of hex digits.
|
||||
*/
|
||||
extern void CGI_CompressString(char *s);
|
||||
|
||||
/*
|
||||
** Convert a string into an argument vector. This seperates the incoming
|
||||
** string into pieces, and calls CGI_CompressString to compress the
|
||||
** pieces. This allocates memory for the return value only.
|
||||
*/
|
||||
extern char **CGI_ConvertStringToArgVec(char *string, int *argcp);
|
||||
|
||||
/*
|
||||
** Look for the variable called "name" in the argv. Return a pointer to
|
||||
** the value portion of the variable if found, zero otherwise. this does
|
||||
** not malloc memory.
|
||||
*/
|
||||
extern char *CGI_GetVariable(char *name, int argc, char **argv);
|
||||
|
||||
/* Return non-zero if the variable string is not empty */
|
||||
#define CGI_IsEmpty(var) (!(var) || ((var)[0] == 0))
|
||||
|
||||
/*
|
||||
** Return true if the server that started the cgi running is using
|
||||
** security (https).
|
||||
*/
|
||||
extern DSBool CGI_IsSecureServer(void);
|
||||
|
||||
/*
|
||||
** Concatenate strings to produce a single string.
|
||||
*/
|
||||
extern char *CGI_Cat(char *, ...);
|
||||
|
||||
/* Escape a string, cgi style */
|
||||
char *CGI_Escape(char *in);
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* __cgi_h_ */
|
||||
59
mozilla/include/client.h
Normal file
59
mozilla/include/client.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* -*- 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 should be included after xp_mcom.h
|
||||
*
|
||||
* All definitions for intermodule communications in the Netscape
|
||||
* client should be contained in this file
|
||||
*/
|
||||
|
||||
#ifndef _CLIENT_H_
|
||||
#define _CLIENT_H_
|
||||
|
||||
#define NEW_FE_CONTEXT_FUNCS
|
||||
|
||||
/* include header files needed for prototypes/etc */
|
||||
|
||||
#include "xp_mcom.h"
|
||||
|
||||
#include "ntypes.h" /* typedefs for commonly used Netscape data structures */
|
||||
#include "fe_proto.h" /* all the standard FE functions */
|
||||
#include "proto.h" /* library functions */
|
||||
|
||||
/* global data structures */
|
||||
#include "structs.h"
|
||||
#include "merrors.h"
|
||||
|
||||
#ifndef XP_MAC /* don't include everything in the world */
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* include other bits of the Netscape client library */
|
||||
#include "lo_ele.h" /* Layout structures */
|
||||
#include "net.h"
|
||||
#include "gui.h"
|
||||
#include "shist.h"
|
||||
#include "hotlist.h"
|
||||
#include "glhist.h"
|
||||
#include "mime.h"
|
||||
|
||||
#endif /* !XP_MAC */
|
||||
|
||||
#endif /* _CLIENT_H_ */
|
||||
|
||||
220
mozilla/include/csid.h
Normal file
220
mozilla/include/csid.h
Normal file
@@ -0,0 +1,220 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
|
||||
/* csid.h */
|
||||
|
||||
#ifndef _CSID_H_
|
||||
#define _CSID_H_
|
||||
|
||||
/* Codeset type */
|
||||
#define SINGLEBYTE 0x0000 /* 0000 0000 0000 0000 = 0 */
|
||||
#define MULTIBYTE 0x0100 /* 0000 0001 0000 0000 = 256 */
|
||||
#define STATEFUL 0x0200 /* 0000 0010 0000 0000 = 512 */
|
||||
#define WIDECHAR 0x0300 /* 0000 0011 0000 0000 = 768 */
|
||||
#define CODESET_MASK 0x0F00 /* 0000 1111 0000 0000 = 3840 */
|
||||
|
||||
/*
|
||||
* Check for double byte encodings
|
||||
* (should distinguish 2 byte from true multibyte)
|
||||
*/
|
||||
#define IS_16BIT_ENCODING(x) (((x)&CODESET_MASK) == MULTIBYTE)
|
||||
|
||||
/* line-break on spaces */
|
||||
#define CS_SPACE 0x0400 /* 0000 0100 0000 0000 = 1024 */
|
||||
|
||||
/* Auto Detect Mode */
|
||||
#define CS_AUTO 0x0800 /* 0000 1000 0000 0000 = 2048 */
|
||||
|
||||
|
||||
/* Code Set IDs */
|
||||
/* CS_DEFAULT: used if no charset param in header */
|
||||
/* CS_UNKNOWN: used for unrecognized charset */
|
||||
|
||||
/* type id */
|
||||
#define CS_DEFAULT (SINGLEBYTE | 0) /* 0 */
|
||||
#define CS_ASCII (SINGLEBYTE | 1) /* 1 */
|
||||
#define CS_LATIN1 (SINGLEBYTE | 2) /* 2 */
|
||||
#define CS_JIS (STATEFUL | 3) /* 515 */
|
||||
#define CS_SJIS (MULTIBYTE | 4) /* 260 */
|
||||
#define CS_EUCJP (MULTIBYTE | 5) /* 261 */
|
||||
|
||||
#define CS_JIS_AUTO (CS_AUTO|STATEFUL | 3) /* 2563 */
|
||||
#define CS_SJIS_AUTO (CS_AUTO|MULTIBYTE | 4) /* 2308 */
|
||||
#define CS_EUCJP_AUTO (CS_AUTO|MULTIBYTE | 5) /* 2309 */
|
||||
|
||||
#define CS_MAC_ROMAN (SINGLEBYTE | 6) /* 6 */
|
||||
#define CS_BIG5 (MULTIBYTE | 7) /* 263 */
|
||||
#define CS_GB_8BIT (MULTIBYTE | 8) /* 264 */
|
||||
#define CS_CNS_8BIT (MULTIBYTE | 9) /* 265 */
|
||||
#define CS_LATIN2 (SINGLEBYTE | 10) /* 10 */
|
||||
#define CS_MAC_CE (SINGLEBYTE | 11) /* 11 */
|
||||
|
||||
#define CS_KSC_8BIT (MULTIBYTE|CS_SPACE | 12) /* 1292 */
|
||||
#define CS_KSC_8BIT_AUTO (CS_AUTO | MULTIBYTE|CS_SPACE | 12)
|
||||
|
||||
#define CS_2022_KR (STATEFUL | 13) /* 525 */
|
||||
#define CS_8859_3 (SINGLEBYTE | 14) /* 14 */
|
||||
#define CS_8859_4 (SINGLEBYTE | 15) /* 15 */
|
||||
#define CS_8859_5 (SINGLEBYTE | 16) /* 16 ISO Cyrillic */
|
||||
#define CS_8859_6 (SINGLEBYTE | 17) /* 17 ISO Arabic */
|
||||
#define CS_8859_7 (SINGLEBYTE | 18) /* 18 ISO Greek */
|
||||
#define CS_8859_8 (SINGLEBYTE | 19) /* 19 ISO Hebrew */
|
||||
#define CS_8859_9 (SINGLEBYTE | 20) /* 20 */
|
||||
#define CS_SYMBOL (SINGLEBYTE | 21) /* 21 */
|
||||
#define CS_DINGBATS (SINGLEBYTE | 22) /* 22 */
|
||||
#define CS_DECTECH (SINGLEBYTE | 23) /* 23 */
|
||||
#define CS_CNS11643_1 (MULTIBYTE | 24) /* 280 */
|
||||
#define CS_CNS11643_2 (MULTIBYTE | 25) /* 281 */
|
||||
#define CS_JISX0208 (MULTIBYTE | 26) /* 282 */
|
||||
#define CS_JISX0201 (SINGLEBYTE | 27) /* 27 */
|
||||
#define CS_KSC5601 (MULTIBYTE | 28) /* 284 */
|
||||
#define CS_TIS620 (SINGLEBYTE | 29) /* 29 */
|
||||
#define CS_JISX0212 (MULTIBYTE | 30) /* 286 */
|
||||
#define CS_GB2312 (MULTIBYTE | 31) /* 287 */
|
||||
#define CS_UCS2 (WIDECHAR | 32) /* 810 */
|
||||
#define CS_UCS4 (WIDECHAR | 33) /* 811 */
|
||||
#define CS_UTF8 (MULTIBYTE | 34) /* 290 */
|
||||
#define CS_UTF7 (STATEFUL | 35) /* 35 */
|
||||
#define CS_NPC (MULTIBYTE | 36) /* 292 */
|
||||
#define CS_X_BIG5 (MULTIBYTE | 37) /* 293 */
|
||||
#define CS_USRDEF2 (SINGLEBYTE | 38) /* 38 */
|
||||
|
||||
#define CS_KOI8_R (SINGLEBYTE | 39) /* 39 */
|
||||
#define CS_MAC_CYRILLIC (SINGLEBYTE | 40) /* 40 */
|
||||
#define CS_CP_1251 (SINGLEBYTE | 41) /* 41 CP1251 Windows Cyrillic */
|
||||
#define CS_MAC_GREEK (SINGLEBYTE | 42) /* 42 */
|
||||
/* CS_CP_1253 should be deleted, we should use CS_8859_7 instead */
|
||||
#define CS_CP_1253 (SINGLEBYTE | 43) /* 43 CP1253 Windows Greek */
|
||||
#define CS_CP_1250 (SINGLEBYTE | 44) /* 44 CP1250 Windows C. Europe */
|
||||
/* CS_CP_1254 should be deleted, we should use CS_8859_9 instead */
|
||||
#define CS_CP_1254 (SINGLEBYTE | 45) /* 45 CP1254 Windows Turkish */
|
||||
#define CS_MAC_TURKISH (SINGLEBYTE | 46) /* 46 */
|
||||
#define CS_GB2312_11 (MULTIBYTE | 47) /* 303 */
|
||||
#define CS_JISX0208_11 (MULTIBYTE | 48) /* 304 */
|
||||
#define CS_KSC5601_11 (MULTIBYTE | 49) /* 305 */
|
||||
#define CS_CNS11643_1110 (MULTIBYTE | 50) /* 306 */
|
||||
#define CS_UCS2_SWAP (WIDECHAR | 51) /* 819 */
|
||||
#define CS_IMAP4_UTF7 (STATEFUL | 52) /* 564 */
|
||||
#define CS_CP_850 (SINGLEBYTE | 53) /* 53 PC Latin 1 */
|
||||
#define CS_CP_852 (SINGLEBYTE | 54) /* 54 PC Latin 2 */
|
||||
#define CS_CP_855 (SINGLEBYTE | 55) /* 55 PC Cyrillic */
|
||||
#define CS_CP_857 (SINGLEBYTE | 56) /* 56 PC Turkish */
|
||||
#define CS_CP_862 (SINGLEBYTE | 57) /* 57 PC Hebrew */
|
||||
#define CS_CP_864 (SINGLEBYTE | 58) /* 58 PC Arabic */
|
||||
#define CS_CP_866 (SINGLEBYTE | 59) /* 59 PC Russian */
|
||||
#define CS_CP_874 (SINGLEBYTE | 60) /* 60 PC Thai */
|
||||
#define CS_CP_1257 (SINGLEBYTE | 61) /* 61 Windows Baltic */
|
||||
#define CS_CP_1258 (SINGLEBYTE | 62) /* 62 Windows Vietnamese */
|
||||
#define INTL_CHAR_SET_MAX 63 /* must be highest + 1 */
|
||||
|
||||
|
||||
#define CS_USER_DEFINED_ENCODING (SINGLEBYTE | 254) /* 254 */
|
||||
#define CS_UNKNOWN (SINGLEBYTE | 255) /* 255 */
|
||||
|
||||
#define IS_UTF8_CSID(x) (((x)&0xFF)== (CS_UTF8&0xFF))
|
||||
#define IS_UNICODE_CSID(x) \
|
||||
( (((x)&0xFF)== (CS_UCS2&0xFF)) \
|
||||
|| (((x)&0xFF)== (CS_UTF8&0xFF)) \
|
||||
|| (((x)&0xFF)== (CS_UTF7&0xFF)) )
|
||||
|
||||
/* The trigger is passing the parameter to
|
||||
PA_FetchParamValue() to satisfy its signature */
|
||||
#ifdef XP_MAC
|
||||
#define CS_FE_ASCII CS_MAC_ROMAN
|
||||
#else
|
||||
#define CS_FE_ASCII CS_LATIN1
|
||||
#endif
|
||||
|
||||
|
||||
/* Codeset # sorted by number */
|
||||
#if 0
|
||||
|
||||
0 CS_DEFAULT 0
|
||||
1 CS_ASCII 1
|
||||
2 CS_LATIN1 2
|
||||
6 CS_MAC_ROMAN 6
|
||||
10 CS_LATIN2 10
|
||||
11 CS_MAC_CE 11
|
||||
14 CS_8859_3 14
|
||||
15 CS_8859_4 15
|
||||
16 CS_8859_5 16
|
||||
17 CS_8859_6 17
|
||||
18 CS_8859_7 18
|
||||
19 CS_8859_8 19
|
||||
20 CS_8859_9 20
|
||||
21 CS_SYMBOL 21
|
||||
22 CS_DINGBATS 22
|
||||
23 CS_DECTECH 23
|
||||
27 CS_JISX0201 27
|
||||
29 CS_TIS620 29
|
||||
35 CS_UTF7 35
|
||||
38 CS_USRDEF2 38
|
||||
39 CS_KOI8_R 39
|
||||
40 CS_MAC_CYRILLIC 40
|
||||
41 CS_CP_1251 41
|
||||
42 CS_MAC_GREEK 42
|
||||
43 CS_CP_1253 43
|
||||
44 CS_CP_1250 44
|
||||
45 CS_CP_1254 45
|
||||
46 CS_MAC_TURKISH 46
|
||||
53 CS_CP_850 53
|
||||
54 CS_CP_852 54
|
||||
55 CS_CP_855 55
|
||||
56 CS_CP_857 56
|
||||
57 CS_CP_862 57
|
||||
58 CS_CP_864 58
|
||||
59 CS_CP_866 59
|
||||
59 CS_CP_874 60
|
||||
60 CS_CP_1257 61
|
||||
61 CS_CP_1258 62
|
||||
62 INTL_CHAR_SET_MAX 63
|
||||
254 CS_USER_DEFINED_ENCODING 254
|
||||
255 CS_UNKNOWN 255
|
||||
260 CS_SJIS 260
|
||||
261 CS_EUCJP 261
|
||||
263 CS_BIG5 263
|
||||
264 CS_GB_8BIT 264
|
||||
265 CS_CNS_8BIT 265
|
||||
280 CS_CNS11643_1 280
|
||||
281 CS_CNS11643_2 281
|
||||
282 CS_JISX0208 282
|
||||
284 CS_KSC5601 284
|
||||
286 CS_JISX0212 286
|
||||
287 CS_GB2312 287
|
||||
290 CS_UTF8 290
|
||||
292 CS_NPC 292
|
||||
293 CS_X_BIG5 293
|
||||
303 CS_GB2312_11 303
|
||||
304 CS_JISX0208_11 304
|
||||
305 CS_KSC5601_11 305
|
||||
306 CS_CNS11643_1110 306
|
||||
515 CS_JIS 515
|
||||
525 CS_2022_KR 525
|
||||
564 CS_IMAP4_UTF7 564
|
||||
810 CS_UCS2 810
|
||||
811 CS_UCS4 811
|
||||
819 CS_UCS2_SWAP 819
|
||||
1292 CS_KSC_8BIT 1292
|
||||
2308 CS_SJIS_AUTO 2308
|
||||
2309 CS_EUCJP_AUTO 2309
|
||||
2563 CS_JIS_AUTO 2563
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _CSID_H_ */
|
||||
36
mozilla/include/ctxtfunc.h
Normal file
36
mozilla/include/ctxtfunc.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
/* the context function table
|
||||
*
|
||||
* This was typedef'd to ContextFuncs in structs.h
|
||||
*/
|
||||
#ifndef _ContextFunctions_
|
||||
#define _ContextFunctions_
|
||||
|
||||
#include "il_types.h"
|
||||
#include "cl_types.h"
|
||||
#include "xp_obs.h"
|
||||
|
||||
struct _ContextFuncs {
|
||||
#define MAKE_FE_FUNCS_STRUCT
|
||||
#include "mk_cx_fn.h"
|
||||
};
|
||||
|
||||
#endif /* _ContextFunctions_ */
|
||||
|
||||
41
mozilla/include/cvactive.h
Normal file
41
mozilla/include/cvactive.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/* -*- 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 CV_ACTIVE
|
||||
#define CV_ACTIVE
|
||||
|
||||
#include "net.h"
|
||||
|
||||
/* define a constant to be passed to CV_MakeMultipleDocumentStream
|
||||
* as the data_object to signify that it should return
|
||||
* MK_END_OF_MULTIPART_MESSAGE when it gets to the end
|
||||
* of the multipart instead of waiting for the complete
|
||||
* function to be called
|
||||
*/
|
||||
#define CVACTIVE_SIGNAL_AT_END_OF_MULTIPART 999
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
extern NET_StreamClass *
|
||||
CV_MakeMultipleDocumentStream (int format_out,
|
||||
void *data_object,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *window_id);
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* CV_ACTIVE */
|
||||
223
mozilla/include/dirprefs.h
Normal file
223
mozilla/include/dirprefs.h
Normal file
@@ -0,0 +1,223 @@
|
||||
/* -*- 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 _DIRPREFS_H_
|
||||
#define _DIRPREFS_H_
|
||||
|
||||
#define kCurrentListVersion 1
|
||||
|
||||
/* DIR_Server.dirType */
|
||||
typedef enum
|
||||
{
|
||||
LDAPDirectory,
|
||||
HTMLDirectory,
|
||||
PABDirectory
|
||||
} DirectoryType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
cn,
|
||||
givenname,
|
||||
sn,
|
||||
mail,
|
||||
telephonenumber,
|
||||
o,
|
||||
ou,
|
||||
l,
|
||||
street,
|
||||
auth,
|
||||
custom1,
|
||||
custom2,
|
||||
custom3,
|
||||
custom4,
|
||||
custom5
|
||||
} DIR_AttributeId;
|
||||
|
||||
|
||||
typedef struct _DIR_ReplicationInfo DIR_ReplicationInfo;
|
||||
|
||||
|
||||
typedef struct DIR_Server
|
||||
{
|
||||
char *description; /* human readable name */
|
||||
char *serverName; /* network host name */
|
||||
char *searchBase; /* DN suffix to search at */
|
||||
char *fileName; /* XP path name of local DB */
|
||||
char *prefId; /* name of this server's tree in JS prefs */
|
||||
int port; /* network port number */
|
||||
int maxHits; /* maximum number of hits to return */
|
||||
XP_Bool isSecure; /* use SSL? */
|
||||
XP_Bool saveResults;
|
||||
XP_Bool efficientWildcards; /* server can match substrings */
|
||||
char *lastSearchString; /* required if saving results */
|
||||
DirectoryType dirType;
|
||||
uint32 flags;
|
||||
|
||||
/* site-configurable attributes and filters */
|
||||
XP_List *customFilters;
|
||||
XP_List *customAttributes;
|
||||
char *tokenSeps;
|
||||
XP_Bool stopFiltersOnHit;
|
||||
XP_Bool isOffline;
|
||||
|
||||
/* site-configurable list of attributes whose values are DNs */
|
||||
char **dnAttributes;
|
||||
int dnAttributesCount;
|
||||
|
||||
/* site-configurable list of attributes we shouldn't display in HTML */
|
||||
char **suppressedAttributes;
|
||||
int suppressedAttributesCount;
|
||||
|
||||
/* site-configurable list of attributes for the Basic Search dialog */
|
||||
DIR_AttributeId *basicSearchAttributes;
|
||||
int basicSearchAttributesCount;
|
||||
|
||||
/* site-configurable URL to open LDAP results */
|
||||
char *customDisplayUrl;
|
||||
|
||||
/* authentication fields */
|
||||
XP_Bool enableAuth; /* Use DN and password when binding? */
|
||||
XP_Bool savePassword; /* Remember the DN and password we gave? */
|
||||
char *authDn; /* DN to give to authenticate as */
|
||||
char *password; /* Password for the DN */
|
||||
|
||||
/* replication fields */
|
||||
DIR_ReplicationInfo *replInfo;
|
||||
|
||||
} DIR_Server;
|
||||
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
/* Return the list of directory servers
|
||||
* each front end hangs on to the list
|
||||
*/
|
||||
XP_List * FE_GetDirServers(void);
|
||||
|
||||
/* Since the strings in DIR_Server are allocated, we have bottleneck
|
||||
* routines to help with memory mgmt
|
||||
*/
|
||||
int DIR_CopyServer (DIR_Server *in, DIR_Server **out);
|
||||
int DIR_DeleteServer (DIR_Server *);
|
||||
int DIR_InitServer (DIR_Server *);
|
||||
|
||||
int DIR_ValidateServer (DIR_Server *);
|
||||
XP_Bool DIR_AreServersSame (DIR_Server *first, DIR_Server *second);
|
||||
int DIR_DeleteServerList(XP_List *wholeList);
|
||||
|
||||
int DIR_GetLdapServers (XP_List *wholeList, XP_List *subList);
|
||||
int DIR_ReorderLdapServers (XP_List *wholeList);
|
||||
|
||||
/* These two routines should be called to initialize and save
|
||||
* directory preferences from the XP Java Script preferences
|
||||
*/
|
||||
int DIR_GetServerPreferences (XP_List **list, const char* pabFile);
|
||||
int DIR_SaveServerPreferences (XP_List *wholeList);
|
||||
|
||||
/* This routine will clean up files for deleted directories */
|
||||
int DIR_CleanUpServerPreferences(XP_List *deletedList);
|
||||
|
||||
|
||||
#if 1
|
||||
|
||||
/* Returns a pointer into the list (not allocated, so don't free) */
|
||||
int DIR_GetPersonalAddressBook (XP_List *wholeList, DIR_Server **pab);
|
||||
int DIR_GetComposeNameCompletionAddressBook (XP_List *wholeList, DIR_Server **cab);
|
||||
|
||||
#else
|
||||
|
||||
/* Returns an allocated list of all personal address books, excluding
|
||||
* LDAP directories, replicated directories, and CABs
|
||||
*/
|
||||
XP_List *DIR_GetPersonalAddressBooks (XP_List *wholeList);
|
||||
XP_List *DIR_GetAddressBooksForCompletion (XP_List *wholeList);
|
||||
|
||||
#endif
|
||||
|
||||
void DIR_GetServerFileName(char** filename, const char* leafName);
|
||||
void DIR_SetServerFileName(DIR_Server* pServer, const char* leafName);
|
||||
|
||||
/* APIs for site-configurability of LDAP attribute names and
|
||||
* search filter behavior.
|
||||
*
|
||||
* Strings are NOT allocated, and arrays are NULL-terminated
|
||||
*/
|
||||
const char *DIR_GetAttributeName (DIR_Server *server, DIR_AttributeId id);
|
||||
const char **DIR_GetAttributeStrings (DIR_Server *server, DIR_AttributeId id);
|
||||
const char *DIR_GetFirstAttributeString (DIR_Server *server, DIR_AttributeId id);
|
||||
const char *DIR_GetFilterString (DIR_Server *server);
|
||||
const char *DIR_GetTokenSeparators (DIR_Server *server);
|
||||
XP_Bool DIR_RepeatFilterForTokens (DIR_Server *server, const char *filter);
|
||||
XP_Bool DIR_SubstStarsForSpaces (DIR_Server *server, const char *filter);
|
||||
XP_Bool DIR_UseCustomAttribute (DIR_Server *server, DIR_AttributeId id);
|
||||
|
||||
XP_Bool DIR_IsDnAttribute (DIR_Server *s, const char *attr);
|
||||
XP_Bool DIR_IsAttributeExcludedFromHtml (DIR_Server *s, const char *attr);
|
||||
|
||||
int DIR_AttributeNameToId (const char *attrName, DIR_AttributeId *id);
|
||||
|
||||
/* APIs for authentication */
|
||||
void DIR_SetAuthDN (DIR_Server *s, const char *dn);
|
||||
void DIR_SetPassword (DIR_Server *s, const char *password);
|
||||
|
||||
/* APIs for unescaping LDAP special chars */
|
||||
char *DIR_Unescape (const char *src, XP_Bool makeHtml);
|
||||
XP_Bool DIR_IsEscapedAttribute (DIR_Server *s, const char *attrib);
|
||||
|
||||
/* APIs for replication */
|
||||
int DIR_ValidateRootDSE (DIR_Server *s, int32 gen, int32 first, int32 last);
|
||||
|
||||
/* API for building a URL */
|
||||
char *DIR_BuildUrl (DIR_Server *s, const char *dn, XP_Bool forAddToAB);
|
||||
|
||||
/* Flags manipulation */
|
||||
|
||||
#define DIR_AUTO_COMPLETE_ENABLED 0x00000001
|
||||
#define DIR_ENABLE_AUTH 0x00000002
|
||||
#define DIR_SAVE_PASSWORD 0x00000004
|
||||
#define DIR_UTF8_DISABLED 0x00000008 /* not used by the FEs */
|
||||
#define DIR_IS_SECURE 0x00000010
|
||||
#define DIR_SAVE_RESULTS 0x00000020 /* not used by the FEs */
|
||||
#define DIR_EFFICIENT_WILDCARDS 0x00000040 /* not used by the FEs */
|
||||
#define DIR_LDAPV3_SUPPORTED 0x00000080 /* not used by the FEs */
|
||||
#define DIR_LDAPV3_NOT_SUPPORTED 0x00000100 /* not used by the FEs */
|
||||
#define DIR_VIRTUAL_LISTBOX_SUPPORTED 0x00000200 /* not used by the FEs */
|
||||
#define DIR_VIRTUAL_LISTBOX_NOT_SUPPORTED 0x00000400 /* not used by the FEs */
|
||||
|
||||
void DIR_SetAutoCompleteEnabled (XP_List *list, DIR_Server *server, XP_Bool onOrOff);
|
||||
|
||||
XP_Bool DIR_TestFlag (DIR_Server *server, uint32 flag);
|
||||
void DIR_SetFlag (DIR_Server *server, uint32 flag);
|
||||
void DIR_ClearFlag (DIR_Server *server, uint32 flag);
|
||||
void DIR_ForceFlag (DIR_Server *server, uint32 flag, XP_Bool forceOnOrOff);
|
||||
|
||||
char *DIR_ConvertToServerCharSet (DIR_Server *s, char *src, int16 srcCsid);
|
||||
char *DIR_ConvertFromServerCharSet (DIR_Server *s, char *src, int16 dstCsid);
|
||||
|
||||
#ifdef MOZ_LDAP
|
||||
|
||||
/* Does the LDAP client lib work for SSL */
|
||||
#include "ldap.h"
|
||||
int DIR_SetupSecureConnection (LDAP *ld);
|
||||
|
||||
#endif /* MOZ_LDAP */
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
|
||||
#endif /* dirprefs.h */
|
||||
267
mozilla/include/ds.h
Normal file
267
mozilla/include/ds.h
Normal file
@@ -0,0 +1,267 @@
|
||||
/* -*- 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 __DS_h_
|
||||
#define __DS_h_
|
||||
#ifdef XP_WIN32
|
||||
#include <windows.h>
|
||||
#endif /* XP_WIN32 */
|
||||
|
||||
#ifdef XP_OS2
|
||||
#define INCL_WIN
|
||||
#define INCL_GPI
|
||||
#define TID OS2TID /* global rename in OS2 H's! */
|
||||
#include <os2.h>
|
||||
#undef TID /* and restore */
|
||||
#endif
|
||||
|
||||
#include "xp_mcom.h"
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
/* Typedefs */
|
||||
typedef struct DSArrayStr DSArray;
|
||||
typedef struct DSLinkStr DSLink;
|
||||
typedef struct DSListStr DSList;
|
||||
typedef struct DSArenaStr DSArena;
|
||||
|
||||
#define DS_MIN(a,b) ((a)<(b)?(a):(b))
|
||||
#define DS_MAX(a,b) ((a)>(b)?(a):(b))
|
||||
|
||||
/*
|
||||
** Your basic boolean. Done as an enum to cause compiler warnings when a
|
||||
** boolean procedure doesn't return the right value.
|
||||
** LISA SEZ: Please do not use this; use PRBool instead. Eventually
|
||||
** (as soon as I can "make it so") DSBool is going away in favor of PRBool.
|
||||
*/
|
||||
typedef enum DSBoolEnum {
|
||||
DSTrue = 1,
|
||||
DSFalse = 0
|
||||
} DSBool;
|
||||
|
||||
/*
|
||||
** A status code. Status's are used by procedures that return status
|
||||
** values. Again the motivation is so that a compiler can generate
|
||||
** warnings when return values are wrong. Correct testing of status codes:
|
||||
**
|
||||
** DSStatus rv;
|
||||
** rv = some_function (some_argument);
|
||||
** if (rv != DSSuccess)
|
||||
** do_an_error_thing();
|
||||
**
|
||||
*/
|
||||
typedef enum DSStatusEnum {
|
||||
DSWouldBlock = -2,
|
||||
DSFailure = -1,
|
||||
DSSuccess = 0
|
||||
} DSStatus;
|
||||
|
||||
/*
|
||||
** A comparison code. Used for procedures that return comparision
|
||||
** values. Again the motivation is so that a compiler can generate
|
||||
** warnings when return values are wrong.
|
||||
*/
|
||||
typedef enum DSComparisonEnum {
|
||||
DSLessThan = -1,
|
||||
DSEqual = 0,
|
||||
DSGreaterThan = 1
|
||||
} DSComparison;
|
||||
|
||||
typedef void (*DSElementFreeFunc)(void *e1, DSBool freeit);
|
||||
typedef int (*DSElementCompareFunc)(void *e1, void *e2);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/*
|
||||
** Simple variable length array of pointers. The array keeps a NULL
|
||||
** pointer at the end of the array.
|
||||
*/
|
||||
struct DSArrayStr {
|
||||
void **things;
|
||||
DSElementFreeFunc freeElement;
|
||||
};
|
||||
|
||||
extern DSArray *DS_CreateArray(int slots);
|
||||
extern DSStatus DS_GrowArray(DSArray *da, int slots);
|
||||
extern void DS_SetArrayMethods(DSArray *da, DSElementFreeFunc free);
|
||||
extern void DS_DestroyArray(DSArray *da, DSBool freeit);
|
||||
extern void DS_Sort(DSArray *da, DSElementCompareFunc compare);
|
||||
extern int DS_Elements(DSArray *da);
|
||||
extern DSStatus DS_AddElement(DSArray *da, void *element);
|
||||
extern void DS_RemoveElement(DSArray *da, void *element);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/*
|
||||
** Circular linked list. Each link contains a pointer to the object that
|
||||
** is actually in the list.
|
||||
*/
|
||||
struct DSLinkStr {
|
||||
DSLink *next;
|
||||
DSLink *prev;
|
||||
void *thing;
|
||||
};
|
||||
|
||||
struct DSListStr {
|
||||
DSLink link;
|
||||
};
|
||||
|
||||
#define DS_InitList(lst) \
|
||||
{ \
|
||||
(lst)->link.next = &(lst)->link; \
|
||||
(lst)->link.prev = &(lst)->link; \
|
||||
(lst)->link.thing = 0; \
|
||||
}
|
||||
|
||||
#define DS_ListEmpty(lst) \
|
||||
((lst)->link.next == &(lst)->link)
|
||||
|
||||
#define DS_ListHead(lst) \
|
||||
((lst)->link.next)
|
||||
|
||||
#define DS_ListTail(lst) \
|
||||
((lst)->link.prev)
|
||||
|
||||
#define DS_ListIterDone(lst,lnk) \
|
||||
((lnk) == &(lst)->link)
|
||||
|
||||
#define DS_AppendLink(lst,lnk) \
|
||||
{ \
|
||||
(lnk)->next = &(lst)->link; \
|
||||
(lnk)->prev = (lst)->link.prev; \
|
||||
(lst)->link.prev->next = (lnk); \
|
||||
(lst)->link.prev = (lnk); \
|
||||
}
|
||||
|
||||
#define DS_InsertLink(lst,lnk) \
|
||||
{ \
|
||||
(lnk)->next = (lst)->link.next; \
|
||||
(lnk)->prev = &(lst)->link; \
|
||||
(lst)->link.next->prev = (lnk); \
|
||||
(lst)->link.next = (lnk); \
|
||||
}
|
||||
|
||||
#define DS_RemoveLink(lnk) \
|
||||
{ \
|
||||
(lnk)->next->prev = (lnk)->prev; \
|
||||
(lnk)->prev->next = (lnk)->next; \
|
||||
(lnk)->next = 0; \
|
||||
(lnk)->prev = 0; \
|
||||
}
|
||||
|
||||
extern DSLink *DS_NewLink(void *thing);
|
||||
extern DSLink *DS_FindLink(DSList *lst, void *thing);
|
||||
extern void DS_DestroyLink(DSLink *lnk, DSBool freeit);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/*
|
||||
** Memory manager
|
||||
*/
|
||||
|
||||
/*
|
||||
** at one time XP_Block was a float* to force clients to cast things
|
||||
** before use. Now DSBlock is defined since that will be most convenient
|
||||
** for almost all uses.
|
||||
*/
|
||||
|
||||
typedef unsigned char *DSBlock;
|
||||
/*
|
||||
** Allocate some memory. Always allocates at least one byte of memory.
|
||||
*/
|
||||
extern void *DS_Alloc(size_t bytes);
|
||||
|
||||
/*
|
||||
** Reallocate some memory, growing or shrinking the memory.
|
||||
*/
|
||||
extern void *DS_Realloc(void *oldptr, size_t bytes);
|
||||
|
||||
/*
|
||||
** Allocate and then zero some memory. Always allocates at least one byte
|
||||
** of memory.
|
||||
*/
|
||||
extern void *DS_Zalloc(size_t bytes);
|
||||
|
||||
/*
|
||||
** Allocate a block of memory. Always allocates at least one byte of
|
||||
** memory.
|
||||
*/
|
||||
extern DSBlock DS_AllocBlock(size_t bytes);
|
||||
|
||||
/*
|
||||
** Reallocate a block of memory, growing or shrinking the memory block.
|
||||
*/
|
||||
extern DSBlock DS_ReallocBlock(DSBlock block, size_t newBytes);
|
||||
|
||||
/*
|
||||
** Free a block of memory. Safe to use on null pointers.
|
||||
*/
|
||||
extern void DS_FreeBlock(DSBlock block);
|
||||
|
||||
/*
|
||||
** Free a chunk of memory. Safe to use on null pointers.
|
||||
*/
|
||||
extern void DS_Free(void *ptr);
|
||||
|
||||
/*
|
||||
** Zero and then free a chunk of memory. Safe to use on null pointers.
|
||||
*/
|
||||
extern void DS_Zfree(void *ptr, size_t bytes);
|
||||
|
||||
/*
|
||||
* Low cost Malloc Arenas.
|
||||
*
|
||||
* The chunks are a linked list.
|
||||
* The beginning of each chunk is a pointer to the next chunk.
|
||||
*/
|
||||
struct DSArenaStr {
|
||||
unsigned long chunkSize; /* size of each chunk */
|
||||
unsigned int refCount; /* reference count */
|
||||
void ** firstChunk; /* pointer to first chunk */
|
||||
void ** lastChunk; /* pointer to last chunk */
|
||||
void * pLast; /* last item allocated */
|
||||
void * pCur; /* beginning of free area */
|
||||
void * pCurEnd; /* end of free area in current chunk */
|
||||
};
|
||||
|
||||
/* make a new arena */
|
||||
extern DSArena *
|
||||
DS_NewArena(unsigned long chunkSize);
|
||||
|
||||
/* destroy an arena, and free all memory associated with it */
|
||||
extern void
|
||||
DS_FreeArena(DSArena *arena, DSBool zero);
|
||||
|
||||
/* malloc a chunk of data from the arena */
|
||||
extern void *
|
||||
DS_ArenaAlloc(DSArena *arena, unsigned long size);
|
||||
|
||||
/* malloc a chunk of data from the arena, zero filling it */
|
||||
extern void *
|
||||
DS_ArenaZalloc(DSArena *arena, unsigned long size);
|
||||
|
||||
/* change the size of an object, works best if it was the last object
|
||||
* allocated
|
||||
*/
|
||||
extern void *
|
||||
DS_ArenaGrow(DSArena *arena, void *pOld, unsigned long oldsize,
|
||||
unsigned long newsize);
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* __DS_h_ */
|
||||
33
mozilla/include/dserr.h
Normal file
33
mozilla/include/dserr.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/* -*- 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 __DS_ERR_h_
|
||||
#define __DS_ERR_h_
|
||||
|
||||
#define DS_ERROR_BASE (-0x1000)
|
||||
#define DS_ERROR_LIMIT (DS_ERROR_BASE + 1000)
|
||||
|
||||
#define IS_DS_ERROR(code) \
|
||||
(((code) >= DS_ERROR_BASE) && ((code) < DS_ERROR_LIMIT))
|
||||
|
||||
/*
|
||||
** DS library error codes
|
||||
*/
|
||||
#define DS_ERROR_OUT_OF_MEMORY (DS_ERROR_BASE + 0)
|
||||
|
||||
#endif /* __DS_ERR_h_ */
|
||||
1378
mozilla/include/edt.h
Normal file
1378
mozilla/include/edt.h
Normal file
File diff suppressed because it is too large
Load Diff
653
mozilla/include/edttypes.h
Normal file
653
mozilla/include/edttypes.h
Normal file
@@ -0,0 +1,653 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* File defines external editor types.
|
||||
*
|
||||
* These types are remapped internally to the editor.
|
||||
*/
|
||||
|
||||
#ifndef _edt_types_h_
|
||||
#define _edt_types_h_
|
||||
|
||||
#ifndef EDITOR_TYPES
|
||||
#define ED_Element void
|
||||
#define ED_Buffer void
|
||||
#define ED_TagCursor void
|
||||
#define ED_BitArray void
|
||||
#endif
|
||||
|
||||
#include "xp_core.h"
|
||||
|
||||
/* Number of "Netscape Colors" All are in
|
||||
* Color cube
|
||||
*/
|
||||
#define MAX_NS_COLORS 70
|
||||
|
||||
typedef int32 ED_BufferOffset;
|
||||
|
||||
/*
|
||||
* Handle to Internal structure used for maintaining links.
|
||||
*/
|
||||
typedef struct ED_Link* ED_LinkId;
|
||||
#define ED_LINK_ID_NONE 0
|
||||
|
||||
/* this id is passed to FE_GetImageData.. when it returns, we know to pass
|
||||
* the call to EDT_SetImageData
|
||||
*/
|
||||
#define ED_IMAGE_LOAD_HACK_ID -10
|
||||
|
||||
typedef enum {
|
||||
ED_ELEMENT_NONE, /* Not returned from EDT_GetCurrentElement, needed to have a "not known" value */
|
||||
ED_ELEMENT_SELECTION, /* a selection instead of a single element */
|
||||
ED_ELEMENT_TEXT,
|
||||
ED_ELEMENT_IMAGE,
|
||||
ED_ELEMENT_HRULE,
|
||||
ED_ELEMENT_UNKNOWN_TAG,
|
||||
ED_ELEMENT_TARGET,
|
||||
ED_ELEMENT_TABLE, /* Keep these at the end so we can use type >= ED_ELEMENT_TABLE to test for any of them */
|
||||
ED_ELEMENT_CELL,
|
||||
ED_ELEMENT_ROW, /* May not need these. Currently returning ED_ELEMENT_CELL instead */
|
||||
ED_ELEMENT_COL
|
||||
} ED_ElementType;
|
||||
|
||||
typedef enum {
|
||||
ED_CARET_BEFORE = 0,
|
||||
ED_CARET_AFTER = 1
|
||||
} ED_CaretObjectPosition;
|
||||
|
||||
#define TF_NONE 0
|
||||
#define TF_BOLD 1
|
||||
#define TF_ITALIC 2
|
||||
#define TF_FIXED 4
|
||||
#define TF_SUPER 8
|
||||
#define TF_SUB 0x10
|
||||
#define TF_STRIKEOUT 0x20
|
||||
#define TF_BLINK 0x40
|
||||
#define TF_FONT_COLOR 0x80 /* set if font has color */
|
||||
#define TF_FONT_SIZE 0x100 /* set if font has size */
|
||||
#define TF_HREF 0x200
|
||||
#define TF_SERVER 0x400
|
||||
#define TF_SCRIPT 0x800
|
||||
#define TF_STYLE 0x1000
|
||||
#define TF_UNDERLINE 0x2000
|
||||
#define TF_FONT_FACE 0x4000
|
||||
#define TF_NOBREAK 0x8000
|
||||
#define TF_SPELL 0x10000
|
||||
#define TF_INLINEINPUT 0x20000
|
||||
#define TF_INLINEINPUTTHICK 0x40000
|
||||
#define TF_INLINEINPUTDOTTED 0x80000
|
||||
#define TF_FONT_WEIGHT 0x100000
|
||||
#define TF_FONT_POINT_SIZE 0x200000
|
||||
|
||||
typedef int32 ED_TextFormat; /* Prefered type for the editor text format. */
|
||||
typedef ED_TextFormat ED_ETextFormat; /* Alias for old code. Remove when possible. */
|
||||
|
||||
/* Similar to ED_TextFormat. Used when multiple cells are represented in EDT_TableCellData */
|
||||
|
||||
#define CF_NONE 0
|
||||
#define CF_ALIGN 1
|
||||
#define CF_VALIGN 2
|
||||
#define CF_COLSPAN 4
|
||||
#define CF_ROWSPAN 8
|
||||
#define CF_HEADER 0x10
|
||||
#define CF_NOWRAP 0x20
|
||||
#define CF_WIDTH 0x40
|
||||
#define CF_HEIGHT 0x80
|
||||
#define CF_BACK_COLOR 0x100
|
||||
#define CF_BACK_IMAGE 0x200
|
||||
#define CF_BACK_NOSAVE 0x400
|
||||
#define CF_EXTRA_HTML 0x800
|
||||
|
||||
typedef int32 ED_CellFormat; /* Prefered type for the editor cell format. */
|
||||
|
||||
/*
|
||||
* The names here are confusing, and have a historical basis that is
|
||||
* lost in the mists of time. The trouble is that the "ED_ALIGN_CENTER"
|
||||
* tag is really "abscenter", while the ED_ALIGN_ABSCENTER tag is
|
||||
* really "center". (and the same for the TOP and BOTTOM tags.)
|
||||
*
|
||||
* Someday, if we have a lot of spare time we could switch the names.
|
||||
*/
|
||||
|
||||
/* CLM: Swapped bottom and center tags -- should match latest extensions now?
|
||||
* Note: BASELINE is not written out (this is default display mode)
|
||||
*/
|
||||
typedef enum {
|
||||
ED_ALIGN_DEFAULT = -1,
|
||||
ED_ALIGN_CENTER = 0, /* abscenter */
|
||||
ED_ALIGN_LEFT = 1, /* left */
|
||||
ED_ALIGN_RIGHT = 2, /* right */
|
||||
ED_ALIGN_TOP = 3, /* texttop */
|
||||
ED_ALIGN_BOTTOM = 4, /* absbottom */
|
||||
ED_ALIGN_BASELINE = 5, /* baseline */
|
||||
ED_ALIGN_ABSCENTER = 6, /* center */
|
||||
ED_ALIGN_ABSBOTTOM = 7, /* bottom */
|
||||
ED_ALIGN_ABSTOP = 8 /* top */
|
||||
} ED_Alignment;
|
||||
|
||||
|
||||
/*------------------- TABLE SIZING AND SELECTION --------------------*/
|
||||
|
||||
/* SizeStyle defines */
|
||||
#define ED_SIZE_NONE 0
|
||||
#define ED_SIZE_TOP 0x0001
|
||||
#define ED_SIZE_RIGHT 0x0002
|
||||
#define ED_SIZE_BOTTOM 0x0004
|
||||
#define ED_SIZE_LEFT 0x0008
|
||||
#define ED_SIZE_ADD_ROWS 0x0010
|
||||
#define ED_SIZE_ADD_COLS 0x0020
|
||||
|
||||
/* Hotspot at corners */
|
||||
#define ED_SIZE_TOP_RIGHT (ED_SIZE_TOP | ED_SIZE_RIGHT)
|
||||
#define ED_SIZE_BOTTOM_RIGHT (ED_SIZE_BOTTOM | ED_SIZE_RIGHT)
|
||||
#define ED_SIZE_TOP_LEFT (ED_SIZE_TOP | ED_SIZE_LEFT)
|
||||
#define ED_SIZE_BOTTOM_LEFT (ED_SIZE_BOTTOM | ED_SIZE_LEFT)
|
||||
|
||||
typedef intn ED_SizeStyle;
|
||||
|
||||
typedef enum { /* Return value for EDT_GetTableHitRegion) */
|
||||
ED_HIT_NONE,
|
||||
ED_HIT_SEL_TABLE, /* Upper left corner */
|
||||
ED_HIT_SEL_COL, /* Near top table border */
|
||||
ED_HIT_SEL_ROW, /* Near left table border */
|
||||
ED_HIT_SEL_CELL, /* Near top cell border */
|
||||
ED_HIT_SEL_ALL_CELLS, /* Upper left corner when Ctrl is pressed */
|
||||
ED_HIT_SIZE_TABLE_WIDTH, /* Near right table border */
|
||||
ED_HIT_SIZE_TABLE_HEIGHT, /* Near bottom table border */
|
||||
ED_HIT_SIZE_COL, /* Near right border of a cell and between columns */
|
||||
ED_HIT_SIZE_ROW, /* Near bottom border of a cell and between columns */
|
||||
ED_HIT_ADD_ROWS, /* Lower left corner */
|
||||
ED_HIT_ADD_COLS, /* Lower right corner */
|
||||
ED_HIT_DRAG_TABLE, /* Near bottom border and between rows when table or cell is already selected */
|
||||
ED_HIT_CHANGE_COLSPAN, /* Near Right border of cell having COLSPAN (Not used yet) */
|
||||
ED_HIT_CHANGE_ROWSPAN /* Bottom edge of cell having ROWSPAN (Not used yet) */
|
||||
} ED_HitType;
|
||||
|
||||
typedef enum { /* Return types for EDT_GetTableDragDropRegion */
|
||||
ED_DROP_NONE, /* Don't allow drop - when pasting wouldn't change anything */
|
||||
ED_DROP_NORMAL, /* No special table behavior - do the same as any HTML drop */
|
||||
ED_DROP_INSERT_BEFORE, /* Between columns - near left border of cell when source = column */
|
||||
ED_DROP_INSERT_AFTER, /* Between columns - near right border of cell when source = column */
|
||||
ED_DROP_INSERT_ABOVE, /* Between rows - near top border of cell when source = row */
|
||||
ED_DROP_INSERT_BELOW, /* Between rows - near bottom border of cell when source = row */
|
||||
ED_DROP_REPLACE_CELL, /* Inside cell - when we want to replace cell contents */
|
||||
ED_DROP_APPEND_CONTENTS /* Inside cell - when we append to existing contents */
|
||||
} ED_DropType;
|
||||
|
||||
struct _EDT_DragTableData {
|
||||
ED_HitType iSourceType; /* One of the ED_HIT_SEL_... enums */
|
||||
ED_DropType iDropType; /* One of above enum values */
|
||||
LO_Element *pFirstSelectedCell; /* First cell in source being dragged */
|
||||
LO_Element *pDragOverCell; /* Cell being dragged over */
|
||||
intn iRows; /* Number of rows */
|
||||
intn iColumns; /* and columns in selection */
|
||||
int32 X; /* Location to place highlighting or make caret */
|
||||
int32 Y; /* to show where to drop cells */
|
||||
int32 iWidth;
|
||||
int32 iHeight;
|
||||
};
|
||||
typedef struct _EDT_DragTableData EDT_DragTableData;
|
||||
|
||||
|
||||
typedef enum { /* Return values from EDT_GetMergeCellsType */
|
||||
ED_MERGE_NONE,
|
||||
ED_MERGE_NEXT_CELL,
|
||||
ED_MERGE_SELECTED_CELLS
|
||||
} ED_MergeType;
|
||||
|
||||
/* Used with EDT_ChangeTableSelection to tell if we should move
|
||||
* to next Cell, Row, or Columns along with changing the selected cells
|
||||
*/
|
||||
typedef enum {
|
||||
ED_MOVE_NONE,
|
||||
ED_MOVE_PREV,
|
||||
ED_MOVE_NEXT
|
||||
} ED_MoveSelType;
|
||||
|
||||
/*--------------------------- HREF --------------------------------*/
|
||||
|
||||
struct _EDT_HREFData {
|
||||
char *pURL;
|
||||
char *pExtra;
|
||||
};
|
||||
|
||||
typedef struct _EDT_HREFData EDT_HREFData;
|
||||
|
||||
/*--------------------------- Image --------------------------------*/
|
||||
|
||||
struct _EDT_ImageData {
|
||||
XP_Bool bIsMap;
|
||||
/* char *pUseMap; created with XP_ALLOC() Now in pExtra, hardts */
|
||||
ED_Alignment align;
|
||||
char *pSrc;
|
||||
char *pLowSrc;
|
||||
char *pName;
|
||||
char *pAlt;
|
||||
int32 iWidth;
|
||||
int32 iHeight;
|
||||
XP_Bool bWidthPercent; /* Range: 1 - 100 if TRUE, else = pixels (default) */
|
||||
XP_Bool bHeightPercent;
|
||||
int32 iHSpace;
|
||||
int32 iVSpace;
|
||||
int32 iBorder;
|
||||
/* Added hardts */
|
||||
XP_Bool bNoSave;
|
||||
/* Added by CLM: */
|
||||
int32 iOriginalWidth; /* Width and Height we got on initial loading */
|
||||
int32 iOriginalHeight;
|
||||
EDT_HREFData *pHREFData;
|
||||
char *pExtra;
|
||||
};
|
||||
|
||||
typedef struct _EDT_ImageData EDT_ImageData;
|
||||
|
||||
/*--------------------------- Target --------------------------------*/
|
||||
|
||||
struct _EDT_TargetData {
|
||||
char *pName;
|
||||
char *pExtra;
|
||||
};
|
||||
|
||||
typedef struct _EDT_TargetData EDT_TargetData;
|
||||
|
||||
/*--------------------------- Character --------------------------------*/
|
||||
#define ED_FONT_POINT_SIZE_DEFAULT 0
|
||||
#define ED_FONT_POINT_SIZE_MIN 1
|
||||
#define ED_FONT_POINT_SIZE_MAX 1000
|
||||
|
||||
#define ED_FONT_WEIGHT_MIN 100
|
||||
#define ED_FONT_WEIGHT_NORMAL 400
|
||||
#define ED_FONT_WEIGHT_BOLD 700
|
||||
#define ED_FONT_WEIGHT_MAX 900
|
||||
|
||||
enum {
|
||||
ED_FONT_VARIABLE,
|
||||
ED_FONT_FIXED,
|
||||
ED_FONT_LOCAL
|
||||
};
|
||||
|
||||
struct _EDT_CharacterData {
|
||||
ED_TextFormat mask; /* bits to set or get */
|
||||
ED_TextFormat values; /* values of the bits in the mask */
|
||||
LO_Color *pColor; /* color if mask bit is set */
|
||||
int32 iSize; /* size if mask bit is set */
|
||||
EDT_HREFData *pHREFData; /* href if mask bit is set */
|
||||
ED_LinkId linkId; /* internal use only */
|
||||
char* pFontFace; /* FontFace name */
|
||||
int16 iWeight; /* font weight range = 100-900, 400=Normal, 700=Bold*/
|
||||
int16 iPointSize; /* not sure what default is! Use 0 to mean "default" */
|
||||
};
|
||||
|
||||
typedef struct _EDT_CharacterData EDT_CharacterData;
|
||||
|
||||
/*--------------------------- Horizonal Rule --------------------------------*/
|
||||
|
||||
struct _EDT_HorizRuleData {
|
||||
ED_Alignment align; /* only allows left and right alignment */
|
||||
int32 size; /* value 1 to 100 indicates line thickness */
|
||||
int32 iWidth; /* CM: default = 100% */
|
||||
XP_Bool bWidthPercent; /* Range: 1 - 100 if TRUE(default), else = pixels */
|
||||
XP_Bool bNoShade;
|
||||
char *pExtra;
|
||||
};
|
||||
|
||||
typedef struct _EDT_HorizRuleData EDT_HorizRuleData;
|
||||
|
||||
/*--------------------------- ContainerData --------------------------------*/
|
||||
|
||||
struct _EDT_ContainerData {
|
||||
ED_Alignment align; /* only allows left and right alignment */
|
||||
char *pExtra;
|
||||
};
|
||||
|
||||
typedef struct _EDT_ContainerData EDT_ContainerData;
|
||||
|
||||
/*--------------------------- TableData --------------------------------*/
|
||||
|
||||
struct _EDT_TableData {
|
||||
ED_Alignment align; /* ED_ALIGN_LEFT, ED_ALIGN_ABSCENTER, ED_ALIGN_RIGHT */
|
||||
ED_Alignment malign; /* margin alignment: ED_ALIGN_DEFAULT, ED_ALIGN_LEFT, ED_ALIGN_RIGHT */
|
||||
XP_Bool bUseCols; /* TRUE means COLS= will be output, which speeds up layout in 4.0 */
|
||||
int32 iRows;
|
||||
int32 iColumns;
|
||||
XP_Bool bBorderWidthDefined;
|
||||
int32 iBorderWidth;
|
||||
int32 iCellSpacing;
|
||||
int32 iCellPadding;
|
||||
int32 iInterCellSpace;
|
||||
XP_Bool bWidthDefined;
|
||||
XP_Bool bWidthPercent;
|
||||
int32 iWidth;
|
||||
int32 iWidthPixels;
|
||||
XP_Bool bHeightDefined;
|
||||
XP_Bool bHeightPercent;
|
||||
int32 iHeight;
|
||||
int32 iHeightPixels;
|
||||
LO_Color *pColorBackground; /* null in the default case */
|
||||
char *pBackgroundImage; /* null in the default case */
|
||||
XP_Bool bBackgroundNoSave;
|
||||
char *pExtra;
|
||||
};
|
||||
|
||||
typedef struct _EDT_TableData EDT_TableData;
|
||||
|
||||
/* iTableMode param for SetTableMode() */
|
||||
#define ED_TABLE_PERCENT 0x0001 /* Convert table and all cells to use % of parent width */
|
||||
#define ED_TABLE_PIXELS 0x0002 /* Convert table and all cells to use absolute pixels */
|
||||
#define ED_TABLE_USE_CELL_WIDTH 0x0004 /* Set WIDTH param for all cells (facilitates table resizing) */
|
||||
#define ED_TABLE_NO_CELL_WIDTH 0x0008 /* Remove WIDTH param for all cells */
|
||||
#define ED_TABLE_USE_COLS 0x0010 /* Set COLS param for table (use only 1st row for column widths) */
|
||||
#define ED_TABLE_NO_COLS 0x0020 /* Remove COLS param for table (all cell widths used) */
|
||||
|
||||
/*--------------------------- TableCaptionData --------------------------------*/
|
||||
|
||||
struct _EDT_TableCaptionData {
|
||||
ED_Alignment align;
|
||||
char *pExtra;
|
||||
};
|
||||
|
||||
typedef struct _EDT_TableCaptionData EDT_TableCaptionData;
|
||||
|
||||
/*--------------------------- TableRowData --------------------------------*/
|
||||
|
||||
struct _EDT_TableRowData {
|
||||
ED_Alignment align;
|
||||
ED_Alignment valign;
|
||||
LO_Color *pColorBackground; /* null in the default case */
|
||||
char *pBackgroundImage; /* null in the default case */
|
||||
XP_Bool bBackgroundNoSave;
|
||||
char *pExtra;
|
||||
};
|
||||
|
||||
typedef struct _EDT_TableRowData EDT_TableRowData;
|
||||
|
||||
/*--------------------------- TableCellData --------------------------------*/
|
||||
|
||||
struct _EDT_TableCellData {
|
||||
ED_CellFormat mask; /* bits to tell us what we know for all cells */
|
||||
ED_HitType iSelectionType; /* Either: ED_HIT_SEL_CELL, ED_HIT_SEL_COL, ED_HIT_SEL_ROW, or ED_HIT_NONE */
|
||||
intn iSelectedCount; /* Number of cells selected. Usually >= 1 */
|
||||
ED_Alignment align;
|
||||
ED_Alignment valign;
|
||||
int32 iColSpan;
|
||||
int32 iRowSpan;
|
||||
XP_Bool bHeader; /* TRUE == th, FALSE == td */
|
||||
XP_Bool bNoWrap;
|
||||
int32 X;
|
||||
int32 Y;
|
||||
intn iRow;
|
||||
XP_Bool bWidthDefined;
|
||||
XP_Bool bWidthPercent;
|
||||
int32 iWidth;
|
||||
int32 iWidthPixels;
|
||||
XP_Bool bHeightDefined;
|
||||
XP_Bool bHeightPercent;
|
||||
int32 iHeight;
|
||||
int32 iHeightPixels;
|
||||
LO_Color *pColorBackground; /* null in the default case */
|
||||
char *pBackgroundImage; /* null in the default case */
|
||||
XP_Bool bBackgroundNoSave;
|
||||
char *pExtra;
|
||||
};
|
||||
|
||||
typedef struct _EDT_TableCellData EDT_TableCellData;
|
||||
|
||||
/*--------------------------- LayerData --------------------------------*/
|
||||
|
||||
struct _EDT_LayerData {
|
||||
char *pExtra;
|
||||
};
|
||||
|
||||
typedef struct _EDT_LayerData EDT_LayerData;
|
||||
|
||||
/*--------------------------- DivisionData --------------------------------*/
|
||||
|
||||
struct _EDT_DivisionData {
|
||||
ED_Alignment align;
|
||||
char *pExtra;
|
||||
};
|
||||
|
||||
typedef struct _EDT_DivisionData EDT_DivisionData;
|
||||
|
||||
/*--------------------------- Page Properties --------------------------------*/
|
||||
struct _EDT_MetaData {
|
||||
XP_Bool bHttpEquiv; /* true, http-equiv="fdsfds", false name="fdsfds" */
|
||||
char *pName; /* http-equiv's or name's value */
|
||||
char *pContent;
|
||||
};
|
||||
|
||||
typedef struct _EDT_MetaData EDT_MetaData;
|
||||
|
||||
struct _EDT_PageData {
|
||||
LO_Color *pColorBackground; /* null in the default case */
|
||||
LO_Color *pColorLink;
|
||||
LO_Color *pColorText;
|
||||
LO_Color *pColorFollowedLink;
|
||||
LO_Color *pColorActiveLink;
|
||||
char *pBackgroundImage;
|
||||
XP_Bool bBackgroundNoSave;
|
||||
char *pFontDefURL; /* For Web Fonts. */
|
||||
XP_Bool bFontDefNoSave;
|
||||
char *pTitle;
|
||||
XP_Bool bKeepImagesWithDoc;
|
||||
};
|
||||
|
||||
typedef struct _EDT_PageData EDT_PageData;
|
||||
|
||||
typedef enum {
|
||||
ED_COLOR_BACKGROUND,
|
||||
ED_COLOR_LINK,
|
||||
ED_COLOR_TEXT,
|
||||
ED_COLOR_FOLLOWED_LINK
|
||||
} ED_EColor;
|
||||
|
||||
/*
|
||||
* CLM: Java and PlugIn data structures
|
||||
*/
|
||||
struct _EDT_ParamData {
|
||||
char *pName;
|
||||
char *pValue;
|
||||
};
|
||||
typedef struct _EDT_ParamData EDT_ParamData;
|
||||
|
||||
typedef int32 EDT_ParamID;
|
||||
|
||||
struct _EDT_PlugInData {
|
||||
EDT_ParamID ParamID; /* Identifies which Param list is associated */
|
||||
char *pSrc;
|
||||
XP_Bool bHidden;
|
||||
ED_Alignment align;
|
||||
int32 iWidth;
|
||||
int32 iHeight;
|
||||
XP_Bool bWidthPercent; /* Range: 1 - 100 if TRUE, else = pixels default) */
|
||||
XP_Bool bHeightPercent;
|
||||
XP_Bool bForegroundPalette; /* PC systems only. For controling 256-color palette wars */
|
||||
int32 iHSpace;
|
||||
int32 iVSpace;
|
||||
int32 iBorder;
|
||||
};
|
||||
typedef struct _EDT_PlugInData EDT_PlugInData;
|
||||
|
||||
struct _EDT_JavaData {
|
||||
EDT_ParamID ParamID;
|
||||
char *pCode;
|
||||
char *pCodebase;
|
||||
char *pName;
|
||||
ED_Alignment align;
|
||||
char *pSrc;
|
||||
int32 iWidth;
|
||||
int32 iHeight;
|
||||
XP_Bool bWidthPercent; /* Range: 1 - 100 if TRUE, else = pixels default) */
|
||||
XP_Bool bHeightPercent;
|
||||
int32 iHSpace;
|
||||
int32 iVSpace;
|
||||
int32 iBorder;
|
||||
};
|
||||
typedef struct _EDT_JavaData EDT_JavaData;
|
||||
|
||||
/* CLM: Error codes for file writing
|
||||
* Return 0 if no error
|
||||
*/
|
||||
typedef enum {
|
||||
ED_ERROR_NONE,
|
||||
ED_ERROR_READ_ONLY, /* File is marked read-only */
|
||||
ED_ERROR_BLOCKED, /* Can't write at this time, edit buffer blocked */
|
||||
ED_ERROR_BAD_URL, /* URL was not a "file:" type or no string */
|
||||
ED_ERROR_FILE_OPEN,
|
||||
ED_ERROR_FILE_WRITE,
|
||||
ED_ERROR_CREATE_BAKNAME,
|
||||
ED_ERROR_DELETE_BAKFILE,
|
||||
ED_ERROR_FILE_RENAME_TO_BAK,
|
||||
ED_ERROR_CANCEL,
|
||||
ED_ERROR_FILE_EXISTS, /* We really didn't save -- file existed and no overwrite */
|
||||
ED_ERROR_SRC_NOT_FOUND,
|
||||
ED_ERROR_FILE_READ,
|
||||
|
||||
/* The following are used internally by the editor and will not be passed to the front end. */
|
||||
ED_ERROR_PUBLISHING, /* When netlib encounters an error http or ftp publishing. */
|
||||
ED_ERROR_TAPEFS_COMPLETION /* The tape file system for saving encountered an error when
|
||||
the Complete() method was called. E.g. an error sending a
|
||||
mail message. */
|
||||
} ED_FileError;
|
||||
|
||||
typedef enum {
|
||||
ED_TAG_OK,
|
||||
ED_TAG_UNOPENED,
|
||||
ED_TAG_UNCLOSED,
|
||||
ED_TAG_UNTERMINATED_STRING,
|
||||
ED_TAG_PREMATURE_CLOSE,
|
||||
ED_TAG_TAGNAME_EXPECTED
|
||||
} ED_TagValidateResult;
|
||||
|
||||
typedef enum {
|
||||
ED_LIST_TYPE_DEFAULT,
|
||||
ED_LIST_TYPE_DIGIT,
|
||||
ED_LIST_TYPE_BIG_ROMAN,
|
||||
ED_LIST_TYPE_SMALL_ROMAN,
|
||||
ED_LIST_TYPE_BIG_LETTERS,
|
||||
ED_LIST_TYPE_SMALL_LETTERS,
|
||||
ED_LIST_TYPE_CIRCLE,
|
||||
ED_LIST_TYPE_SQUARE,
|
||||
ED_LIST_TYPE_DISC,
|
||||
ED_LIST_TYPE_CITE /* For Mail Quoting */
|
||||
} ED_ListType;
|
||||
|
||||
|
||||
struct _EDT_ListData {
|
||||
/* This should be TagType, but there are problems with the include file dependencies. */
|
||||
int8 iTagType; /* P_UNUM_LIST, P_NUM_LIST, P_BLOCKQUOTE, */
|
||||
/* P_DIRECTOR, P_MENU, P_DESC_LIST */
|
||||
XP_Bool bCompact;
|
||||
ED_ListType eType;
|
||||
int32 iStart; /* automatically maps, start is one */
|
||||
char *pBaseURL; /* If an ED_LIST_TYPE_CITE, this is the URL from the enclosing <BASE> tag.
|
||||
Don't expose this to users because not actually written out in the HTML. */
|
||||
char *pExtra;
|
||||
};
|
||||
|
||||
typedef struct _EDT_ListData EDT_ListData;
|
||||
|
||||
typedef enum {
|
||||
ED_BREAK_NORMAL, /* just break the line, ignore images */
|
||||
ED_BREAK_LEFT, /* break so it passes the image on the left */
|
||||
ED_BREAK_RIGHT, /* break past the right image */
|
||||
ED_BREAK_BOTH /* break past both images */
|
||||
} ED_BreakType;
|
||||
|
||||
typedef enum {
|
||||
ED_SAVE_OVERWRITE_THIS,
|
||||
ED_SAVE_OVERWRITE_ALL,
|
||||
ED_SAVE_DONT_OVERWRITE_THIS,
|
||||
ED_SAVE_DONT_OVERWRITE_ALL,
|
||||
ED_SAVE_CANCEL
|
||||
} ED_SaveOption;
|
||||
|
||||
/* After saving, what to do with the editor buffer. */
|
||||
typedef enum {
|
||||
ED_FINISHED_GOTO_NEW, /* Point the editor to the location of the
|
||||
newly saved document. */
|
||||
ED_FINISHED_REVERT_BUFFER, /* Revert the buffer to the state before
|
||||
the save operation began. */
|
||||
ED_FINISHED_SAVE_DRAFT, /* Like ED_FINISHED_REVERT_BUFFER, except clears the dirty flag
|
||||
on success. */
|
||||
ED_FINISHED_MAIL_SEND /* If we succeed we're going to throw the buffer
|
||||
away, so don't revert it. If failure, revert the buffer.
|
||||
Used for mail compose, we don't
|
||||
want the editor to start any operation that
|
||||
causes problems when libmsg destroys the editor
|
||||
context. */
|
||||
} ED_SaveFinishedOption;
|
||||
|
||||
|
||||
/* For FE_SaveDialogCreate */
|
||||
typedef enum {
|
||||
ED_SAVE_DLG_SAVE_LOCAL, /* "saving files to local disk" */
|
||||
ED_SAVE_DLG_PUBLISH, /* "uploading files to remote server" */
|
||||
ED_SAVE_DLG_PREPARE_PUBLISH /* "preparing files to publish" */
|
||||
} ED_SaveDialogType;
|
||||
|
||||
typedef int32 EDT_ClipboardResult;
|
||||
#define EDT_COP_OK 0
|
||||
#define EDT_COP_DOCUMENT_BUSY 1
|
||||
#define EDT_COP_SELECTION_EMPTY 2
|
||||
#define EDT_COP_SELECTION_CROSSES_TABLE_DATA_CELL 3
|
||||
/* For the result EDT_COP_CLIPBOARD_BAD the XP code has already
|
||||
* given the user an error dialog. So FE code should not
|
||||
* give an additional error dialog. (Only occurs on
|
||||
* paste and paste-like operations.)
|
||||
*/
|
||||
#define EDT_COP_CLIPBOARD_BAD 4
|
||||
|
||||
|
||||
#ifdef FIND_REPLACE
|
||||
|
||||
#define ED_FIND_FIND_ALL_WORDS 1 /* used to enumerate all words in a */
|
||||
/* buffer */
|
||||
#define ED_FIND_MATCH_CASE 2 /* default is to ignore case */
|
||||
#define ED_FIND_REPLACE 4 /* call back the replace routine */
|
||||
#define ED_FIND_WHOLE_BUFFER 8 /* start search from the top */
|
||||
#define ED_FIND_REVERSE 0x10 /* reverse search from this point */
|
||||
|
||||
typedef intn ED_FindFlags;
|
||||
|
||||
typedef void (*EDT_PFReplaceFunc)( void *pMWContext,
|
||||
char *pFoundWord,
|
||||
char **pReplaceWord );
|
||||
|
||||
struct _EDT_FindAndReplaceData {
|
||||
char* pSearchString;
|
||||
ED_FindFlags fflags;
|
||||
EDT_PFReplaceFunc pfReplace;
|
||||
};
|
||||
|
||||
typedef struct _EDT_FindAndReplaceData EDT_FindAndReplaceData;
|
||||
|
||||
#endif /* FIND_REPLACE */
|
||||
|
||||
/* Callback function for image encoder */
|
||||
|
||||
typedef int32 EDT_ImageEncoderReference;
|
||||
typedef unsigned char EDT_ImageEncoderStatus;
|
||||
#define ED_IMAGE_ENCODER_OK 0
|
||||
#define ED_IMAGE_ENCODER_USER_CANCELED 1
|
||||
#define ED_IMAGE_ENCODER_EXCEPTION 2
|
||||
|
||||
typedef void (*EDT_ImageEncoderCallbackFn)(EDT_ImageEncoderStatus status, void* hook);
|
||||
|
||||
#endif
|
||||
1274
mozilla/include/fe_proto.h
Normal file
1274
mozilla/include/fe_proto.h
Normal file
File diff suppressed because it is too large
Load Diff
133
mozilla/include/fe_rgn.h
Normal file
133
mozilla/include/fe_rgn.h
Normal file
@@ -0,0 +1,133 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
|
||||
/* Region-related definitions and prototypes */
|
||||
|
||||
#ifndef _FE_RGN_H_
|
||||
#define _FE_RGN_H_
|
||||
|
||||
#ifdef LAYERS
|
||||
|
||||
#include "xp_core.h"
|
||||
#include "xp_rect.h"
|
||||
/******************Definitions and Types************/
|
||||
|
||||
/* For Windows only: Should we use the MFC CRgn class for region stuff? */
|
||||
#ifdef XP_WIN
|
||||
#undef FE_RGN_USE_MFC
|
||||
#endif /* XP_WIN */
|
||||
|
||||
#ifdef XP_WIN
|
||||
|
||||
#ifdef FE_RGN_USE_MFC
|
||||
#define FE_GetMDRegion(rgn) ((CRgn *)rgn)
|
||||
#else
|
||||
/*
|
||||
* Note that the resultant CRgn * does not have to be
|
||||
* explicitly deleted. It is considered a temporary object
|
||||
* by the MFC and is deleted the next time we have idle
|
||||
* time in the event loop.
|
||||
*/
|
||||
#define FE_GetMDRegion(rgn) ((HRGN)rgn)
|
||||
#endif /* FE_RGN_USE_MFC */
|
||||
|
||||
#elif defined(XP_UNIX)
|
||||
#define FE_GetMDRegion(rgn) ((Region)rgn)
|
||||
#elif defined(XP_MAC)
|
||||
#define FE_GetMDRegion(rgn) ((RgnHandle)rgn)
|
||||
#else
|
||||
#define FE_GetMDRegion(rgn) (rgn)
|
||||
#endif /* XP_WIN */
|
||||
|
||||
#ifdef XP_WIN
|
||||
#define FE_MAX_REGION_COORDINATE 0x7FFFFFFF
|
||||
#else
|
||||
#define FE_MAX_REGION_COORDINATE 0x7FFF
|
||||
#endif
|
||||
|
||||
/* Setting the clip region to this effectively unsets the clip */
|
||||
#define FE_NULL_REGION NULL
|
||||
|
||||
#define FE_CLEAR_REGION(region) \
|
||||
do {FE_SubtractRegion((region), (region), (region)); } while (0)
|
||||
|
||||
/* Function called by FE_ForEachRectInRegion */
|
||||
typedef void (*FE_RectInRegionFunc)(void *closure, XP_Rect *rect);
|
||||
|
||||
/*******************Prototypes**********************/
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
extern FE_Region FE_CreateRegion(void);
|
||||
|
||||
/* Creates a region from a rectangle. Returns */
|
||||
/* NULL if region can't be created. */
|
||||
extern FE_Region FE_CreateRectRegion(XP_Rect *rect);
|
||||
|
||||
/* Destroys region. */
|
||||
extern void FE_DestroyRegion(FE_Region region);
|
||||
|
||||
/* Makes a copy of a region. If dst is NULL, creates a new region */
|
||||
extern FE_Region FE_CopyRegion(FE_Region src, FE_Region dst);
|
||||
|
||||
/* Set an existing region to a rectangle */
|
||||
extern FE_Region FE_SetRectRegion(FE_Region region, XP_Rect *rect);
|
||||
|
||||
/* dst = src1 intersect sr2 */
|
||||
/* dst can be one of src1 or src2 */
|
||||
extern void FE_IntersectRegion(FE_Region src1, FE_Region src2, FE_Region dst);
|
||||
|
||||
/* dst = src1 union src2 */
|
||||
/* dst can be one of src1 or src2 */
|
||||
extern void FE_UnionRegion(FE_Region src1, FE_Region src2, FE_Region dst);
|
||||
|
||||
/* dst = src1 - src2 */
|
||||
/* dst can be one of src1 or src2 */
|
||||
extern void FE_SubtractRegion(FE_Region src1, FE_Region src2, FE_Region dst);
|
||||
|
||||
/* Returns TRUE if the region contains no pixels */
|
||||
extern XP_Bool FE_IsEmptyRegion(FE_Region region);
|
||||
|
||||
/* Returns the bounding rectangle of the region */
|
||||
extern void FE_GetRegionBoundingBox(FE_Region region, XP_Rect *bbox);
|
||||
|
||||
/* TRUE if rgn1 == rgn2 */
|
||||
extern XP_Bool FE_IsEqualRegion(FE_Region rgn1, FE_Region rgn2);
|
||||
|
||||
/* Moves a region by the specified offsets */
|
||||
extern void FE_OffsetRegion(FE_Region region, int32 xOffset, int32 yOffset);
|
||||
|
||||
/* Is any part of the rectangle in the specified region */
|
||||
extern XP_Bool FE_RectInRegion(FE_Region region, XP_Rect *rect);
|
||||
|
||||
/* For each rectangle that makes up this region, call the func */
|
||||
extern void FE_ForEachRectInRegion(FE_Region region,
|
||||
FE_RectInRegionFunc func,
|
||||
void * closure);
|
||||
|
||||
#ifdef DEBUG
|
||||
extern void FE_HighlightRect(void *context, XP_Rect *rect, int how_much);
|
||||
extern void FE_HighlightRegion(void *context, FE_Region region, int how_much);
|
||||
#endif /* DEBUG */
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* LAYERS */
|
||||
|
||||
#endif /* _FE_RGN_H_ */
|
||||
222
mozilla/include/fullsoft.h
Normal file
222
mozilla/include/fullsoft.h
Normal file
@@ -0,0 +1,222 @@
|
||||
/*--------------------------------------------------------------------
|
||||
* fullsoft.h
|
||||
*
|
||||
* Created: 10/15/97
|
||||
* Author: Matt Kendall
|
||||
*
|
||||
* Copyright (C) 1997-98, Full Circle Software, Inc., All Rights Reserved
|
||||
*
|
||||
* Full Circle "Spiral" Application API Definition
|
||||
* - mkk 1/19/98 renamed from "spiral.h" to "fullsoft.h"
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
#if !defined(__FULLSOFT_H)
|
||||
#define __FULLSOFT_H
|
||||
|
||||
/* define NO_FC_API to disable all calls to the Full Circle library */
|
||||
/* define FC_TRACE to enable the Full Circle TRACE macro */
|
||||
/* define FC_ASSERT to enable the Full Circle ASSERT macro */
|
||||
/* define FC_TRACE_PARAM to enable the Full Circle TRACE_PARAM macro */
|
||||
/* define FC_ASSERT_PARAM to enable the Full Circle TRACE_PARAM macro */
|
||||
|
||||
#if !defined(FAR)
|
||||
#define FAR
|
||||
#endif /* !FAR */
|
||||
|
||||
#if !defined(FCAPI)
|
||||
#define FCAPI
|
||||
#endif /* defined FCAPI */
|
||||
|
||||
|
||||
typedef const char FAR * FC_KEY ;
|
||||
typedef const char FAR * FC_TRIGGER ;
|
||||
typedef unsigned long FC_DATE ;
|
||||
typedef unsigned long FC_UINT32 ;
|
||||
typedef void FAR * FC_PVOID ;
|
||||
typedef const char FAR * FC_STRING ;
|
||||
typedef void FAR * FC_CONTEXT ;
|
||||
|
||||
#define FC_CONTEXT_NONE ((FC_CONTEXT) -1)
|
||||
|
||||
typedef enum {
|
||||
FC_DATA_TYPE_BINARY,
|
||||
FC_DATA_TYPE_STRING,
|
||||
FC_DATA_TYPE_INTEGER,
|
||||
FC_DATA_TYPE_DATE,
|
||||
FC_DATA_TYPE_COUNTER
|
||||
} FC_DATA_TYPE ;
|
||||
|
||||
typedef enum {
|
||||
FC_ERROR_OK = 0,
|
||||
FC_ERROR_CANT_INITIALIZE,
|
||||
FC_ERROR_NOT_INITIALIZED,
|
||||
FC_ERROR_ALREADY_INITIALIZED,
|
||||
FC_ERROR_FAILED,
|
||||
FC_ERROR_OUT_OF_MEMORY,
|
||||
FC_ERROR_INVALID_PARAMETER
|
||||
} FC_ERROR ;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* define NO_FC_API to disable all calls to the Full Circle library */
|
||||
|
||||
#if !defined(NO_FC_API)
|
||||
|
||||
FC_ERROR FCAPI
|
||||
FCInitialize( void ) ;
|
||||
|
||||
FC_ERROR FCAPI
|
||||
FCCreateKey(
|
||||
FC_KEY key,
|
||||
FC_DATA_TYPE type,
|
||||
FC_UINT32 first_count,
|
||||
FC_UINT32 last_count,
|
||||
FC_UINT32 max_element_size) ;
|
||||
|
||||
FC_ERROR FCAPI
|
||||
FCCreatePersistentKey(
|
||||
FC_KEY key,
|
||||
FC_DATA_TYPE type,
|
||||
FC_UINT32 first_count,
|
||||
FC_UINT32 last_count,
|
||||
FC_UINT32 max_element_size) ;
|
||||
|
||||
FC_ERROR FCAPI
|
||||
FCAddDataToKey(
|
||||
FC_KEY key,
|
||||
FC_PVOID buffer,
|
||||
FC_UINT32 data_length) ;
|
||||
|
||||
FC_ERROR FCAPI
|
||||
FCAddIntToKey(
|
||||
FC_KEY key,
|
||||
FC_UINT32 data) ;
|
||||
|
||||
FC_ERROR FCAPI
|
||||
FCAddStringToKey(
|
||||
FC_KEY key,
|
||||
FC_STRING string) ;
|
||||
|
||||
FC_ERROR FCAPI
|
||||
FCAddDateToKey(
|
||||
FC_KEY key,
|
||||
FC_DATE date) ;
|
||||
|
||||
FC_ERROR FCAPI
|
||||
FCSetCounter(
|
||||
FC_KEY key,
|
||||
FC_UINT32 value) ;
|
||||
|
||||
FC_ERROR FCAPI
|
||||
FCIncrementCounter(
|
||||
FC_KEY key,
|
||||
FC_UINT32 value) ;
|
||||
|
||||
FC_ERROR FCAPI
|
||||
FCRegisterMemory(
|
||||
FC_KEY key,
|
||||
FC_DATA_TYPE type,
|
||||
FC_PVOID buffer,
|
||||
FC_UINT32 length,
|
||||
FC_UINT32 dereference_count,
|
||||
FC_CONTEXT context) ;
|
||||
|
||||
FC_ERROR FCAPI
|
||||
FCUnregisterMemory( FC_CONTEXT context ) ;
|
||||
|
||||
FC_ERROR FCAPI
|
||||
FCTrigger( FC_TRIGGER trigger ) ;
|
||||
|
||||
void FCAPI
|
||||
FCTrace(FC_STRING fmt, ... ) ;
|
||||
|
||||
void FCAPI
|
||||
FCAssert() ;
|
||||
|
||||
void FCAPI
|
||||
FCTraceParam(
|
||||
FC_UINT32 track,
|
||||
FC_UINT32 level,
|
||||
FC_STRING fmt,
|
||||
... ) ;
|
||||
|
||||
void FCAPI
|
||||
FCAssertParam(
|
||||
FC_UINT32 track,
|
||||
FC_UINT32 level ) ;
|
||||
|
||||
#if defined(FC_ASSERT)
|
||||
#if defined(ASSERT)
|
||||
#undef ASSERT
|
||||
#endif /* defined ASSERT */
|
||||
#define ASSERT(a) { if( !(a) ) FCAssert() ; }
|
||||
#endif /* FC_ASSERT */
|
||||
|
||||
#if defined(FC_TRACE)
|
||||
#if defined(TRACE)
|
||||
#undef TRACE
|
||||
#endif /* defined TRACE */
|
||||
#define TRACE FCTrace
|
||||
#endif /* FC_TRACE */
|
||||
|
||||
#if defined(FC_ASSERT_PARAM)
|
||||
#if defined(ASSERT_PARAM)
|
||||
#undef ASSERT_PARAM
|
||||
#endif /* defined ASSERT_PARAM */
|
||||
#define ASSERT_PARAM(a,b,c) { if ( !(c) ) FCAssertParam(a,b) ; }
|
||||
#endif /* FC_ASSERT_PARAM */
|
||||
|
||||
#if defined(FC_TRACE_PARAM)
|
||||
#if defined(TRACE_PARAM)
|
||||
#undef TRACE_PARAM
|
||||
#endif /* defined TRACE_PARAM */
|
||||
#define TRACE_PARAM FCTraceParam
|
||||
#endif /* FC_TRACE_PARAM */
|
||||
|
||||
#else /* NO_FC_API */
|
||||
|
||||
#define FCInitialize() FC_ERROR_OK
|
||||
#define FCCreateKey(a,b,c,d,e) FC_ERROR_OK
|
||||
#define FCCreatePersistentKey(a,b,c,d,e) FC_ERROR_OK
|
||||
#define FCAddDataToKey(a,b,c) FC_ERROR_OK
|
||||
#define FCAddIntToKey(a,b) FC_ERROR_OK
|
||||
#define FCAddStringToKey(a,b) FC_ERROR_OK
|
||||
#define FCAddDateToKey(a,b) FC_ERROR_OK
|
||||
#define FCRegisterMemory(a,b,c,d,e,f) FC_ERROR_OK
|
||||
#define FCUnregisterMemory(a) FC_ERROR_OK
|
||||
#define FCTrigger(a) FC_ERROR_OK
|
||||
#define FCSetCounter(a,b) FC_ERROR_OK
|
||||
#define FCIncrementCounter(a,b) FC_ERROR_OK
|
||||
|
||||
#if defined(FC_ASSERT)
|
||||
#define ASSERT(f) ((void)0)
|
||||
#endif /* FC_ASSERT */
|
||||
|
||||
#if defined(FC_TRACE)
|
||||
void FCAPI FCTrace(FC_STRING fmt,...) ;
|
||||
#define TRACE 1 ? (void)0 : FCTrace
|
||||
#endif /* FC_TRACE */
|
||||
|
||||
#if defined(FC_ASSERT_PARAM)
|
||||
#define ASSERT_PARAM(a,b,c) ((void)0)
|
||||
#endif /* FC_ASSERT_PARAM */
|
||||
|
||||
#if defined(FC_TRACE_PARAM)
|
||||
void FCAPI FCTraceParam(
|
||||
FC_UINT32 track,
|
||||
FC_UINT32 level,
|
||||
FC_STRING fmt,
|
||||
... ) ;
|
||||
|
||||
#define TRACE_PARAM 1 ? (void) 0 : FCTraceParam
|
||||
#endif /* FC_TRACE_PARAM */
|
||||
|
||||
#endif /* NO_FC_API */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __FULLSOFT_H */
|
||||
231
mozilla/include/garray.h
Normal file
231
mozilla/include/garray.h
Normal file
@@ -0,0 +1,231 @@
|
||||
/* -*- Mode: C; tab-width: 8; 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.
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// Warning: This is a C++ file.
|
||||
//
|
||||
//
|
||||
// This implements cross platform Growable arrays of Pointers.
|
||||
//
|
||||
#ifndef _GARRAY_H_
|
||||
#define _GARRAY_H_
|
||||
|
||||
//
|
||||
// On Unix (well at least Solaris) we are having troubles with
|
||||
// templates, so hey, we won't use them...djw.
|
||||
//
|
||||
// On Mac we are having troubles as well, so add me to the list.
|
||||
// Now, why even have templates?...jar
|
||||
//
|
||||
#if ! ( defined(XP_WIN16) || defined(XP_UNIX) || defined(XP_MAC) )
|
||||
#define TEMPLATE_SUPPORT 1
|
||||
#endif
|
||||
|
||||
|
||||
class CXP_GrowableArray {
|
||||
protected:
|
||||
void **m_pData;
|
||||
int m_iSize;
|
||||
int m_iAllocSize;
|
||||
|
||||
int NewSize( int iMinSize){
|
||||
int iNewSize = MAX( m_iAllocSize,16) ;
|
||||
while( iNewSize < iMinSize ){
|
||||
iNewSize = iNewSize+iNewSize;
|
||||
}
|
||||
return iNewSize;
|
||||
}
|
||||
|
||||
//
|
||||
// this is the routine that does the actual work. Should be in
|
||||
// its own file.
|
||||
//
|
||||
void GuaranteeSize(int iSize){
|
||||
if(m_iAllocSize <= iSize){
|
||||
int iNewSize = NewSize( iSize );
|
||||
if( m_iAllocSize ){
|
||||
void ** pNewData = new void*[iNewSize];
|
||||
XP_BCOPY( m_pData, pNewData, m_iAllocSize * sizeof(void*) );
|
||||
delete [] m_pData;
|
||||
m_pData = pNewData;
|
||||
}
|
||||
else{
|
||||
m_pData = new void*[iNewSize];
|
||||
}
|
||||
m_iAllocSize = iNewSize;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
CXP_GrowableArray(int iStartSize=0): m_pData(0),m_iSize(0),m_iAllocSize(0){
|
||||
if( iStartSize ){
|
||||
GuaranteeSize( iStartSize );
|
||||
}
|
||||
};
|
||||
|
||||
~CXP_GrowableArray(){ delete [] m_pData; }
|
||||
|
||||
int Size(){ return m_iSize; }
|
||||
|
||||
void SetSize( int iSize ){
|
||||
GuaranteeSize( iSize );
|
||||
m_iSize = iSize;
|
||||
}
|
||||
|
||||
void* operator[](int nIndex) const { return m_pData[nIndex]; }
|
||||
void*& operator[](int nIndex){ return m_pData[nIndex]; }
|
||||
|
||||
int Add(void* newElement){
|
||||
GuaranteeSize(m_iSize+1);
|
||||
m_pData[m_iSize] = newElement;
|
||||
/* Return index to last item in list */
|
||||
return m_iSize++;
|
||||
}
|
||||
|
||||
int Delete( int nIndex ){
|
||||
if( nIndex < m_iSize )
|
||||
{
|
||||
for( int i = nIndex; i < m_iSize-1; i++ )
|
||||
{
|
||||
/* Suffle remaining pointers down */
|
||||
m_pData[nIndex] = m_pData[nIndex+1];
|
||||
}
|
||||
m_iSize--;
|
||||
}
|
||||
/* Return index to last item in list */
|
||||
return (m_iSize-1);
|
||||
}
|
||||
|
||||
int Delete( void* element ){
|
||||
for( int i = 0; i < m_iSize; i++ )
|
||||
{
|
||||
if( m_pData[i] == element )
|
||||
{
|
||||
return Delete(i);
|
||||
}
|
||||
}
|
||||
return (m_iSize-1);
|
||||
}
|
||||
|
||||
int Find( void* element ){
|
||||
for( int i = 0; i < m_iSize; i++ )
|
||||
{
|
||||
if( m_pData[i] == element )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Empty(){
|
||||
m_iSize = 0;
|
||||
}
|
||||
};
|
||||
|
||||
class CXP_PtrStack : public CXP_GrowableArray{
|
||||
public:
|
||||
int m_iTop;
|
||||
CXP_PtrStack(): m_iTop(-1){}
|
||||
Bool IsEmpty(){ return m_iTop == -1; }
|
||||
void Push( void* t ){
|
||||
if( ++m_iTop >= Size() ) {
|
||||
Add( t );
|
||||
}
|
||||
else {
|
||||
(*this)[m_iTop] = t;
|
||||
}
|
||||
}
|
||||
void* Top(){ return (*this)[m_iTop]; }
|
||||
void* Pop(){ return (*this)[m_iTop--];}
|
||||
void Reset(){ m_iTop = -1; }
|
||||
int StackSize() { return m_iTop + 1; }
|
||||
};
|
||||
|
||||
#ifdef TEMPLATE_SUPPORT
|
||||
|
||||
template<class PTRTYPE>
|
||||
class TXP_GrowableArray: public CXP_GrowableArray {
|
||||
public:
|
||||
PTRTYPE operator[](int nIndex) const { return (PTRTYPE)(int32)m_pData[nIndex]; }
|
||||
PTRTYPE& operator[](int nIndex){ return *(PTRTYPE*)&m_pData[nIndex]; }
|
||||
int Add(PTRTYPE newElement){ return CXP_GrowableArray::Add( (void*) newElement ); }
|
||||
};
|
||||
|
||||
#define Declare_GrowableArray(NAME,PTRTYPE) \
|
||||
typedef TXP_GrowableArray<PTRTYPE> TXP_GrowableArray_##NAME;
|
||||
|
||||
#else
|
||||
|
||||
#define Declare_GrowableArray(NAME,PTRTYPE) \
|
||||
class TXP_GrowableArray_##NAME: public CXP_GrowableArray { \
|
||||
public: \
|
||||
PTRTYPE operator[](int nIndex) const { return (PTRTYPE)(int32)m_pData[nIndex]; }\
|
||||
PTRTYPE& operator[](int nIndex){ return *(PTRTYPE*)&m_pData[nIndex]; } \
|
||||
int Add(PTRTYPE newElement){ return CXP_GrowableArray::Add( (void*) newElement ); } \
|
||||
}; \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// PtrStack Imlementation
|
||||
//
|
||||
#ifdef TEMPLATE_SUPPORT
|
||||
template<class PTRTYPE>
|
||||
class TXP_PtrStack : public TXP_GrowableArray<PTRTYPE> {
|
||||
public:
|
||||
int m_iTop;
|
||||
TXP_PtrStack(): m_iTop(-1){}
|
||||
Bool IsEmpty(){ return m_iTop == -1; }
|
||||
void Push( PTRTYPE t ){
|
||||
if( ++m_iTop >= Size() ) {
|
||||
Add( t );
|
||||
}
|
||||
else {
|
||||
(*this)[m_iTop] = t;
|
||||
}
|
||||
}
|
||||
PTRTYPE Top(){ return (*this)[m_iTop]; }
|
||||
PTRTYPE Pop(){ return (*this)[m_iTop--];}
|
||||
void Reset(){ m_iTop = -1; }
|
||||
int StackSize(){ return m_iTop + 1; }
|
||||
};
|
||||
|
||||
#define Declare_PtrStack(NAME,PTRTYPE) \
|
||||
typedef TXP_PtrStack<PTRTYPE> TXP_PtrStack_##NAME;
|
||||
|
||||
#else // No template support
|
||||
|
||||
#define Declare_PtrStack(NAME, PTRTYPE) \
|
||||
class TXP_PtrStack_##NAME : public CXP_PtrStack { \
|
||||
public: \
|
||||
void Push( PTRTYPE t ){ CXP_PtrStack::Push((void*)(int32)t); } \
|
||||
PTRTYPE Top(){ return (PTRTYPE)(int32)CXP_PtrStack::Top(); } \
|
||||
PTRTYPE Pop(){ return (PTRTYPE)(int32)CXP_PtrStack::Pop(); } \
|
||||
PTRTYPE operator[](int nIndex) const { return (PTRTYPE)(int32)m_pData[nIndex]; }\
|
||||
PTRTYPE& operator[](int nIndex){ return *(PTRTYPE*)&m_pData[nIndex]; } \
|
||||
int Add(PTRTYPE newElement){ return CXP_GrowableArray::Add( (void*)(int32)newElement ); } \
|
||||
}; \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
188
mozilla/include/glhist.h
Normal file
188
mozilla/include/glhist.h
Normal file
@@ -0,0 +1,188 @@
|
||||
/* -*- 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 GLHIST_H
|
||||
#define GLHIST_H
|
||||
|
||||
#include "ntypes.h"
|
||||
|
||||
typedef enum gh_SortColumn
|
||||
{
|
||||
eGH_NoSort = -1,
|
||||
eGH_NameSort,
|
||||
eGH_LocationSort,
|
||||
eGH_FirstDateSort,
|
||||
eGH_LastDateSort,
|
||||
eGH_VisitCountSort
|
||||
}gh_SortColumn;
|
||||
|
||||
typedef struct _gh_HistEntry
|
||||
{
|
||||
char * address;
|
||||
time_t last_accessed;
|
||||
time_t first_accessed;
|
||||
int32 iCount;
|
||||
int32 iFlags;
|
||||
char * pszName;
|
||||
}gh_HistEntry;
|
||||
|
||||
typedef struct _gh_HistEntryData
|
||||
{
|
||||
time_t last_accessed;
|
||||
time_t first_accessed;
|
||||
int32 iCount;
|
||||
int32 iFlags;
|
||||
char * pszName;
|
||||
}gh_HistEntryData;
|
||||
|
||||
typedef enum gh_FilterOp
|
||||
{
|
||||
eGH_FOEquals,
|
||||
eGH_FOEqualsNot,
|
||||
|
||||
eGH_FOGreater,
|
||||
eGH_FOGreaterEqual,
|
||||
eGH_FOLess,
|
||||
eGH_FOLessEqual,
|
||||
|
||||
eGH_FOHas,
|
||||
eGH_FOHasNot
|
||||
}gh_FilterOp;
|
||||
|
||||
typedef enum gh_FilterLogOp
|
||||
{
|
||||
eGH_FLOAnd,
|
||||
eGH_FLOOr
|
||||
}gh_FilterLogOp;
|
||||
|
||||
typedef struct _gh_FilterCondition
|
||||
{
|
||||
enum gh_SortColumn enCol;
|
||||
enum gh_FilterOp enOp;
|
||||
|
||||
union
|
||||
{
|
||||
char * pszTest;
|
||||
int32 iTest;
|
||||
} tests;
|
||||
}gh_FilterCondition;
|
||||
|
||||
typedef struct _gh_Filter
|
||||
{
|
||||
int32 iNumConditions;
|
||||
gh_FilterCondition * pConditions;
|
||||
gh_FilterLogOp * enOps;
|
||||
}gh_Filter;
|
||||
|
||||
typedef struct _gh_NotifyMsg
|
||||
{
|
||||
int32 iNotifyMsg;
|
||||
char * pszKey;
|
||||
void * pUserData;
|
||||
} gh_NotifyMsg;
|
||||
|
||||
typedef void * GHHANDLE;
|
||||
typedef void * GHURHANDLE;
|
||||
|
||||
#define GH_NOTIFY_UPDATE 1
|
||||
#define GH_NOTIFY_DELETE 2
|
||||
|
||||
#ifdef XP_WIN
|
||||
typedef int (__cdecl *GHISTORY_NOTIFYPROC)( gh_NotifyMsg *pMsg );
|
||||
#else
|
||||
typedef int (*GHISTORY_NOTIFYPROC)( gh_NotifyMsg *pMsg );
|
||||
#endif
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
/* if the url was found in the global history then the then number of seconds since
|
||||
* the last access is returned. if the url is not found -1 is returned
|
||||
*/
|
||||
extern int GH_CheckGlobalHistory(char * url);
|
||||
|
||||
/* add or update the url in the global history
|
||||
*/
|
||||
extern void GH_UpdateGlobalHistory(URL_Struct * URL_s);
|
||||
|
||||
/* save the global history to a file and remove the list from memory
|
||||
*/
|
||||
/*extern void GH_CleanupGlobalHistory(void);*/
|
||||
|
||||
/* save the global history to a file and remove the list from memory
|
||||
*/
|
||||
extern void GH_SaveGlobalHistory(void);
|
||||
|
||||
/* free the global history list
|
||||
*/
|
||||
extern void GH_FreeGlobalHistory(void);
|
||||
|
||||
/* clear the entire global history list
|
||||
*/
|
||||
extern void GH_ClearGlobalHistory(void);
|
||||
|
||||
#if defined(XP_MAC) || defined(XP_UNIX)
|
||||
/* set the maximum time for an object in the Global history in
|
||||
* number of seconds
|
||||
*/
|
||||
extern void GH_SetGlobalHistoryTimeout(int32 timeout_interval);
|
||||
#endif
|
||||
|
||||
/* start global history tracking
|
||||
*/
|
||||
extern void GH_InitGlobalHistory(void);
|
||||
|
||||
/* create an HTML stream and push a bunch of HTML about
|
||||
* the global history
|
||||
*
|
||||
* returns -1
|
||||
*/
|
||||
extern int NET_DisplayGlobalHistoryInfoAsHTML( MWContext *context, URL_Struct *URL_s, int format_out );
|
||||
|
||||
/*
|
||||
// Context/Handle based functions to retrieve a pseudo cursor on the
|
||||
// Global History list (using a specified sort/index).
|
||||
*/
|
||||
extern GHHANDLE GH_GetContext( enum gh_SortColumn enGHSort,
|
||||
gh_Filter * pFilter,
|
||||
GHISTORY_NOTIFYPROC pfNotifyProc,
|
||||
GHURHANDLE hUR,
|
||||
void * pUserData );
|
||||
extern void GH_ReleaseContext( GHHANDLE pContext, Bool bReleaseUR );
|
||||
extern gh_HistEntry * GH_GetRecord( GHHANDLE pContext, uint32 uRow );
|
||||
extern void GH_DeleteRecord( GHHANDLE pContext, uint32 uRow, Bool bGroup );
|
||||
extern uint32 GH_GetNumRecords( GHHANDLE pContext );
|
||||
extern gh_SortColumn GH_GetSortField( GHHANDLE pContext );
|
||||
extern int GH_UpdateURLTitle( URL_Struct *pUrl, char *pszTitle, Bool bFrameCell );
|
||||
extern int32 GH_GetRecordNum( GHHANDLE pContext, char *pszLocation );
|
||||
extern int GH_GetMRUPage( char *pszURL, int iMaxLen );
|
||||
extern void GH_FileSaveAsHTML( GHHANDLE pContext, MWContext *pMWContext );
|
||||
extern GHURHANDLE GH_GetURContext( GHHANDLE pContext );
|
||||
extern void GH_SupportUndoRedo( GHHANDLE pContext );
|
||||
extern void GH_Undo( GHHANDLE pContext );
|
||||
extern void GH_Redo( GHHANDLE pContext );
|
||||
extern Bool GH_CanUndo( GHHANDLE pContext );
|
||||
extern Bool GH_CanRedo( GHHANDLE pContext );
|
||||
|
||||
/* AutoComplete stuff */
|
||||
enum autoCompStatus {foundDone, notFoundDone, stillSearching, dontCallOnIdle};
|
||||
extern enum autoCompStatus urlMatch(const char *criteria, char **result, Bool freshStart, Bool scroll);
|
||||
extern void NET_RegisterEnableUrlMatchCallback(void);
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* GLHIST_H */
|
||||
64
mozilla/include/gui.h
Normal file
64
mozilla/include/gui.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* -*- 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 _GUI_H_
|
||||
#define _GUI_H_
|
||||
|
||||
/* These are defined in libnet/mkhttp.c.
|
||||
|
||||
XP_AppName The name of the client program - usually "Netscape", but
|
||||
possibly something else for bundled versions, like the
|
||||
MCI client.
|
||||
|
||||
XP_AppCodeName The name sent at the HTTP vendor ID string; regardless of
|
||||
the value of XP_AppName, this must be "Mozilla" or
|
||||
everything will break.
|
||||
|
||||
XP_AppVersion The version number of the client as a string. This is the
|
||||
string sent along with the vendor ID string, so it should be
|
||||
of the form "1.1N (Windows)" or "1.1N (X11; SunOS 4.1.3)".
|
||||
|
||||
XP_AppLanguage The language of the navigator client. Usually a two-letter
|
||||
code (EN, FR) but could be a 5-letter code for translations
|
||||
where a sub-language designation is appropriate (FR_CA)
|
||||
|
||||
XP_AppPlatform The compiled flavor of the navigator (as opposed to what
|
||||
it may actually be running on).
|
||||
*/
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
extern char *XP_AppName, *XP_AppCodeName, *XP_AppVersion;
|
||||
extern char *XP_AppLanguage, *XP_AppPlatform;
|
||||
#else
|
||||
extern const char *XP_AppName, *XP_AppCodeName, *XP_AppVersion;
|
||||
extern const char *XP_AppLanguage, *XP_AppPlatform;
|
||||
#endif
|
||||
XP_END_PROTOS
|
||||
|
||||
/* this define is needed for error message efficiency
|
||||
*
|
||||
* please don't comment it out for UNIX - LJM
|
||||
*/
|
||||
/* this is constant across languages - do NOT localize it */
|
||||
#define XP_CANONICAL_CLIENT_NAME "Netscape"
|
||||
|
||||
/* name of the program */
|
||||
/* XP_LOCAL_CLIENT_NAME was never used consistently: use XP_AppName instead. */
|
||||
|
||||
#endif /* _GUI_H_ */
|
||||
250
mozilla/include/hotlist.h
Normal file
250
mozilla/include/hotlist.h
Normal file
@@ -0,0 +1,250 @@
|
||||
/* -*- 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 HOTLIST_H
|
||||
#define HOTLIST_H
|
||||
|
||||
#include "xp_mcom.h"
|
||||
#include "ntypes.h"
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
typedef enum HOT_Type {
|
||||
HOT_URLType, HOT_HeaderType, HOT_SeparatorType } HOT_Type;
|
||||
|
||||
typedef struct HotlistStruct_ {
|
||||
HOT_Type type;
|
||||
Bool is_folded; /* if it's a header is it folded? */
|
||||
XP_List *children; /* a list of children, only headers have these */
|
||||
char *name; /* a title */
|
||||
char *address; /* the URL address */
|
||||
char *description; /* random text */
|
||||
time_t last_visit;
|
||||
time_t addition_date;
|
||||
char *content_type;
|
||||
struct HotlistStruct_ *parent; /* My hotlist parent */
|
||||
XP_List *lParent; /* The XP_List object that points to my parent or NULL */
|
||||
} HotlistStruct;
|
||||
|
||||
/* tell the hotlist code that the hotlist has been modified
|
||||
* so that it gets saved the next time SaveHotlist is called
|
||||
*/
|
||||
extern void HOT_SetModified(void);
|
||||
|
||||
/* changes a entry to a header type from a non header type
|
||||
* and vice versa. If the object was a header and
|
||||
* has children, the children will be blown away. (very bad)
|
||||
*/
|
||||
extern void HOT_ChangeEntryType(HotlistStruct * entry, HOT_Type new_type);
|
||||
|
||||
/* Fold or unfold a hotlist header
|
||||
*
|
||||
* set the Boolean to True to fold the list and
|
||||
* False to unfold
|
||||
*/
|
||||
extern void HOT_FoldHeader(HotlistStruct * item, Bool fold);
|
||||
|
||||
/* checks the hotlist for a url and updates the last accessed
|
||||
* time
|
||||
*/
|
||||
extern void HOT_UpdateHotlistTime(URL_Struct *URL_s, time_t cur_time);
|
||||
|
||||
/* Performs regular expression match on hotlist name and address
|
||||
* fields. Returns the found object, or NULL if not
|
||||
* found.
|
||||
*
|
||||
* start_obj specifies the object to start searching
|
||||
* on. The start_num object WILL NOT be searched but all those
|
||||
* after it will be.
|
||||
* To search the whole list give NULL as start_obj.
|
||||
*
|
||||
* If headers became unfolded because of the search then redisplay_all
|
||||
* will be set to TRUE
|
||||
*/
|
||||
extern HotlistStruct * HOT_SearchHotlist(char * search_string,
|
||||
HotlistStruct * start_obj,
|
||||
Bool * redisplay_all);
|
||||
|
||||
/* returns TRUE if the second argument is a direct
|
||||
* descendent of the first argument.
|
||||
*
|
||||
* returns FALSE otherwise
|
||||
*/
|
||||
extern Bool HOT_IsDescendent(HotlistStruct *parent, HotlistStruct *possible_child);
|
||||
|
||||
|
||||
/* Reads the hostlist from disk, what else?
|
||||
*
|
||||
* pass in the hotlist filename and a relative URL which represents
|
||||
* the original location of the html file. If you are reading the
|
||||
* default hotlist you should pass in a file URL of the form
|
||||
* file://localhost/PATH
|
||||
*
|
||||
*/
|
||||
extern void HOT_ReadHotlistFromDisk (char * filename, char * relative_url);
|
||||
|
||||
/* returns an integer index of the item in the list
|
||||
*/
|
||||
extern int HOT_GetIndex(HotlistStruct * item);
|
||||
|
||||
/* returns an integer index of the item in the list
|
||||
* and does not pay attention to the is_folded value
|
||||
*/
|
||||
extern int HOT_GetUnfoldedIndex(HotlistStruct * item);
|
||||
|
||||
/* returns the object associated with the index returned by
|
||||
* HOT_GetIndex()
|
||||
*/
|
||||
extern HotlistStruct * HOT_IndexOf(int index);
|
||||
|
||||
/* returns the object associated with the index returned by
|
||||
* HOT_GetUnfoldedIndex()
|
||||
*/
|
||||
extern HotlistStruct * HOT_UnfoldedIndexOf(int index);
|
||||
|
||||
/* returns an integer depth of the item in the list starting at zero
|
||||
*/
|
||||
extern int HOT_GetDepth(HotlistStruct * item);
|
||||
|
||||
/* return a pointer to the main hotlist list
|
||||
*
|
||||
* returns NULL if nothing has ever been
|
||||
* added to the hotlist
|
||||
*/
|
||||
extern XP_List * HOT_GetHotlistList(void);
|
||||
|
||||
/* saves the hotlist to a configuration file
|
||||
*/
|
||||
extern int HOT_SaveHotlist (char * filename);
|
||||
|
||||
/* Free's the entire hotlist
|
||||
*/
|
||||
extern void HOT_FreeHotlist (void);
|
||||
|
||||
|
||||
/* create a hotlist entry struct and fill it in with
|
||||
* the passed in data
|
||||
*
|
||||
* returns NULL on out of memory error.
|
||||
*/
|
||||
extern HotlistStruct *
|
||||
HOT_CreateEntry(HOT_Type type,
|
||||
const char *name,
|
||||
const char *address,
|
||||
const char *content_type,
|
||||
time_t last_visit);
|
||||
|
||||
/* free's a hotlist entry
|
||||
*/
|
||||
extern void HOT_FreeEntry(HotlistStruct * entry);
|
||||
|
||||
/* create a completely new copy of the entry passed in
|
||||
*/
|
||||
extern HotlistStruct * HOT_CopyEntry(HotlistStruct * entry);
|
||||
|
||||
/* insert an item before another item in the hotlist
|
||||
*
|
||||
* if the insert_before item is NULL or not found the item
|
||||
* will be inserted at the begining of the list
|
||||
*/
|
||||
extern void HOT_InsertItemBefore(HotlistStruct * insert_before, HotlistStruct * insertee);
|
||||
|
||||
/* insert an item after another item in the hotlist
|
||||
*
|
||||
* if the insert_after item is NULL or not found the item
|
||||
* will be inserted at the end of the list
|
||||
*/
|
||||
extern void HOT_InsertItemAfter(HotlistStruct * insert_after, HotlistStruct * insertee);
|
||||
|
||||
/* insert an item in a header if "insert_after" is a
|
||||
* Header type, or after the item if "insert after" is
|
||||
* not a header type.
|
||||
*
|
||||
* if the insert_after item is NULL or not found the item
|
||||
* will be inserted at the end of the hotlist
|
||||
*/
|
||||
extern void
|
||||
HOT_InsertItemInHeaderOrAfterItem(HotlistStruct * insert_after,
|
||||
HotlistStruct * insertee);
|
||||
|
||||
/* remove an item from the hotlist and free's it
|
||||
*
|
||||
* returns TRUE on success, FALSE if not found
|
||||
*/
|
||||
extern Bool HOT_RemoveItem(HotlistStruct * old_item);
|
||||
|
||||
/* remove an item from the hotlist and doesn't free it
|
||||
*
|
||||
* returns TRUE on success, FALSE if not found
|
||||
*/
|
||||
extern Bool HOT_RemoveItemFromList(HotlistStruct * old_item);
|
||||
|
||||
/* move an item up in the list
|
||||
*/
|
||||
extern void HOT_MoveObjectUp(HotlistStruct * item);
|
||||
|
||||
/* move an item down in the list
|
||||
*/
|
||||
extern void HOT_MoveObjectDown(HotlistStruct * item);
|
||||
|
||||
/* returns True if the object can be moved Up
|
||||
* False if the object cannot be moved Up or if
|
||||
* it cannot be found in the list
|
||||
*/
|
||||
extern Bool HOT_ObjectCanGoUp(HotlistStruct * item);
|
||||
|
||||
/* returns True if the object can be moved down
|
||||
* False if the object cannot be moved down or if
|
||||
* it cannot be found in the list
|
||||
*/
|
||||
extern Bool HOT_ObjectCanGoDown(HotlistStruct * item);
|
||||
|
||||
/* Whether the file will be written when Save is called. */
|
||||
extern Bool HOT_Modified(void);
|
||||
|
||||
/*
|
||||
* Gets the top node of the hotlist
|
||||
*/
|
||||
extern HotlistStruct*
|
||||
HOT_GetHotlist (void);
|
||||
|
||||
|
||||
/*
|
||||
* Convert a number of selections in a hotlist list into a block of
|
||||
* memory that the user can use for cut and paste operations
|
||||
*/
|
||||
extern char *
|
||||
HOT_ConvertSelectionsToBlock(HotlistStruct ** list,
|
||||
int iCount,
|
||||
int bLongFormat,
|
||||
int32 * lTotalLen);
|
||||
/*
|
||||
* Take a block of memory and insert the hotlist items it represents into
|
||||
* the current hotlist
|
||||
*/
|
||||
extern void
|
||||
HOT_InsertBlockAt(char * pOriginalBlock,
|
||||
HotlistStruct * item,
|
||||
int bLongFormat,
|
||||
int32 lTotalLen);
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* HOTLIST_H */
|
||||
|
||||
|
||||
480
mozilla/include/imap.h
Normal file
480
mozilla/include/imap.h
Normal file
@@ -0,0 +1,480 @@
|
||||
/* -*- 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 __imap__
|
||||
#define __imap__
|
||||
|
||||
#include "structs.h"
|
||||
#include "msgcom.h"
|
||||
|
||||
|
||||
/* used for communication between libmsg and libnet */
|
||||
#define kNoFlags 0x00 /* RFC flags */
|
||||
#define kMarked 0x01
|
||||
#define kUnmarked 0x02
|
||||
#define kNoinferiors 0x04
|
||||
#define kNoselect 0x08
|
||||
#define kImapTrash 0x10 /* Navigator flag */
|
||||
#define kJustExpunged 0x20 /* This update is a post expunge url update. */
|
||||
#define kPersonalMailbox 0x40 /* this mailbox is in the personal namespace */
|
||||
#define kPublicMailbox 0x80 /* this mailbox is in the public namespace */
|
||||
#define kOtherUsersMailbox 0x100 /* this mailbox is in the other users' namespace */
|
||||
|
||||
/* flags for individual messages */
|
||||
/* currently the ui only offers \Seen and \Flagged */
|
||||
#define kNoImapMsgFlag 0x0000
|
||||
#define kImapMsgSeenFlag 0x0001
|
||||
#define kImapMsgAnsweredFlag 0x0002
|
||||
#define kImapMsgFlaggedFlag 0x0004
|
||||
#define kImapMsgDeletedFlag 0x0008
|
||||
#define kImapMsgDraftFlag 0x0010
|
||||
#define kImapMsgRecentFlag 0x0020
|
||||
#define kImapMsgForwardedFlag 0x0040 /* Not always supported, check mailbox folder */
|
||||
#define kImapMsgMDNSentFlag 0x0080 /* Not always supported. check mailbox folder */
|
||||
|
||||
#define kImapMsgSupportUserFlag 0x8000 /* This seems to be the most cost effective way of
|
||||
* piggying back the server support user flag
|
||||
* info.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
kPersonalNamespace = 0,
|
||||
kOtherUsersNamespace,
|
||||
kPublicNamespace,
|
||||
kDefaultNamespace,
|
||||
kUnknownNamespace
|
||||
} EIMAPNamespaceType;
|
||||
|
||||
|
||||
typedef int32 imap_uid;
|
||||
|
||||
#ifdef XP_CPLUSPLUS
|
||||
class TImapFlagAndUidState;
|
||||
#else
|
||||
typedef struct TImapFlagAndUidState TImapFlagAndUidState;
|
||||
#endif
|
||||
|
||||
/* forward declaration */
|
||||
typedef void ImapActiveEntry;
|
||||
|
||||
/* url used to signify that filtering is complete so
|
||||
we can tell the fe that the inbox thread pane is
|
||||
loaded */
|
||||
#define kImapFilteringCompleteURL "Mailbox://?filteringcomplete"
|
||||
|
||||
/* url used to signify that online/offline synch is complete */
|
||||
#define kImapOnOffSynchCompleteURL "Mailbox://?onoffsynchcomplete"
|
||||
|
||||
/* if a url creator does not know the hierarchySeparator, use this */
|
||||
#define kOnlineHierarchySeparatorUnknown ' '
|
||||
|
||||
struct mailbox_spec {
|
||||
int32 folder_UIDVALIDITY;
|
||||
int32 number_of_messages;
|
||||
int32 number_of_unseen_messages;
|
||||
int32 number_of_recent_messages;
|
||||
|
||||
uint32 box_flags;
|
||||
|
||||
char *allocatedPathName;
|
||||
char hierarchySeparator;
|
||||
const char *hostName;
|
||||
|
||||
TNavigatorImapConnection *connection;
|
||||
TImapFlagAndUidState *flagState;
|
||||
|
||||
XP_Bool folderSelected;
|
||||
XP_Bool discoveredFromLsub;
|
||||
|
||||
const char *smtpPostAddress;
|
||||
};
|
||||
|
||||
typedef struct mailbox_spec mailbox_spec;
|
||||
|
||||
|
||||
enum EIMAPSubscriptionUpgradeState {
|
||||
kEverythingDone,
|
||||
kBringUpSubscribeUI
|
||||
};
|
||||
|
||||
enum ImapOnlineCopyState {
|
||||
kInProgress,
|
||||
kSuccessfulCopy,
|
||||
kFailedCopy,
|
||||
kSuccessfulDelete,
|
||||
kFailedDelete,
|
||||
kReadyForAppendData,
|
||||
kFailedAppend
|
||||
};
|
||||
|
||||
struct folder_rename_struct {
|
||||
char *fOldName;
|
||||
char *fNewName;
|
||||
};
|
||||
|
||||
|
||||
typedef struct folder_rename_struct folder_rename_struct;
|
||||
|
||||
|
||||
/* this file defines the syntax of the imap4 url's and offers functions
|
||||
that create url strings. If the functions do not offer enough
|
||||
functionality then let kevin know before you starting creating strings
|
||||
from scratch. */
|
||||
#include "xp_mcom.h"
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
/* need mailbox status urls to get the number of message and the
|
||||
number of unread messages */
|
||||
|
||||
/* Selecting a mailbox */
|
||||
/* imap4://HOST?select?MAILBOXPATH */
|
||||
char *CreateImapMailboxSelectUrl(const char *imapHost,
|
||||
const char *mailbox,
|
||||
char hierarchySeparator,
|
||||
const char *undoDeleteIdentifierList);
|
||||
|
||||
/* lite select, used to verify UIDVALIDITY while going on/offline */
|
||||
char *CreateImapMailboxLITESelectUrl(const char *imapHost,
|
||||
const char *mailbox,
|
||||
char hierarchySeparator);
|
||||
|
||||
/* expunge, used in traditional imap delete model */
|
||||
char *CreateImapMailboxExpungeUrl(const char *imapHost,
|
||||
const char *mailbox,
|
||||
char hierarchySeparator);
|
||||
|
||||
/* Creating a mailbox */
|
||||
/* imap4://HOST?create?MAILBOXPATH */
|
||||
char *CreateImapMailboxCreateUrl(const char *imapHost, const char *mailbox, char hierarchySeparator);
|
||||
|
||||
/* discover the children of this mailbox */
|
||||
char *CreateImapChildDiscoveryUrl(const char *imapHost, const char *mailbox, char hierarchySeparator);
|
||||
|
||||
/* discover the n-th level children of this mailbox */
|
||||
char *CreateImapLevelChildDiscoveryUrl(const char *imapHost, const char *mailbox, char hierarchySeparator, int n);
|
||||
|
||||
/* discover the mailboxes of this account */
|
||||
char *CreateImapAllMailboxDiscoveryUrl(const char *imapHost);
|
||||
|
||||
/* discover the mailboxes of this account, and the subscribed mailboxes */
|
||||
char *CreateImapAllAndSubscribedMailboxDiscoveryUrl(const char *imapHost);
|
||||
|
||||
/* deleting a mailbox */
|
||||
/* imap4://HOST?delete?MAILBOXPATH */
|
||||
char *CreateImapMailboxDeleteUrl(const char *imapHost, const char *mailbox, char hierarchySeparator);
|
||||
|
||||
/* renaming a mailbox */
|
||||
/* imap4://HOST?rename?OLDNAME?NEWNAME */
|
||||
char *CreateImapMailboxRenameLeafUrl(const char *imapHost,
|
||||
const char *oldBoxPathName,
|
||||
char hierarchySeparator,
|
||||
const char *newBoxLeafName);
|
||||
|
||||
/* renaming a mailbox, moving hierarchy */
|
||||
/* imap4://HOST?movefolderhierarchy?OLDNAME?NEWNAME */
|
||||
/* oldBoxPathName is the old name of the child folder */
|
||||
/* destinationBoxPathName is the name of the new parent */
|
||||
char *CreateImapMailboxMoveFolderHierarchyUrl(const char *imapHost,
|
||||
const char *oldBoxPathName,
|
||||
char oldHierarchySeparator,
|
||||
const char *destinationBoxPathName,
|
||||
char newHierarchySeparator);
|
||||
|
||||
/* listing available mailboxes */
|
||||
/* imap4://HOST?list */
|
||||
char *CreateImapListUrl(const char *imapHost,
|
||||
const char *mailbox,
|
||||
const char hierarchySeparator);
|
||||
|
||||
/* biff */
|
||||
char *CreateImapBiffUrl(const char *imapHost,
|
||||
const char *mailbox,
|
||||
char hierarchySeparator,
|
||||
uint32 uidHighWater);
|
||||
|
||||
|
||||
|
||||
/* fetching RFC822 messages */
|
||||
/* imap4://HOST?fetch?<UID/SEQUENCE>?MAILBOXPATH?x */
|
||||
/* 'x' is the message UID or sequence number list */
|
||||
/* will set the 'SEEN' flag */
|
||||
char *CreateImapMessageFetchUrl(const char *imapHost,
|
||||
const char *mailbox,
|
||||
char hierarchySeparator,
|
||||
const char *messageIdentifierList,
|
||||
XP_Bool messageIdsAreUID);
|
||||
|
||||
|
||||
/* fetching the headers of RFC822 messages */
|
||||
/* imap4://HOST?header?<UID/SEQUENCE>?MAILBOXPATH?x */
|
||||
/* 'x' is the message UID or sequence number list */
|
||||
/* will not affect the 'SEEN' flag */
|
||||
char *CreateImapMessageHeaderUrl(const char *imapHost,
|
||||
const char *mailbox,
|
||||
char hierarchySeparator,
|
||||
const char *messageIdentifierList,
|
||||
XP_Bool messageIdsAreUID);
|
||||
|
||||
|
||||
/* search an online mailbox */
|
||||
/* imap4://HOST?search?<UID/SEQUENCE>?MAILBOXPATH?SEARCHSTRING */
|
||||
char *CreateImapSearchUrl(const char *imapHost,
|
||||
const char *mailbox,
|
||||
char hierarchySeparator,
|
||||
const char *searchString,
|
||||
XP_Bool messageIdsAreUID);
|
||||
|
||||
/* delete messages */
|
||||
/* imap4://HOST?deletemsg?<UID/SEQUENCE>?MAILBOXPATH?x */
|
||||
/* 'x' is the message UID or sequence number list */
|
||||
char *CreateImapDeleteMessageUrl(const char *imapHost,
|
||||
const char *mailbox,
|
||||
char hierarchySeparator,
|
||||
const char *messageIds,
|
||||
XP_Bool idsAreUids);
|
||||
|
||||
/* delete all messages */
|
||||
/* imap4://HOST?deleteallmsgs?MAILBOXPATH */
|
||||
char *CreateImapDeleteAllMessagesUrl(const char *imapHost,
|
||||
const char *mailbox,
|
||||
char hierarchySeparator);
|
||||
|
||||
/* store +flags url */
|
||||
/* imap4://HOST?store+flags?<UID/SEQUENCE>?MAILBOXPATH?x?f */
|
||||
/* 'x' is the message UID or sequence number list */
|
||||
/* 'f' is the byte of flags */
|
||||
char *CreateImapAddMessageFlagsUrl(const char *imapHost,
|
||||
const char *mailbox,
|
||||
char hierarchySeparator,
|
||||
const char *messageIds,
|
||||
imapMessageFlagsType flags,
|
||||
XP_Bool idsAreUids);
|
||||
/* store -flags url */
|
||||
/* imap4://HOST?store-flags?<UID/SEQUENCE>?MAILBOXPATH?x?f */
|
||||
/* 'x' is the message UID or sequence number list */
|
||||
/* 'f' is the byte of flags */
|
||||
char *CreateImapSubtractMessageFlagsUrl(const char *imapHost,
|
||||
const char *mailbox,
|
||||
char hierarchySeparator,
|
||||
const char *messageIds,
|
||||
imapMessageFlagsType flags,
|
||||
XP_Bool idsAreUids);
|
||||
|
||||
/* set flags url, make the flags match */
|
||||
char *CreateImapSetMessageFlagsUrl(const char *imapHost,
|
||||
const char *mailbox,
|
||||
char hierarchySeparator,
|
||||
const char *messageIds,
|
||||
imapMessageFlagsType flags,
|
||||
XP_Bool idsAreUids);
|
||||
|
||||
|
||||
/* copy messages from one online box to another */
|
||||
/* imap4://HOST?onlineCopy?<UID/SEQUENCE>?
|
||||
SOURCEMAILBOXPATH?x?DESTINATIONMAILBOXPATH */
|
||||
/* 'x' is the message UID or sequence number list */
|
||||
char *CreateImapOnlineCopyUrl(const char *imapHost,
|
||||
const char *sourceMailbox,
|
||||
char sourceHierarchySeparator,
|
||||
const char *messageIds,
|
||||
const char *destinationMailbox,
|
||||
char destinationHierarchySeparator,
|
||||
XP_Bool idsAreUids,
|
||||
XP_Bool isMove); /* cause delete after copy */
|
||||
|
||||
/* copy a message from an online box to an offline box */
|
||||
/* imap4://HOST?ontooffCopy?SOURCEMAILBOXPATH?number=x?
|
||||
DESTINATIONMAILBOXPATH */
|
||||
/* 'x' is the message sequence number */
|
||||
char *CreateImapOnToOfflineCopyUrl( const char *imapHost,
|
||||
const char *sourceMailbox,
|
||||
char sourceHierarchySeparator,
|
||||
const char *messageIds,
|
||||
const char *destinationMailbox,
|
||||
XP_Bool idsAreUids,
|
||||
XP_Bool isMove); /* cause delete after copy */
|
||||
|
||||
/* copy messages from an offline box to an online box */
|
||||
/* imap4://HOST?offtoonCopy?DESTINATIONMAILBOXPATH */
|
||||
/* the number of messages and their sizes are negotiated later */
|
||||
char *CreateImapOffToOnlineCopyUrl(const char *imapHost,
|
||||
const char *destinationMailbox,
|
||||
char destinationHierarchySeparator);
|
||||
|
||||
/* Subscribe to a mailbox on the given IMAP host */
|
||||
char *CreateIMAPSubscribeMailboxURL(const char *imapHost, const char *mailboxName);
|
||||
|
||||
/* Unsubscribe from a mailbox on the given IMAP host */
|
||||
char *CreateIMAPUnsubscribeMailboxURL(const char *imapHost, const char *mailboxName);
|
||||
|
||||
/* get mail account rul */
|
||||
/* imap4://HOST?NETSCAPE */
|
||||
char *CreateImapManageMailAccountUrl(const char *imapHost);
|
||||
|
||||
/* append message from file */
|
||||
/* imap4://HOST?appendmsgfromfile?MSGFILEPATH?DESTINATIONMAILBOXPATH */
|
||||
char *CreateImapAppendMessageFromFileUrl(const char *imapHost,
|
||||
const char *destinationMailboxPath,
|
||||
const char hierarchySeparator,
|
||||
XP_Bool isDraft);
|
||||
|
||||
/* refresh the ACL for a folder */
|
||||
char *CreateIMAPRefreshACLForFolderURL(const char *imapHost, const char *mailbox);
|
||||
|
||||
/* refresh the ACL for all folders on given host*/
|
||||
char *CreateIMAPRefreshACLForAllFoldersURL(const char *imapHost);
|
||||
|
||||
/* Run the auto-upgrade to IMAP Subscription */
|
||||
char *CreateIMAPUpgradeToSubscriptionURL(const char *imapHost, XP_Bool subscribeToAll);
|
||||
|
||||
NET_StreamClass *CreateIMAPDownloadMessageStream(ImapActiveEntry *ce, uint32 msgSize);
|
||||
|
||||
void UpdateIMAPMailboxInfo(mailbox_spec *adoptedBoxSpec, MWContext *currentContext);
|
||||
|
||||
#define kUidUnknown -1
|
||||
int32 GetUIDValidityForSpecifiedImapFolder(const char *hostName, const char *canonicalimapName, MWContext *currentContext);
|
||||
|
||||
enum EMailboxDiscoverStatus {
|
||||
eContinue,
|
||||
eContinueNew,
|
||||
eListMyChildren,
|
||||
eNewServerDirectory,
|
||||
eCancelled };
|
||||
|
||||
enum EMailboxDiscoverStatus DiscoverIMAPMailbox(mailbox_spec *adoptedBoxSpec, MSG_Master *master, MWContext *currentContext);
|
||||
|
||||
void ReportSuccessOfOnlineCopy(MWContext *currentContext, enum ImapOnlineCopyState copyState);
|
||||
void ReportSuccessOfOnlineDelete(MWContext *currentContext, const char *mailboxName);
|
||||
void ReportFailureOfOnlineCreate(MWContext *currentContext, const char *mailboxName);
|
||||
void ReportSuccessOfOnlineRename(MWContext *currentContext, folder_rename_struct *names);
|
||||
void ReportMailboxDiscoveryDone(MWContext *currentContext, URL_Struct *URL_s);
|
||||
void ReportSuccessOfChildMailboxDiscovery(MWContext *currentContext);
|
||||
void NotifyHeaderFetchCompleted(MWContext *currentContext, TNavigatorImapConnection *imapConnection);
|
||||
|
||||
void ReportLiteSelectUIDVALIDITY(MSG_Pane *receivingPane, uint32 UIDVALIDITY);
|
||||
|
||||
typedef void (UploadCompleteFunctionPointer)(void*);
|
||||
void BeginMessageUpload(MWContext *currentContext,
|
||||
PRFileDesc *ioSocket,
|
||||
UploadCompleteFunctionPointer *completeFunction,
|
||||
void *completionFunctionArgument);
|
||||
|
||||
void IMAP_DoNotDownLoadAnyMessageHeadersForMailboxSelect(TNavigatorImapConnection *connection);
|
||||
void IMAP_DownLoadMessagesForMailboxSelect(TNavigatorImapConnection *connection,
|
||||
uint32 *messageKeys, /* uint32* is adopted */
|
||||
uint32 numberOfKeys);
|
||||
|
||||
void IMAP_DownLoadMessageBodieForMailboxSelect(TNavigatorImapConnection *connection,
|
||||
uint32 *messageKeys, /* uint32* is adopted */
|
||||
uint32 numberOfKeys);
|
||||
|
||||
void IMAP_BodyIdMonitor(TNavigatorImapConnection *connection, XP_Bool enter);
|
||||
|
||||
const char *IMAP_GetCurrentConnectionUrl(TNavigatorImapConnection *connection);
|
||||
|
||||
void IMAP_UploadAppendMessageSize(TNavigatorImapConnection *connection, uint32 msgSize, imapMessageFlagsType flags);
|
||||
void IMAP_ResetAnyCachedConnectionInfo();
|
||||
|
||||
XP_Bool IMAP_CheckNewMail(TNavigatorImapConnection *connection);
|
||||
XP_Bool IMAP_NewMailDetected(TNavigatorImapConnection *connection);
|
||||
|
||||
TImapFlagAndUidState *IMAP_CreateFlagState(int numberOfMessages);
|
||||
void IMAP_DeleteFlagState(TImapFlagAndUidState *state);
|
||||
int IMAP_GetFlagStateNumberOfMessages(TImapFlagAndUidState *state);
|
||||
|
||||
imap_uid IMAP_GetUidOfMessage(int zeroBasedIndex, TImapFlagAndUidState *state);
|
||||
imapMessageFlagsType IMAP_GetMessageFlags(int zeroBasedIndex, TImapFlagAndUidState *state);
|
||||
imapMessageFlagsType IMAP_GetMessageFlagsFromUID(imap_uid uid, XP_Bool *foundIt, TImapFlagAndUidState *state);
|
||||
|
||||
void IMAP_TerminateConnection (TNavigatorImapConnection *connection);
|
||||
|
||||
char *IMAP_CreateOnlineSourceFolderNameFromUrl(const char *url);
|
||||
|
||||
void IMAP_FreeBoxSpec(mailbox_spec *victim);
|
||||
|
||||
const char *IMAP_GetPassword();
|
||||
void IMAP_SetPassword(const char *password);
|
||||
|
||||
/* called once only by MSG_InitMsgLib */
|
||||
void IMAP_StartupImap();
|
||||
|
||||
/* called once only by MSG_ShutdownMsgLib */
|
||||
void IMAP_ShutdownImap();
|
||||
|
||||
/* used to prevent recursive listing of mailboxes during discovery */
|
||||
int64 IMAP_GetTimeStampOfNonPipelinedList();
|
||||
|
||||
/* returns TRUE if either we have a password or we were preAuth'd by SSL certs */
|
||||
XP_Bool IMAP_HaveWeBeenAuthenticated();
|
||||
|
||||
/* used by libmsg when creating an imap message display stream */
|
||||
int IMAP_InitializeImapFeData (ImapActiveEntry * ce);
|
||||
MSG_Pane *IMAP_GetActiveEntryPane(ImapActiveEntry * ce);
|
||||
NET_StreamClass *IMAP_CreateDisplayStream(ImapActiveEntry * ce, XP_Bool clearCacheBit, uint32 msgSize);
|
||||
|
||||
/* used by libmsg when a new message is loaded to interrupt the load of the previous message */
|
||||
void IMAP_PseudoInterruptFetch(MWContext *context);
|
||||
|
||||
void IMAP_URLFinished(URL_Struct *URL_s);
|
||||
|
||||
XP_Bool IMAP_HostHasACLCapability(const char *hostName);
|
||||
|
||||
/**** IMAP Host stuff - used for communication between MSG_IMAPHost (in libmsg) and TImapHostInfo (in libnet) ****/
|
||||
|
||||
/* obsolete? */
|
||||
/*void IMAP_SetNamespacesFromPrefs(const char *hostName, char *personalDir, char *publicDir, char *otherUsersDir);*/
|
||||
|
||||
/* Sets the preference of whether or not we should always explicitly LIST the INBOX for given host */
|
||||
void IMAP_SetShouldAlwaysListInboxForHost(const char *hostName, XP_Bool shouldList);
|
||||
|
||||
/* Gets the number of namespaces in use for a given host */
|
||||
int IMAP_GetNumberOfNamespacesForHost(const char *hostName);
|
||||
|
||||
/* Sets the currently-used default personal namespace for a given host. Used for updating from libnet when
|
||||
we get a NAMESPACE response. */
|
||||
void MSG_SetNamespacePrefixes(MSG_Master *master, const char *hostName, EIMAPNamespaceType type, const char *prefix);
|
||||
|
||||
|
||||
/* Check to see if we need upgrade to IMAP subscription */
|
||||
extern XP_Bool MSG_ShouldUpgradeToIMAPSubscription(MSG_Master *mast);
|
||||
extern void MSG_ReportSuccessOfUpgradeToIMAPSubscription(MWContext *context, enum EIMAPSubscriptionUpgradeState *state);
|
||||
|
||||
/* Adds a set of ACL rights for the given folder on the given host for the given user. If userName is NULL, it means
|
||||
the currently authenticated user (i.e. my rights). */
|
||||
extern void MSG_AddFolderRightsForUser(MSG_Master *master, const char *hostName, const char*mailboxName, const char *userName, const char *rights);
|
||||
|
||||
/* Clears all ACL rights for the given folder on the given host for all users. */
|
||||
extern void MSG_ClearFolderRightsForFolder(MSG_Master *master, const char *hostName, const char *mailboxName);
|
||||
|
||||
/* Refreshes the icon / flags for a given folder, based on new ACL rights */
|
||||
extern void MSG_RefreshFolderRightsViewForFolder(MSG_Master *master, const char *hostName, const char *mailboxName);
|
||||
|
||||
extern XP_Bool MSG_GetFolderNeedsSubscribing(MSG_FolderInfo *folder);
|
||||
|
||||
/* Returns TRUE if this folder needs an auto-refresh of the ACL (on a folder open, for example) */
|
||||
extern XP_Bool MSG_GetFolderNeedsACLListed(MSG_FolderInfo *folder);
|
||||
|
||||
/* Returns TRUE if this folder has NEVER (ever) had an ACL retrieved for it */
|
||||
extern XP_Bool MSG_IsFolderACLInitialized(MSG_Master *master, const char *folderName, const char *hostName);
|
||||
|
||||
extern char *IMAP_SerializeNamespaces(char **prefixes, int len);
|
||||
extern int IMAP_UnserializeNamespaces(const char *str, char **prefixes, int len);
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif
|
||||
369
mozilla/include/intl_csi.h
Normal file
369
mozilla/include/intl_csi.h
Normal file
@@ -0,0 +1,369 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
|
||||
/* intl_csi.h */
|
||||
|
||||
#ifndef INTL_CSI_H
|
||||
#define INTL_CSI_H
|
||||
/*
|
||||
Using the i18n Character-Set-Information (CSI) accessor functions:
|
||||
1) include the header file
|
||||
|
||||
#include "intl_csi.h"
|
||||
|
||||
2) get the i18n CSI object (generally from MWContext)
|
||||
|
||||
INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(context);
|
||||
|
||||
3) access (read/set) the data element
|
||||
|
||||
int16 doc_csid = INTL_GetCSIDocCSID(csi);
|
||||
INTL_SetCSIDocCSID(csi, new_doc_csid);
|
||||
|
||||
int16 win_csid = INTL_GetCSIWinCSID(csi);
|
||||
INTL_SetCSIWinCSID(csi, new_win_csid);
|
||||
|
||||
char *mime_name = INTL_GetCSIMimeCharset(csi);
|
||||
INTL_SetCSIMimeCharset(csi, new_mime_charset);
|
||||
|
||||
int16 relayout_flag = INTL_GetCSIRelayoutFlag(csi);
|
||||
INTL_SetCSIRelayoutFlag(csi, new_relayout_flag);
|
||||
|
||||
*/
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
#include "ntypes.h"
|
||||
#include "libi18n.h"
|
||||
|
||||
/**
|
||||
* Cookie for INTL_CSIInfo.
|
||||
*
|
||||
* This is a Magic Cookie to validate the pointer to INTL_CSIInfo in MWContext.
|
||||
*
|
||||
*/
|
||||
#define INTL_TAG 0x494E544C
|
||||
|
||||
/**@name Character Set Information (CSI) */
|
||||
/*@{*/
|
||||
/**
|
||||
* Allocate a new charset info object, and clear it with zeroes.
|
||||
*
|
||||
* @return The new charset info object
|
||||
* @see INTL_CSIInitialize, INTL_CSIDestroy
|
||||
*/
|
||||
PUBLIC INTL_CharSetInfo INTL_CSICreate(void);
|
||||
|
||||
/**
|
||||
* Frees the given charset info object.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @see INTL_CSICreate
|
||||
*/
|
||||
PUBLIC void INTL_CSIDestroy(
|
||||
INTL_CharSetInfo obj
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets all the charset info object fields to initial values.
|
||||
*
|
||||
* The override, HTTP, HTML META, document and window charset IDs are all set
|
||||
* to CS_DEFAULT. The MIME charset is set to NULL. The relayout flag is set
|
||||
* to METACHARSET_NONE.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @see INTL_CSIInitialize
|
||||
*/
|
||||
PUBLIC void INTL_CSIReset(
|
||||
INTL_CharSetInfo obj
|
||||
);
|
||||
|
||||
/**
|
||||
* Initializes the charset info object.
|
||||
*
|
||||
* <UL>
|
||||
* <LI>
|
||||
* If the given is_metacharset_reload argument is FALSE, INTL_CSIReset is
|
||||
* called, passing the given charset info object.
|
||||
*
|
||||
* <LI>
|
||||
* If the given is_metacharset_reload argument is TRUE, the charset info
|
||||
* object's relayout flag is set to METACHARSET_RELAYOUTDONE.
|
||||
*
|
||||
* <LI>
|
||||
* Otherwise, if the override charset ID is previously set in this object,
|
||||
* it is set in the document charset ID field.
|
||||
*
|
||||
* <LI>
|
||||
* Otherwise, if the given HTTP charset is known, it is set in the HTTP
|
||||
* charset field.
|
||||
*
|
||||
* <LI>
|
||||
* Otherwise, the document charset ID field is set to the given
|
||||
* defaultDocCharSetID, unless the type is mail/news, in which case CS_DEFAULT
|
||||
* is used. This is because the META charset in mail/news is sometimes wrong.
|
||||
*
|
||||
* <LI>
|
||||
* Finally, the window charset ID is set, based on the document charset ID.
|
||||
* </UL>
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @param is_metacharset_reload TRUE if it is currently reloading because
|
||||
* the layout code found HTML META charset.
|
||||
* FALSE otherwise.
|
||||
* @param http_charset Specifies the charset name if it is presented in
|
||||
* HTTP Content-Type header
|
||||
* @param type Specifies the context type
|
||||
* @param defaultDocCharSetID Specifies the default document charset ID.
|
||||
* @see
|
||||
*/
|
||||
PUBLIC void INTL_CSIInitialize(
|
||||
INTL_CharSetInfo obj,
|
||||
XP_Bool is_metacharset_reload,
|
||||
char *http_charset,
|
||||
int type,
|
||||
uint16 defaultDocCharSetID
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets HTML META charset info in the given charset info object.
|
||||
*
|
||||
* <UL>
|
||||
* <LI>
|
||||
* If the given charset is unknown, this function returns.
|
||||
*
|
||||
* <LI>
|
||||
* If the given context type is mail or news, this function returns,
|
||||
* since mail/news sometimes has wrong HTML META charsets.
|
||||
*
|
||||
* <LI>
|
||||
* If the relayout flag is set to something other than METACHARSET_NONE, this
|
||||
* function returns, to avoid setting the META charset more than once.
|
||||
*
|
||||
* <LI>
|
||||
* Otherwise, the HTML META charset field is set, and the relayout flag is
|
||||
* set to METACHARSET_HASCHARSET.
|
||||
* If the previous document charset was known,
|
||||
* and was different from the new META charset, the relayout flag is set to
|
||||
* METACHARSET_REQUESTRELAYOUT.
|
||||
* The window charset ID is also checked against the new one.
|
||||
* If they are different, the relayout flag is set to
|
||||
* METACHARSET_REQUESTRELAYOUT.
|
||||
* </UL>
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @param charset_tag Specifies the HTML META charset
|
||||
* @param type Specifies the context type
|
||||
* @see INTL_GetCSIMetaDocCSID, INTL_GetCSIRelayoutFlag
|
||||
*/
|
||||
PUBLIC void INTL_CSIReportMetaCharsetTag(
|
||||
INTL_CharSetInfo obj,
|
||||
char *charset_tag,
|
||||
int type
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the context's charset info object.
|
||||
*
|
||||
* @param context Specifies the context
|
||||
* @return The context's charset info object
|
||||
* @see INTL_CSICreate
|
||||
*/
|
||||
PUBLIC INTL_CharSetInfo LO_GetDocumentCharacterSetInfo(
|
||||
MWContext *context
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the document charset ID of the given charset info object.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @return The document charset ID
|
||||
* @see INTL_SetCSIDocCSID
|
||||
*/
|
||||
PUBLIC int16 INTL_GetCSIDocCSID(
|
||||
INTL_CharSetInfo obj
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets the document charset ID field of the given charset info object.
|
||||
*
|
||||
* The document charset ID field is only set if the higher precedence fields
|
||||
* (override, HTTP and META) are all set to CS_DEFAULT.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @param docCharSetID Specifies the document charset ID
|
||||
* @see INTL_GetCSIDocCSID
|
||||
*/
|
||||
PUBLIC void INTL_SetCSIDocCSID(
|
||||
INTL_CharSetInfo obj,
|
||||
int16 docCharSetID
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the override document charset ID of the given charset info object.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @return The override document charset ID
|
||||
* @see INTL_SetCSIOverrideDocCSID
|
||||
*/
|
||||
PUBLIC int16 INTL_GetCSIOverrideDocCSID(
|
||||
INTL_CharSetInfo obj
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets the override document charset ID of the given charset info object.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @param overrideDocCharSetID Specifies the override document charset ID
|
||||
* @see INTL_GetCSIOverrideDocCSID
|
||||
*/
|
||||
PUBLIC void INTL_SetCSIOverrideDocCSID(
|
||||
INTL_CharSetInfo obj,
|
||||
int16 overrideDocCharSetID
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the HTML META document charset ID of the given charset info object.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @return The HTML META document charset ID
|
||||
* @see INTL_SetCSIMetaDocCSID
|
||||
*/
|
||||
PUBLIC int16 INTL_GetCSIMetaDocCSID(
|
||||
INTL_CharSetInfo obj
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets the HTML META document charset ID of the given charset info object.
|
||||
*
|
||||
* The HTML META document charset ID field is only set if the higher precedence
|
||||
* fields (override and HTTP) are all set to CS_DEFAULT.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @param metaCharSetID Specifies the HTML META document charset ID
|
||||
* @see INTL_GetCSIMetaDocCSID
|
||||
*/
|
||||
PUBLIC void INTL_SetCSIMetaDocCSID(
|
||||
INTL_CharSetInfo obj,
|
||||
int16 metaCharSetID
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the HTTP document charset ID of the given charset info object.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @return The HTTP document charset ID
|
||||
* @see INTL_SetCSIHTTPDocCSID
|
||||
*/
|
||||
PUBLIC int16 INTL_GetCSIHTTPDocCSID(
|
||||
INTL_CharSetInfo obj
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets the HTTP document charset ID of the given charset info object.
|
||||
*
|
||||
* The HTTP document charset ID field is only set if the higher precedence
|
||||
* field (override) is set to CS_DEFAULT.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @param httpDocCharSetID Specifies the HTTP document charset ID
|
||||
* @see INTL_GetCSIHTTPDocCSID
|
||||
*/
|
||||
PUBLIC void INTL_SetCSIHTTPDocCSID(
|
||||
INTL_CharSetInfo obj,
|
||||
int16 httpDocCharSetID
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the window charset ID of the given charset info object.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @return The window charset ID
|
||||
* @see INTL_SetCSIWinCSID
|
||||
*/
|
||||
PUBLIC int16 INTL_GetCSIWinCSID(
|
||||
INTL_CharSetInfo obj
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets the window charset ID field of the given charset info object.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @param winCharSetID Specifies the window charset ID
|
||||
* @see INTL_GetCSIWinCSID
|
||||
*/
|
||||
PUBLIC void INTL_SetCSIWinCSID(
|
||||
INTL_CharSetInfo obj,
|
||||
int16 winCharSetID
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the MIME charset field of the given charset info object.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @return The MIME charset
|
||||
* @see INTL_SetCSIMimeCharset
|
||||
*/
|
||||
PUBLIC char *INTL_GetCSIMimeCharset(
|
||||
INTL_CharSetInfo obj
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets the MIME charset field of the given charset info object.
|
||||
*
|
||||
* If the charset info object already contains a pointer to a MIME charset,
|
||||
* that charset is freed. Then the given charset is copied, and the copy is
|
||||
* converted to lower case. The copy is then set in the MIME charset field.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @param mime_charset Specifies the MIME charset
|
||||
* @see INTL_GetCSIMimeCharset
|
||||
*/
|
||||
PUBLIC void INTL_SetCSIMimeCharset(
|
||||
INTL_CharSetInfo obj,
|
||||
char *mime_charset
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the relayout field of the given charset info object.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @return The relayout field
|
||||
* @see INTL_SetCSIRelayoutFlag
|
||||
*/
|
||||
PUBLIC int16 INTL_GetCSIRelayoutFlag(
|
||||
INTL_CharSetInfo obj
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets the relayout field of the given charset info object.
|
||||
*
|
||||
* @param obj Specifies the charset info object
|
||||
* @param relayout Specifies the relayout field
|
||||
* @see INTL_GetCSIRelayoutFlag
|
||||
*/
|
||||
PUBLIC void INTL_SetCSIRelayoutFlag(
|
||||
INTL_CharSetInfo obj,
|
||||
int16 relayout
|
||||
);
|
||||
/*@}*/
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* INTL_CSI_H */
|
||||
176
mozilla/include/itapefs.h
Normal file
176
mozilla/include/itapefs.h
Normal file
@@ -0,0 +1,176 @@
|
||||
/* -*- 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 ITAPEFS_H
|
||||
#define ITAPEFS_H
|
||||
|
||||
#ifdef EDITOR
|
||||
//
|
||||
// Abstract output file stream.
|
||||
//
|
||||
class IStreamOut {
|
||||
public:
|
||||
IStreamOut();
|
||||
virtual ~IStreamOut();
|
||||
|
||||
virtual void Write( char *pBuffer, int32 iCount )=0;
|
||||
|
||||
// NOTICE: the implementation is not pure. There is a default
|
||||
// implementation that implements this function interms of
|
||||
// 'Write'.
|
||||
virtual int Printf( char * pFormat, ... );
|
||||
|
||||
enum EOutStreamStatus {
|
||||
EOS_NoError,
|
||||
EOS_DeviceFull,
|
||||
EOS_FileError
|
||||
};
|
||||
|
||||
virtual EOutStreamStatus Status(){ return EOS_NoError; }
|
||||
|
||||
// implemented in terms of the interface.
|
||||
void WriteInt( int32 i ){ Write( (char*)&i, sizeof( int32 ) ); }
|
||||
void WriteZString( char* pString);
|
||||
void WritePartialZString( char* pString, int32 start, int32 end);
|
||||
private:
|
||||
char* stream_buffer; // used to implement Printf
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Abstract File System
|
||||
//-----------------------------------------------------------------------
|
||||
typedef void
|
||||
EDT_ITapeFileSystemComplete( XP_Bool bSuccess, void *pArg );
|
||||
|
||||
class ITapeFileSystem {
|
||||
PRBool m_FirstBinary; // is the first file really binary, not text?
|
||||
public:
|
||||
ITapeFileSystem() { m_FirstBinary = PR_FALSE; }
|
||||
// ITapeFileSystem::File, ITapeFileSystem::Publish, or
|
||||
// ITapeFileSystem::MailSend,
|
||||
enum {File,Publish,MailSend};
|
||||
virtual intn GetType() = 0;
|
||||
|
||||
// This function is called before anything else. It tells the file
|
||||
// system the base url for the URLs added in AddFile().
|
||||
// An actual file, not a directory.
|
||||
virtual void SetSourceBaseURL( char* pURL )=0;
|
||||
|
||||
// DESCRIPTION:
|
||||
//
|
||||
// Add a name to the file system. It is up to the file system to localize
|
||||
// the name. For example, I could add 'http://home.netsacpe.com/
|
||||
// and the file system might decide that it should be called 'index.html'
|
||||
// if the file system were DOS, the url might be converted to INDEX.HTML
|
||||
//
|
||||
// pMIMEType may be NULL. In this case if the tape file system needs the
|
||||
// MIME type, it must figure it out by itself.
|
||||
//
|
||||
// RETURNS: index of the file (0 based), OR
|
||||
// ITapeFileSystem::Error if an error adding name, OR
|
||||
// ITapeFileSystem::SourceDestSame if adding
|
||||
// this name would result in the source and destination being the same, and thus
|
||||
// no point in copying the file.
|
||||
//
|
||||
// The first file added must be the root HTML document. (It is ok for the root
|
||||
// document to have the same source and dest URL).
|
||||
//
|
||||
virtual intn AddFile( char* pURL, char *pMIMEType, int16 iCharSetID)=0;
|
||||
|
||||
// Return the number of files added to the file system.
|
||||
virtual intn GetNumFiles()=0;
|
||||
|
||||
// Returns the absolute version of the URL given in AddFile(), using the
|
||||
// URL given in SetSourceBaseURL() as the base.
|
||||
// Allocated with XP_STRDUP().
|
||||
virtual char* GetSourceURL(intn iFileIndex)=0;
|
||||
|
||||
// Return the absolute destination of the HTML doc if meaningful, else return
|
||||
// NULL. Almost the same as "GetDestPathURL()+GetDestURL(0)" except that this call
|
||||
// will work before file 0 has been added to the file system.
|
||||
virtual char* GetDestAbsURL()=0;
|
||||
|
||||
// Gets the name of the RELATIVE url to place in the file. String is
|
||||
// allocated with XP_STRDUP();
|
||||
//
|
||||
virtual char* GetDestURL( intn iFileIndex )=0;
|
||||
|
||||
// Return the path URL associated with the ITapeFilesystem or NULL if there is none.
|
||||
// If NULL is returned, all URLs returned by GetDestURL() must be absolute.
|
||||
//
|
||||
// i.e. for a file or remote HTTP based ITapeFileSystem, this is the directory where the images are
|
||||
// stored. For a MHTML ITapeFileSystem this is NULL.
|
||||
//
|
||||
// String is allocated with XP_STRDUP().
|
||||
virtual char* GetDestPathURL() = 0;
|
||||
|
||||
//
|
||||
// Returns the name to display when saving the file, can be the same as
|
||||
// GetURLName. String is allocated with XP_STRDUP();
|
||||
//
|
||||
virtual char* GetHumanName( intn iFileIndex )=0;
|
||||
|
||||
enum {
|
||||
Error = -1, SourceDestSame = -2
|
||||
};
|
||||
|
||||
// Does the file referenced by iFileIndex already exist?
|
||||
// E.g. for the MHTML version, this will always return FALSE.
|
||||
virtual XP_Bool FileExists(intn iFileIndex) = 0;
|
||||
|
||||
// Will we be creating a new non-temporary file on the local machine.
|
||||
// Used to update SiteManager.
|
||||
virtual XP_Bool IsLocalPersistentFile(intn iFileIndex) = 0;
|
||||
|
||||
// ### mwelch Added so that multipart/related message saver can properly construct
|
||||
// messages using quoted/forwarded part data.
|
||||
// Tell the tape file system the mime type of a particular part.
|
||||
// Calling this overrides any previously determined mime type for this part.
|
||||
virtual void CopyURLInfo(intn iFileIndex, const URL_Struct *pURL) = 0;
|
||||
|
||||
//
|
||||
// Opens the output stream. Returns a stream that can be written to or NULL if error. All
|
||||
// 'AddFile's occur before the first OpenStream.
|
||||
// Do not delete the returned stream, just call CloseStream() when done.
|
||||
//
|
||||
virtual IStreamOut *OpenStream( intn iFileIndex )=0;
|
||||
|
||||
virtual void CloseStream( intn iFileIndex )=0;
|
||||
|
||||
// Called on completion, TRUE if completed successfully, FALSE if it failed.
|
||||
// The caller should not reference the ITapeFileSystem after calling Complete().
|
||||
// Caller does not free up memory for ITapeFileSystem, Complete() causes file system to delete itself.
|
||||
//
|
||||
// The tape file system will call pfComplete with pArg and with whether the ITapeFileSystem
|
||||
// completed successfully. Note: the ITapeFileSystem may call pfComplete() with TRUE even if
|
||||
// ITapeFileSystem::Complete() was given FALSE.
|
||||
// pfComplete may be NULL. Call to pfComplete may be synchronous or asynchronous.
|
||||
//
|
||||
// The ITapeFileSystem will call pfComplete(success,pArg) before deleting itself. I.e. the ITapeFileSystem is still valid
|
||||
// when it calls pfComplete().
|
||||
virtual void Complete( Bool bSuccess, EDT_ITapeFileSystemComplete *pfComplete, void *pArg )=0;
|
||||
|
||||
inline PRBool IsFirstBinary(void) { return m_FirstBinary; }
|
||||
inline void SetFirstBinary(void) { m_FirstBinary = PR_TRUE; }
|
||||
inline void ResetFirstBinary(void) { m_FirstBinary = PR_FALSE; }
|
||||
};
|
||||
|
||||
#endif // EDITOR
|
||||
|
||||
#endif
|
||||
139
mozilla/include/libc_r.h
Normal file
139
mozilla/include/libc_r.h
Normal file
@@ -0,0 +1,139 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
/* libc_r.h -- macros, defines, etc. to make using reentrant libc calls */
|
||||
/* a bit easier. This was initially done for AIX pthreads, */
|
||||
/* but should be usable for anyone... */
|
||||
|
||||
/* Most of these use locally defined space instead of static library space. */
|
||||
/* Because of this, we use the _INIT_R to declare/allocate space (stack), */
|
||||
/* and the plain routines to actually do it..._WARNING_: avoid allocating */
|
||||
/* memory wherever possible. Memory allocation is fairly expensive, at */
|
||||
/* least on AIX...use arrays instead (which allocate from the stack.) */
|
||||
/* I know the names are a bit strange, but I wanted to be fairly certain */
|
||||
/* that we didn't have any namespace corruption...in general, the inits are */
|
||||
/* R_<name>_INIT_R(), and the actual calls are R_<name>_R(). */
|
||||
|
||||
#ifndef _LIBC_R_H
|
||||
#define _LIBC_R_H
|
||||
|
||||
/************/
|
||||
/* strtok */
|
||||
/************/
|
||||
#define R_STRTOK_INIT_R() \
|
||||
char *r_strtok_r=NULL
|
||||
|
||||
#define R_STRTOK_R(return,source,delim) \
|
||||
return=strtok_r(source,delim,&r_strtok_r)
|
||||
|
||||
#define R_STRTOK_NORET_R(source,delim) \
|
||||
strtok_r(source,delim,&r_strtok_r)
|
||||
|
||||
/**************/
|
||||
/* strerror */
|
||||
/**************/
|
||||
#define R_MAX_STRERROR_LEN_R 8192 /* Straight from limits.h */
|
||||
|
||||
#define R_STRERROR_INIT_R() \
|
||||
char r_strerror_r[R_MAX_STRERROR_LEN_R]
|
||||
|
||||
#define R_STRERROR_R(val) \
|
||||
strerror_r(val,r_strerror_r,R_MAX_STRERROR_LEN_R)
|
||||
|
||||
/*****************/
|
||||
/* time things */
|
||||
/*****************/
|
||||
#define R_ASCTIME_INIT_R() \
|
||||
char r_asctime_r[26]
|
||||
|
||||
#define R_ASCTIME_R(val) \
|
||||
asctime_r(val,r_asctime_r)
|
||||
|
||||
#define R_CTIME_INIT_R() \
|
||||
char r_ctime_r[26]
|
||||
|
||||
#define R_CTIME_R(val) \
|
||||
ctime_r(val,r_ctime_r)
|
||||
|
||||
#define R_GMTIME_INIT_R() \
|
||||
struct tm r_gmtime_r
|
||||
|
||||
#define R_GMTIME_R(time) \
|
||||
gmtime_r(time,&r_gmtime_r)
|
||||
|
||||
#define R_LOCALTIME_INIT_R() \
|
||||
struct tm r_localtime_r
|
||||
|
||||
#define R_LOCALTIME_R(val) \
|
||||
localtime_r(val,&r_localtime_r)
|
||||
|
||||
/***********/
|
||||
/* crypt */
|
||||
/***********/
|
||||
#include <crypt.h>
|
||||
#define R_CRYPT_INIT_R() \
|
||||
CRYPTD r_cryptd_r; \
|
||||
bzero(&r_cryptd_r,sizeof(CRYPTD))
|
||||
|
||||
#define R_CRYPT_R(pass,salt) \
|
||||
crypt_r(pass,salt,&r_cryptd_r)
|
||||
|
||||
/**************/
|
||||
/* pw stuff */
|
||||
/**************/
|
||||
#define R_MAX_PW_LEN_R 1024
|
||||
/* The following must be after the last declaration, but */
|
||||
/* before the first bit of code... */
|
||||
#define R_GETPWNAM_INIT_R(pw_ptr) \
|
||||
struct passwd r_getpwnam_pw_r; \
|
||||
char r_getpwnam_line_r[R_MAX_PW_LEN_R]; \
|
||||
pw_ptr = &r_getpwnam_pw_r
|
||||
|
||||
#define R_GETPWNAM_R(name) \
|
||||
getpwnam_r(name,&r_getpwnam_pw_r,r_getpwnam_line_r,R_MAX_PW_LEN_R)
|
||||
|
||||
/*******************/
|
||||
/* gethost stuff */
|
||||
/*******************/
|
||||
#define R_GETHOSTBYADDR_INIT_R() \
|
||||
struct hostent r_gethostbyaddr_r; \
|
||||
struct hostent_data r_gethostbyaddr_data_r
|
||||
|
||||
#define R_GETHOSTBYADDR_R(addr,len,type,xptr_ent) \
|
||||
bzero(&r_gethostbyaddr_r,sizeof(struct hostent)); \
|
||||
bzero(&r_gethostbyaddr_data_r,sizeof(struct hostent_data)); \
|
||||
xptr_ent = &r_gethostbyaddr_r; \
|
||||
if (gethostbyaddr_r(addr,len,type, \
|
||||
&r_gethostbyaddr_r,&r_gethostbyaddr_data_r) == -1) { \
|
||||
xptr_ent = NULL; \
|
||||
}
|
||||
|
||||
#define R_GETHOSTBYNAME_INIT_R() \
|
||||
struct hostent r_gethostbyname_r; \
|
||||
struct hostent_data r_gethostbyname_data_r
|
||||
|
||||
#define R_GETHOSTBYNAME_R(name,xptr_ent) \
|
||||
bzero(&r_gethostbyname_r,sizeof(struct hostent)); \
|
||||
bzero(&r_gethostbyname_data_r,sizeof(struct hostent_data)); \
|
||||
xptr_ent = &r_gethostbyname_r; \
|
||||
if (gethostbyname_r(name, \
|
||||
&r_gethostbyname_r,&r_gethostbyname_data_r) == -1) { \
|
||||
xptr_ent = NULL; \
|
||||
}
|
||||
|
||||
#endif /* _LIBC_R_H */
|
||||
209
mozilla/include/libcnv.h
Normal file
209
mozilla/include/libcnv.h
Normal file
@@ -0,0 +1,209 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
//"libcnv.h"
|
||||
#ifndef _LIBCNV_H
|
||||
#define _LIBCNV_H
|
||||
#ifndef _IMAGE_CONVERT
|
||||
#error _IMAGE_CONVERT SYMBOL NEEDED BEFORE INCLUSION
|
||||
#endif /*_IMAGE_CONVERT*/
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef unsigned char BYTE;
|
||||
typedef uint32 DWORD;
|
||||
#endif
|
||||
|
||||
#include "xp_core.h"/*defines of int32 ect*/
|
||||
#include "xp_file.h"
|
||||
#include "xp_mem.h"/*XP_HUGE*/
|
||||
|
||||
#define MAXIMAGEPATHLEN 255
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CONV_CANCEL,
|
||||
CONV_OK,
|
||||
CONVERR_INVALIDSOURCE,
|
||||
CONVERR_INVALIDDEST,
|
||||
CONVERR_INVALIDFILEHEADER,
|
||||
CONVERR_INVALIDIMAGEHEADER,
|
||||
CONVERR_INVALIDBITDEPTH,
|
||||
CONVERR_INVALIDCOLORMAP,
|
||||
CONVERR_BADREAD,
|
||||
CONVERR_OUTOFMEMORY,
|
||||
CONVERR_JPEGERROR,
|
||||
CONVERR_COMPRESSED,
|
||||
CONVERR_BADPLANES,
|
||||
CONVERR_BADWRITE,
|
||||
CONVERR_INVALIDPARAMS,
|
||||
CONVERR_UNKNOWN,
|
||||
NUM_CONVERR
|
||||
}CONVERT_IMAGERESULT;
|
||||
|
||||
|
||||
|
||||
typedef BYTE * CONVERT_IMG_ROW;
|
||||
typedef CONVERT_IMG_ROW * CONVERT_IMG_ARRAY;
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
conv_unknown,
|
||||
conv_png,
|
||||
conv_jpeg,
|
||||
conv_bmp,
|
||||
conv_pict,
|
||||
conv_xpm,
|
||||
conv_rgb,
|
||||
conv_plugin
|
||||
}convimgenum;
|
||||
|
||||
|
||||
typedef struct tagCONVERT_IMG_STREAM
|
||||
{
|
||||
XP_HUGE_CHAR_PTR m_mem;
|
||||
FILE *m_file;/*used only with type 0 -must allready be opened for read or write does not use current index ect.*/
|
||||
int16 m_type;/*0=CONVERT_FILE 1=CONVERT_MEMORY*/
|
||||
DWORD m_streamsize;/* 0== unlimited */
|
||||
DWORD m_currentindex;
|
||||
}CONVERT_IMG_STREAM;
|
||||
|
||||
|
||||
|
||||
/*Sent in a BITMAP structure*/
|
||||
#define CONVERT_MEMORY 1
|
||||
#define CONVERT_FILE 0
|
||||
|
||||
|
||||
typedef struct tagCONVERT_IMGCONTEXT CONVERT_IMGCONTEXT;
|
||||
typedef struct tagCONVERT_IMG_INFO CONVERT_IMG_INFO;
|
||||
|
||||
typedef CONVERT_IMAGERESULT (*CONVERT_DIALOGIMAGECALLBACK)(CONVERT_IMGCONTEXT *input,
|
||||
CONVERT_IMGCONTEXT *outputarray,
|
||||
CONVERT_IMG_INFO *imginfo,
|
||||
int16 numoutput,
|
||||
CONVERT_IMG_ARRAY imagearray);
|
||||
typedef CONVERT_IMAGERESULT (*CONVERT_COMPLETECALLBACK)(CONVERT_IMGCONTEXT *outputarray,int16 p_numoutputs,void *hook);
|
||||
|
||||
typedef void (*CONVERT_BUFFERCALLBACK)(void *);/*j_common_ptr);*/
|
||||
|
||||
|
||||
|
||||
typedef struct tagCONVERT_CALLBACKS
|
||||
{
|
||||
CONVERT_DIALOGIMAGECALLBACK m_dialogimagecallback;
|
||||
CONVERT_BUFFERCALLBACK m_displaybuffercallback;
|
||||
CONVERT_COMPLETECALLBACK m_completecallback;
|
||||
}CONVERT_CALLBACKS;
|
||||
|
||||
|
||||
|
||||
typedef struct tagCONVERT_IMGCONTEXT
|
||||
{
|
||||
convimgenum m_imagetype;
|
||||
CONVERT_IMG_STREAM m_stream;/*used with m_streamtype 1,2*/
|
||||
int16 m_quality;
|
||||
char m_filename[MAXIMAGEPATHLEN];/*will not be used to open FILE *. used for output. maybe in future will open file?*/
|
||||
CONVERT_CALLBACKS m_callbacks;
|
||||
#ifdef XP_OS2
|
||||
XP_OS2_ARG(void *m_parentwindow);/*used for callbacks to bring up dialog boxes. void * = CWnd *for Windows*/
|
||||
#else
|
||||
XP_WIN_ARG(void *m_parentwindow);/*used for callbacks to bring up dialog boxes. void * = CWnd *for Windows*/
|
||||
#endif
|
||||
void *m_pMWContext;//used for callbacks to insert the image. and for plugins
|
||||
}CONVERT_IMGCONTEXT;
|
||||
|
||||
|
||||
|
||||
typedef struct tagCONVERT_IMG_INFO
|
||||
{
|
||||
BYTE *m_colormap;
|
||||
int16 m_numcolorentries;
|
||||
uint16 m_X_density;
|
||||
uint16 m_Y_density;
|
||||
int16 m_density_unit;
|
||||
int16 m_in_color_space;
|
||||
int16 m_input_components;
|
||||
int16 m_data_precision;
|
||||
int16 m_image_width;/*pixel width*/
|
||||
int16 m_image_height;/*pixel_height*/
|
||||
int16 m_bitsperpixel;
|
||||
int16 m_row_width;/*width in bytes*/
|
||||
int16 m_stride; /*row_width-(pixel_width*bpp)/8 */
|
||||
DWORD m_image_size; /*informational purposes*/
|
||||
}CONVERT_IMG_INFO;
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/****************************/
|
||||
/*API CALLS AND DECLARATIONS*/
|
||||
/****************************/
|
||||
|
||||
/*converts input to p_numoutput many outputs*/
|
||||
/*p_outpuffilenames must be a PREALLOCATED array of char *s at least p_numoutputs char *s these pointers will
|
||||
point to output filenames that YOU will be responsible to destroy!
|
||||
you may pass in null for p_outputfilenames and it wil*/
|
||||
CONVERT_IMAGERESULT convert_stream2image(CONVERT_IMGCONTEXT p_input,CONVERT_IMG_INFO *p_imageinfo,int16 p_numoutputs,char **p_outputfilenames);
|
||||
|
||||
/*quantize_pixels will change the imagearray to have only maxcolors distinct values*/
|
||||
CONVERT_IMAGERESULT convert_quantize_pixels(CONVERT_IMG_ARRAY imagearray,int16 imagewidth,int16 imageheight,int16 maxcolorvalue);
|
||||
|
||||
/*given a imagecontext, it will tell you if it is a png,bmp,gif ect*/
|
||||
convimgenum select_file_type (CONVERT_IMGCONTEXT * p_input);
|
||||
|
||||
/****************************/
|
||||
/*END API CALLS AND DECLARATIONS*/
|
||||
/****************************/
|
||||
|
||||
|
||||
/****************************/
|
||||
/*STREAM DECLARATIONS*/
|
||||
/****************************/
|
||||
|
||||
/*CONV_IMG_FREAD taken from JPEG libraries for independence from common header file*/
|
||||
#define CONV_IMG_FREAD(file,buf,sizeofbuf) \
|
||||
((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
|
||||
|
||||
#define ReadOK(file,buffer,len) (CONV_IMG_FREAD(file,buffer,len) == ((size_t) (len)))
|
||||
|
||||
int16 read_mem_stream(CONVERT_IMG_STREAM *p_stream,void *p_dest,uint16 p_bytecount);
|
||||
BYTE read_mem_stream_byte(CONVERT_IMG_STREAM *p_stream);
|
||||
int16 read_param(CONVERT_IMG_STREAM *p_input,void *p_dest,uint16 p_bytecount);
|
||||
BYTE read_param_byte(CONVERT_IMG_STREAM *p_input);
|
||||
/****************************/
|
||||
/*END STREAM DECLARATIONS*/
|
||||
/****************************/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
748
mozilla/include/libevent.h
Normal file
748
mozilla/include/libevent.h
Normal file
@@ -0,0 +1,748 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Header file for event passing between the mozilla thread and
|
||||
* the mocha thread
|
||||
*/
|
||||
|
||||
#ifndef libevent_h___
|
||||
#define libevent_h___
|
||||
|
||||
#include "libmocha.h"
|
||||
#include "prtypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "prevent.h"
|
||||
#else
|
||||
#include "plevent.h"
|
||||
#endif
|
||||
#include "shist.h"
|
||||
#include "fe_proto.h"
|
||||
#include "lo_ele.h"
|
||||
|
||||
NSPR_BEGIN_EXTERN_C
|
||||
|
||||
extern PREventQueue * mozilla_event_queue;
|
||||
|
||||
/*
|
||||
* XXX - should we use the same event values as layer events?
|
||||
*/
|
||||
|
||||
/* Event bits stored in the low end of decoder->event_mask. */
|
||||
#define EVENT_MOUSEDOWN 0x00000001
|
||||
#define EVENT_MOUSEUP 0x00000002
|
||||
#define EVENT_MOUSEOVER 0x00000004 /* user is mousing over a link */
|
||||
#define EVENT_MOUSEOUT 0x00000008 /* user is mousing out of a link */
|
||||
#define EVENT_MOUSEMOVE 0x00000010
|
||||
#define EVENT_MOUSEDRAG 0x00000020
|
||||
#define EVENT_CLICK 0x00000040 /* input element click in progress */
|
||||
#define EVENT_DBLCLICK 0x00000080
|
||||
#define EVENT_KEYDOWN 0x00000100
|
||||
#define EVENT_KEYUP 0x00000200
|
||||
#define EVENT_KEYPRESS 0x00000400
|
||||
#define EVENT_DRAGDROP 0x00000800 /* not yet implemented */
|
||||
#define EVENT_FOCUS 0x00001000 /* input focus event in progress */
|
||||
#define EVENT_BLUR 0x00002000 /* loss of focus event in progress */
|
||||
#define EVENT_SELECT 0x00004000 /* input field selection in progress */
|
||||
#define EVENT_CHANGE 0x00008000 /* field value change in progress */
|
||||
#define EVENT_RESET 0x00010000 /* form submit in progress */
|
||||
#define EVENT_SUBMIT 0x00020000 /* form submit in progress */
|
||||
#define EVENT_SCROLL 0x00040000 /* window is being scrolled */
|
||||
#define EVENT_LOAD 0x00080000 /* layout parsed a loaded document */
|
||||
#define EVENT_UNLOAD 0x00100000
|
||||
#define EVENT_XFER_DONE 0x00200000 /* document has loaded */
|
||||
#define EVENT_ABORT 0x00400000
|
||||
#define EVENT_ERROR 0x00800000
|
||||
#define EVENT_LOCATE 0x01000000
|
||||
#define EVENT_MOVE 0x02000000
|
||||
#define EVENT_RESIZE 0x04000000
|
||||
#define EVENT_FORWARD 0x08000000
|
||||
#define EVENT_HELP 0x10000000 /* for handling of help events */
|
||||
#define EVENT_BACK 0x20000000
|
||||
|
||||
/* #define EVENT_PRINT 0x20000000 *//* To be removed per joki */
|
||||
|
||||
#define STATUS_STOP 0x00000001 /* stop processing */
|
||||
#define STATUS_IGNORE 0x00000002 /* no new messages */
|
||||
|
||||
#define EVENT_ALT_MASK 0x00000001
|
||||
#define EVENT_CONTROL_MASK 0x00000002
|
||||
#define EVENT_SHIFT_MASK 0x00000004
|
||||
#define EVENT_META_MASK 0x00000008
|
||||
|
||||
#define ARGTYPE_NULL 0x00000001
|
||||
#define ARGTYPE_INT32 0x00000002
|
||||
#define ARGTYPE_BOOL 0x00000004
|
||||
#define ARGTYPE_STRING 0x00000008
|
||||
|
||||
#define SIZE_MAX 0x00000001
|
||||
#define SIZE_MIN 0X00000002
|
||||
/*
|
||||
* When the event has been processed by the backend, there will be
|
||||
* a front-end callback that gets called. If the event processed
|
||||
* successfully, the callback will be passed EVENT_OK. If the
|
||||
* event wasn't successful (i.e. the user canceled it) the return
|
||||
* status will be EVENT_CANCEL. If something radical happened
|
||||
* and the front-end should do nothing (i.e. mocha changed the
|
||||
* underlying context) the status will be EVENT_PANIC and the
|
||||
* front end should treat the context and element passed to the
|
||||
* exit routine as bogus
|
||||
*/
|
||||
typedef enum {
|
||||
EVENT_OK,
|
||||
EVENT_CANCEL,
|
||||
EVENT_PANIC
|
||||
} ETEventStatus;
|
||||
|
||||
/*
|
||||
* When a given event gets processed we may need to tell the front
|
||||
* end about it so that they can update the UI / continue the
|
||||
* operation. The context, lo_element, lType and whatever
|
||||
* field are all supplied by the original ET_SendEvent() call.
|
||||
* See ET_SendEvent() for a description of the values for
|
||||
* the status parameter
|
||||
*/
|
||||
typedef void
|
||||
(*ETClosureFunc)(MWContext * pContext, LO_Element * lo_element,
|
||||
int32 lType, void * whatever, ETEventStatus status);
|
||||
|
||||
/*
|
||||
* Someone has initiated a call to LM_EvaluateBuffer(). This function
|
||||
* gets called back with the result
|
||||
*/
|
||||
typedef void
|
||||
(*ETEvalAckFunc)(void * data, char * result_string, size_t result_length,
|
||||
char * wysiwyg_url, char * base_href, Bool valid);
|
||||
|
||||
/*
|
||||
* This function is called back after a layer's state has been restored
|
||||
* in a resize_relayout.
|
||||
*/
|
||||
typedef void
|
||||
(*ETRestoreAckFunc)(void * data, LO_BlockInitializeStruct *param);
|
||||
|
||||
/*
|
||||
* Typedef for a function taking a void pointer and
|
||||
* returning nothing
|
||||
*/
|
||||
typedef void
|
||||
(*ETVoidPtrFunc)(void * data);
|
||||
|
||||
/*
|
||||
* Typedef for a function taking a void pointer and
|
||||
* returning a bool
|
||||
*/
|
||||
typedef PRBool
|
||||
(*ETBoolPtrFunc)(void * data);
|
||||
|
||||
/*
|
||||
* Typedef for a function taking a void pointer and
|
||||
* returning a int32
|
||||
*/
|
||||
typedef int32
|
||||
(*ETIntPtrFunc)(void * data);
|
||||
|
||||
/*
|
||||
* Typedef for a function taking a void pointer and
|
||||
* returning a char *
|
||||
*/
|
||||
typedef char *
|
||||
(*ETStringPtrFunc)(void * data);
|
||||
|
||||
/*
|
||||
* Struct for passing JS typed variable info through C interface calls
|
||||
*/
|
||||
typedef union ArgVal {
|
||||
int32 intArg;
|
||||
XP_Bool boolArg;
|
||||
char * stringArg;
|
||||
} ArgVal;
|
||||
|
||||
typedef struct {
|
||||
uint8 type; /* arg type as defined at top of file */
|
||||
ArgVal value;
|
||||
} JSCompArg;
|
||||
|
||||
/*
|
||||
* Typedef for a function used to verify installed components and
|
||||
* get back components utility functions.
|
||||
*/
|
||||
typedef PRBool
|
||||
(*ETVerifyComponentFunc)(void **active_callback, void **startup_callback);
|
||||
|
||||
/*
|
||||
* Generic function for JS setting values with native calls.
|
||||
*/
|
||||
typedef void
|
||||
(*ETCompPropSetterFunc)(char *name, void *value);
|
||||
|
||||
/*
|
||||
* Generic function for JS getting values from native calls.
|
||||
*/
|
||||
typedef void*
|
||||
(*ETCompPropGetterFunc)(char *name);
|
||||
|
||||
/*
|
||||
* Generic function for JS calling native methods.
|
||||
*/
|
||||
typedef void*
|
||||
(*ETCompMethodFunc)(int32 argc, JSCompArg *argv);
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* Common prologue for talking between the mocha thread and the mozilla
|
||||
* thread
|
||||
*/
|
||||
typedef struct {
|
||||
PREvent event; /* the PREvent structure */
|
||||
MWContext* context; /* context */
|
||||
int32 doc_id; /* doc id of context when event launched */
|
||||
PRPackedBool handle_eagerly;
|
||||
} ETEvent;
|
||||
|
||||
/*
|
||||
* Struct to send back from front end in order to get additional
|
||||
* event information without having to initialize event object
|
||||
* until necessary. Yow, there is a lot of junk in here now
|
||||
* can we make a union out of some of these or are they always
|
||||
* needed?
|
||||
*/
|
||||
typedef struct {
|
||||
ETEvent ce;
|
||||
MochaDecoder * decoder;
|
||||
JSObject * object;
|
||||
int32 type;
|
||||
int32 layer_id;
|
||||
int32 id;
|
||||
LO_Element * lo_element;
|
||||
ETClosureFunc fnClosure; /* event sender closure */
|
||||
void * whatever; /* anything other state */
|
||||
int32 x,y;
|
||||
int32 docx,docy;
|
||||
int32 screenx,screeny;
|
||||
uint32 which;
|
||||
uint32 modifiers;
|
||||
void * data;
|
||||
uint32 dataSize;
|
||||
PRPackedBool saved;
|
||||
PRPackedBool event_handled;
|
||||
} JSEvent;
|
||||
|
||||
/*
|
||||
* Tell the backend about a new event.
|
||||
* The event is placed onto an event queue, it is not processed
|
||||
* immediately. If the event is the type that can be cancelled
|
||||
* by the backend (i.e. a button click or a submit) the front
|
||||
* end must wait until the callback routine gets called before
|
||||
* continuing with the operation. The ETEventStatus will be
|
||||
* EVENT_OK if the operation is to continue or EVENT_CANCEL
|
||||
* if it got cancelled.
|
||||
*
|
||||
* The processing of the event may cause the document to change
|
||||
* or even the whole window to close. In those cases the callback
|
||||
* will still get called in case there is any front-end cleanup
|
||||
* to do but the ETEventStatus will be set to EVENT_PANIC
|
||||
*
|
||||
*/
|
||||
|
||||
extern JSBool
|
||||
ET_SendEvent(MWContext * pContext, LO_Element *pElement, JSEvent *pEvent,
|
||||
ETClosureFunc fnClosure, void * whatever);
|
||||
|
||||
/*
|
||||
* Tell the backend about a new document load event. We need a
|
||||
* closure so that libparse/layout knows when its safe to discard
|
||||
* the old document when they were waiting for onunload events to
|
||||
* finish processing
|
||||
*/
|
||||
extern void
|
||||
ET_SendLoadEvent(MWContext * pContext, int32 type, ETVoidPtrFunc fnClosure,
|
||||
NET_StreamClass *stream, int32 layer_id, Bool resize_reload);
|
||||
|
||||
/*
|
||||
* Tell the backend about a new image event. Async. No closure
|
||||
*/
|
||||
extern void
|
||||
ET_SendImageEvent(MWContext * pContext, LO_ImageStruct *image_data,
|
||||
LM_ImageEvent event);
|
||||
|
||||
/*
|
||||
* Send an interrupt event to the current context
|
||||
* Remove all pending events for the event queue of the given context.
|
||||
*/
|
||||
extern void
|
||||
ET_InterruptContext(MWContext * pContext);
|
||||
|
||||
extern JSBool
|
||||
ET_ContinueProcessing(MWContext * pContext);
|
||||
|
||||
/*
|
||||
* Tell mocha to destroy the given context's data. The callback
|
||||
* function gets called when mocha is done with all of its data
|
||||
* that was associated with the context
|
||||
*/
|
||||
extern void
|
||||
ET_RemoveWindowContext(MWContext * context, ETVoidPtrFunc fn,
|
||||
void * data);
|
||||
|
||||
typedef struct {
|
||||
uint len, line_no;
|
||||
char * scope_to;
|
||||
void * data;
|
||||
JSVersion version;
|
||||
JSPrincipals * principals;
|
||||
JSBool want_result;
|
||||
JSBool unicode;
|
||||
} ETEvalStuff;
|
||||
|
||||
/*
|
||||
* Evaluate the mocha code in the given buffer
|
||||
*/
|
||||
extern void
|
||||
ET_EvaluateBuffer(MWContext * context, char * buffer, uint buflen,
|
||||
uint line_no, char * scope_to, JSBool want_result,
|
||||
ETEvalAckFunc fn, void * data,
|
||||
JSVersion ver, struct JSPrincipals *);
|
||||
|
||||
extern void
|
||||
ET_EvaluateScript(MWContext * context, char * buffer, ETEvalStuff * stuff,
|
||||
ETEvalAckFunc fn);
|
||||
|
||||
/*
|
||||
* Ask Mocha to reflect the given object into JavaScript
|
||||
*/
|
||||
extern void
|
||||
ET_ReflectObject(MWContext * pContext, void * lo_ele, void * tag,
|
||||
int32 layer_id, uint index, ReflectedObject type);
|
||||
|
||||
void
|
||||
ET_ReflectFormElement(MWContext * pContext, void * form,
|
||||
LO_FormElementStruct * form_element, PA_Tag * tag);
|
||||
|
||||
extern void
|
||||
ET_ReflectWindow(MWContext * pContext,
|
||||
PA_Block onLoad, PA_Block onUnload,
|
||||
PA_Block onFocus, PA_Block onBlur, PA_Block onHelp,
|
||||
PA_Block onMouseOver, PA_Block onMouseOut, PA_Block onDragDrop,
|
||||
PA_Block onMove, PA_Block onResize,
|
||||
PA_Block id, char *all,
|
||||
Bool bDelete, int newline_count);
|
||||
|
||||
/*
|
||||
* Tell mocha we are processing a form
|
||||
*/
|
||||
extern void
|
||||
ET_SetActiveForm(MWContext * pContext, struct lo_FormData_struct * loElement);
|
||||
|
||||
/*
|
||||
* Tell mocha which layer we are processing
|
||||
*/
|
||||
void
|
||||
ET_SetActiveLayer(MWContext * pContext, int32 layer_id);
|
||||
|
||||
/*
|
||||
** Tell mocha where to send its output
|
||||
*/
|
||||
extern void
|
||||
ET_ClearDecoderStream(MWContext * context, NET_StreamClass * old_stream);
|
||||
|
||||
extern void
|
||||
ET_SetDecoderStream(MWContext * context, NET_StreamClass *stream,
|
||||
URL_Struct *url_struct, JSBool free_stream_on_close);
|
||||
|
||||
/*
|
||||
** Remember the current nesting URL in the MochaDecoder
|
||||
*/
|
||||
extern void
|
||||
ET_SetNestingUrl(MWContext * context, char * szUrl);
|
||||
|
||||
/*
|
||||
** Remember the current language version in the MochaDecoder
|
||||
*/
|
||||
extern void
|
||||
ET_SetVersion(MWContext * context, JSVersion version);
|
||||
|
||||
/*
|
||||
* Tell mocha to trash the current document. around and around...
|
||||
*/
|
||||
extern void
|
||||
ET_ReleaseDocument(MWContext * pContext, JSBool resize_reload);
|
||||
|
||||
/*
|
||||
* Tell mocha to trash the layer's document.
|
||||
*/
|
||||
extern void
|
||||
ET_DestroyLayer(MWContext * pContext, JSObject *layer_obj);
|
||||
|
||||
extern void
|
||||
ET_MochaStreamComplete(MWContext * context, void * buf, int len,
|
||||
char * content_type, Bool isUnicode);
|
||||
|
||||
extern void
|
||||
ET_MochaStreamAbort(MWContext * context, int status);
|
||||
|
||||
/*
|
||||
* Called when a layer's contents are changing and we want to create
|
||||
* a new layer document.
|
||||
*/
|
||||
extern void
|
||||
ET_NewLayerDocument(MWContext *pContext, int32 layer_id);
|
||||
|
||||
extern void
|
||||
ET_DocWriteAck(MWContext *pContext, int status);
|
||||
|
||||
extern void
|
||||
ET_RegisterComponent(char *name, void *active_callback, void *startup_callback);
|
||||
|
||||
extern void
|
||||
ET_RegisterComponentProp(char *comp, char *name, uint8 retType, void *setter,
|
||||
void *getter);
|
||||
|
||||
extern void
|
||||
ET_RegisterComponentMethod(char *comp, char *name, uint8 retType, void *method,
|
||||
int32 argc);
|
||||
|
||||
/* =============================================================== */
|
||||
|
||||
/*
|
||||
* This event can be sent to both the mozilla thread and the moacha thread
|
||||
*/
|
||||
typedef struct {
|
||||
ETEvent ce;
|
||||
TimeoutCallbackFunction fnCallback;
|
||||
void* pClosure;
|
||||
uint32 ulTime;
|
||||
void* pTimerId;
|
||||
} MozillaEvent_Timeout;
|
||||
|
||||
|
||||
/* =============================================================== */
|
||||
|
||||
/*
|
||||
* Busy loop waiting for events to come along
|
||||
*/
|
||||
extern void PR_CALLBACK
|
||||
lm_wait_for_events(void *);
|
||||
|
||||
/*
|
||||
* global mocha event queues. It would be nice to not have these
|
||||
* exported this globally
|
||||
*/
|
||||
extern PREventQueue *lm_InterpretQueue;
|
||||
extern PREventQueue *lm_PriorityQueue;
|
||||
|
||||
/*
|
||||
* Ways to send events to the front end
|
||||
*/
|
||||
extern JSBool
|
||||
ET_PostMessageBox(MWContext* context, char* szMessage,
|
||||
JSBool bConfirm);
|
||||
|
||||
extern void
|
||||
ET_PostProgress(MWContext* context, const char* szMessage);
|
||||
|
||||
/* --- timeout routines --- */
|
||||
|
||||
/*
|
||||
* Set (or clear) a timeout to go off. The timeout will go off in the
|
||||
* mozilla thread so we will use the routine ET_FireTimeoutCallBack()
|
||||
* to get back into our thread to actually run the closure
|
||||
*/
|
||||
extern void *
|
||||
ET_PostSetTimeout(TimeoutCallbackFunction fnCallback,
|
||||
void * pClosure, uint32 ulTime, int32 doc_id);
|
||||
|
||||
extern void
|
||||
ET_PostClearTimeout(void * stuff);
|
||||
|
||||
extern void
|
||||
ET_FireTimeoutCallBack(void *);
|
||||
|
||||
/* --- end of timeout routines --- */
|
||||
|
||||
extern void
|
||||
ET_PostDestroyWindow(MWContext * context);
|
||||
|
||||
extern void
|
||||
ET_PostManipulateForm(MWContext * context, LO_Element * pForm, int32 action);
|
||||
|
||||
extern void
|
||||
ET_PostClearView(MWContext * context);
|
||||
|
||||
extern void
|
||||
ET_PostFreeImageElement(MWContext * context, void * stuff);
|
||||
|
||||
extern void
|
||||
ET_PostFreeImageContext(MWContext *context, IL_GroupContext *img_cx);
|
||||
|
||||
extern void
|
||||
ET_PostFreeAnonImages(MWContext *context, IL_GroupContext *img_cx);
|
||||
|
||||
extern void
|
||||
ET_PostDisplayImage(MWContext *, int, LO_ImageStruct *);
|
||||
|
||||
extern void
|
||||
ET_PostGetUrl(MWContext *, URL_Struct * pUrl);
|
||||
|
||||
extern char *
|
||||
ET_PostPrompt(MWContext* context, const char* szMessage,
|
||||
const char * szDefault);
|
||||
|
||||
extern MWContext *
|
||||
ET_PostNewWindow(MWContext* context, URL_Struct * pUrl,
|
||||
char * szName, Chrome * pChrome);
|
||||
|
||||
extern void
|
||||
ET_PostUpdateChrome(MWContext* context, Chrome * pChrome);
|
||||
|
||||
extern void
|
||||
ET_PostQueryChrome(MWContext* context, Chrome * pChrome);
|
||||
|
||||
extern void
|
||||
ET_PostGetScreenSize(MWContext* context, int32 *pX, int32 *pY);
|
||||
|
||||
extern void
|
||||
ET_PostGetAvailScreenRect(MWContext* context, int32 *pX, int32 *pY,
|
||||
int32 *pLeft, int32 *pTop);
|
||||
|
||||
extern void
|
||||
ET_PostGetColorDepth(MWContext* context, int32 *pPixel, int32 *pPallette);
|
||||
|
||||
extern char *
|
||||
ET_PostGetSelectedText(MWContext* context);
|
||||
|
||||
extern void
|
||||
ET_PostScrollDocTo(MWContext* context, int loc, int32 x, int32 y);
|
||||
|
||||
extern void
|
||||
ET_PostScrollDocBy(MWContext* context, int loc, int32 x, int32 y);
|
||||
|
||||
extern void
|
||||
ET_PostBackCommand(MWContext* context);
|
||||
|
||||
extern void
|
||||
ET_PostForwardCommand(MWContext* context);
|
||||
|
||||
extern void
|
||||
ET_PostHomeCommand(MWContext* context);
|
||||
|
||||
extern JSBool
|
||||
ET_PostFindCommand(MWContext* context, char * szName, JSBool matchCase,
|
||||
JSBool searchBackward);
|
||||
extern void
|
||||
ET_PostPrintCommand(MWContext* context);
|
||||
|
||||
extern void
|
||||
ET_PostOpenFileCommand(MWContext* context);
|
||||
|
||||
extern void
|
||||
ET_MakeHTMLAlert(MWContext * context, const char * szString);
|
||||
|
||||
/* respond to events sent to the mocha thread by the mozilla thread */
|
||||
|
||||
extern void
|
||||
ET_PostJsEventAck(MWContext* context, LO_Element * pEle, int type,
|
||||
ETClosureFunc fnClosure, void * pStuff,
|
||||
ETEventStatus status);
|
||||
|
||||
|
||||
|
||||
extern void
|
||||
ET_PostEvalAck(MWContext * context, int doc_id, void * data,
|
||||
char * str, size_t len, char * wysiwyg_url,
|
||||
char * base_href, Bool valid, ETEvalAckFunc fn);
|
||||
|
||||
extern void
|
||||
ET_PostRestoreAck(void *data, LO_BlockInitializeStruct *param,
|
||||
ETRestoreAckFunc fn);
|
||||
|
||||
/* netlib events */
|
||||
|
||||
extern char *
|
||||
ET_net_GetCookie(MWContext* context, int32 doc_id);
|
||||
|
||||
extern char *
|
||||
ET_net_SetCookieString(MWContext* context, char * szCookie, int32 doc_id);
|
||||
|
||||
extern NET_StreamClass *
|
||||
ET_net_CacheConverter(FO_Present_Types format, void * obj,
|
||||
URL_Struct *pUrl, MWContext * pContext);
|
||||
|
||||
extern void
|
||||
ET_net_FindURLInCache(URL_Struct * pUrl, MWContext * pContext);
|
||||
|
||||
extern NET_StreamClass *
|
||||
ET_net_StreamBuilder(FO_Present_Types format, URL_Struct *pUrl,
|
||||
MWContext * pContext);
|
||||
|
||||
/* layout events */
|
||||
|
||||
extern void
|
||||
ET_lo_ResetForm(MWContext * pContext, LO_Element * ele);
|
||||
|
||||
void
|
||||
ET_fe_SubmitInputElement(MWContext * pContext, LO_Element * ele);
|
||||
|
||||
/*
|
||||
* Synchronously shove the given text down the parser's processing
|
||||
* queue. If the currently loaded document is not equal to
|
||||
* doc_id, this message should be ignored since it arrived too
|
||||
* late for the intended document
|
||||
*/
|
||||
extern int
|
||||
ET_lo_DoDocWrite(JSContext *cx, MWContext * context, NET_StreamClass * stream,
|
||||
char * str, size_t len, int32 doc_id);
|
||||
|
||||
|
||||
extern void
|
||||
ET_il_GetImage(const char * str, MWContext * pContext, IL_GroupContext *img_cx,
|
||||
LO_ImageStruct * image_data, NET_ReloadMethod how);
|
||||
|
||||
extern void
|
||||
ET_il_SetGroupObserver(MWContext * pContext, IL_GroupContext *pImgCX, void *pDpyCX,
|
||||
JSBool bAddObserver);
|
||||
|
||||
extern void
|
||||
ET_InterruptImgCX(MWContext * pContext);
|
||||
|
||||
/*
|
||||
* Tell layout to trash the current document.
|
||||
*/
|
||||
extern void
|
||||
ET_lo_DiscardDocument(MWContext * pContext);
|
||||
|
||||
/*
|
||||
* Tell layout to prepare a layer for writing.
|
||||
*/
|
||||
extern Bool
|
||||
ET_lo_PrepareLayerForWriting(MWContext *context, int32 layer_id,
|
||||
const char *referer);
|
||||
|
||||
/*
|
||||
* Return a copy of the current history element. Caller must free
|
||||
*/
|
||||
extern History_entry *
|
||||
ET_shist_GetCurrent(MWContext * pContext);
|
||||
|
||||
/*
|
||||
* Return the current security status.
|
||||
*/
|
||||
extern int
|
||||
ET_GetSecurityStatus(MWContext * pContext);
|
||||
|
||||
/*
|
||||
* Make sure Mocha/Java glue is ready. Returns the same return code as
|
||||
* LM_InitMoja.
|
||||
*/
|
||||
extern int
|
||||
ET_InitMoja(MWContext * pContext);
|
||||
|
||||
/*
|
||||
* Pack up toys and go home
|
||||
*/
|
||||
extern void
|
||||
ET_FinishMocha(void);
|
||||
|
||||
/*
|
||||
* Used to call a stream completion function in the mozilla
|
||||
* thread
|
||||
*/
|
||||
extern void
|
||||
ET_moz_CallFunction(ETVoidPtrFunc fn, void * data);
|
||||
|
||||
extern void
|
||||
ET_moz_CallFunctionAsync(ETVoidPtrFunc fn, void * data);
|
||||
|
||||
extern PRBool
|
||||
ET_moz_CallFunctionBool(ETBoolPtrFunc fn, void * data);
|
||||
|
||||
extern int32
|
||||
ET_moz_CallFunctionInt(ETIntPtrFunc fn, void * data);
|
||||
|
||||
extern char *
|
||||
ET_moz_CallFunctionString(ETStringPtrFunc fn, void * data);
|
||||
|
||||
extern void
|
||||
ET_moz_CallAsyncAndSubEventLoop(ETVoidPtrFunc fn, void *data,
|
||||
MWContext *context);
|
||||
|
||||
extern void
|
||||
ET_moz_Abort(MKStreamAbortFunc fn, void * data, int status);
|
||||
|
||||
extern void
|
||||
ET_moz_SetMochaWriteStream(MochaDecoder * decoder);
|
||||
|
||||
extern NET_StreamClass *
|
||||
ET_moz_DocCacheConverter(MWContext * context, URL_Struct * pUrl,
|
||||
char * wysiwyg_url, int32 layer_id);
|
||||
|
||||
extern PRBool
|
||||
ET_moz_VerifyComponentFunction(ETVerifyComponentFunc fn, ETBoolPtrFunc *pActive_callback,
|
||||
ETVoidPtrFunc *pStartup_callback);
|
||||
|
||||
extern void
|
||||
ET_moz_CompSetterFunction(ETCompPropSetterFunc fn, char *name, void *data);
|
||||
|
||||
extern void *
|
||||
ET_moz_CompGetterFunction(ETCompPropGetterFunc fn, char *name);
|
||||
|
||||
extern void *
|
||||
ET_moz_CompMethodFunction(ETCompMethodFunc fn, int32 argc, JSCompArg *argv);
|
||||
|
||||
typedef enum {
|
||||
CL_Move,
|
||||
CL_MoveX,
|
||||
CL_MoveY,
|
||||
CL_Offset,
|
||||
CL_Resize,
|
||||
CL_SetBboxWidth,
|
||||
CL_SetBboxHeight,
|
||||
CL_SetBboxTop,
|
||||
CL_SetBboxLeft,
|
||||
CL_SetBboxBottom,
|
||||
CL_SetBboxRight,
|
||||
CL_SetHidden,
|
||||
CL_MoveInZ,
|
||||
CL_SetSrc,
|
||||
CL_SetSrcWidth,
|
||||
CL_SetZ,
|
||||
CL_SetBgColor,
|
||||
CL_SetBackdrop
|
||||
} ETLayerOp;
|
||||
|
||||
extern int
|
||||
ET_TweakLayer(MWContext * context, CL_Layer * layer, int32 x, int32 y,
|
||||
void *param_ptr, int32 param_val, ETLayerOp op,
|
||||
const char *referer, int32 doc_id);
|
||||
|
||||
extern void
|
||||
ET_RestoreLayerState(MWContext *context, int32 layer_id,
|
||||
LO_BlockInitializeStruct *param, ETRestoreAckFunc fn,
|
||||
void *data);
|
||||
|
||||
extern int32
|
||||
ET_npl_RefreshPluginList(MWContext* context, XP_Bool refreshInstances);
|
||||
|
||||
extern JSBool
|
||||
ET_HandlePref(JSContext * cx, uint argc, jsval * argv, jsval * rval);
|
||||
|
||||
extern void
|
||||
ET_SetPluginWindow(MWContext * pContext, void * app);
|
||||
|
||||
NSPR_END_EXTERN_C
|
||||
|
||||
#endif /* libevent_h___ */
|
||||
2651
mozilla/include/libi18n.h
Normal file
2651
mozilla/include/libi18n.h
Normal file
File diff suppressed because it is too large
Load Diff
538
mozilla/include/libmime.h
Normal file
538
mozilla/include/libmime.h
Normal file
@@ -0,0 +1,538 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
/* libmime.h --- external interface to libmime.a
|
||||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _LIBMIME_H_
|
||||
#define _LIBMIME_H_
|
||||
|
||||
#include "xp.h"
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
# define MIME_DRAFTS
|
||||
#endif
|
||||
|
||||
/* Opaque object describing a block of message headers, and a couple of
|
||||
routines for extracting data from one.
|
||||
*/
|
||||
|
||||
typedef struct MimeHeaders
|
||||
{
|
||||
char *all_headers; /* A char* of the entire header section. */
|
||||
int32 all_headers_fp; /* The length (it is not NULL-terminated.) */
|
||||
int32 all_headers_size; /* The size of the allocated block. */
|
||||
|
||||
XP_Bool done_p; /* Whether we've read the end-of-headers marker
|
||||
(the terminating blank line.) */
|
||||
|
||||
char **heads; /* An array of length n_headers which points
|
||||
to the beginning of each distinct header:
|
||||
just after the newline which terminated
|
||||
the previous one. This is to speed search.
|
||||
|
||||
This is not initialized until all the
|
||||
headers have been read.
|
||||
*/
|
||||
int32 heads_size; /* The length (and consequently, how many
|
||||
distinct headers are in here.) */
|
||||
|
||||
|
||||
char *obuffer; /* This buffer is used for output. */
|
||||
int32 obuffer_size;
|
||||
int32 obuffer_fp;
|
||||
|
||||
char *munged_subject; /* What a hack. This is a place to write down
|
||||
the subject header, after it's been
|
||||
charset-ified and stuff. Remembered so that
|
||||
we can later use it to generate the
|
||||
<TITLE> tag. */
|
||||
} MimeHeaders;
|
||||
|
||||
typedef struct MimeDisplayOptions MimeDisplayOptions;
|
||||
typedef struct MimeParseStateObject MimeParseStateObject;
|
||||
#ifndef MOZILLA_30
|
||||
typedef struct MSG_AttachmentData MSG_AttachmentData;
|
||||
#endif
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
/* Given the name of a header, returns the contents of that header as
|
||||
a newly-allocated string (which the caller must free.) If the header
|
||||
is not present, or has no contents, NULL is returned.
|
||||
|
||||
If `strip_p' is TRUE, then the data returned will be the first token
|
||||
of the header; else it will be the full text of the header. (This is
|
||||
useful for getting just "text/plain" from "text/plain; name=foo".)
|
||||
|
||||
If `all_p' is FALSE, then the first header encountered is used, and
|
||||
any subsequent headers of the same name are ignored. If TRUE, then
|
||||
all headers of the same name are appended together (this is useful
|
||||
for gathering up all CC headers into one, for example.)
|
||||
*/
|
||||
extern char *MimeHeaders_get(MimeHeaders *hdrs,
|
||||
const char *header_name,
|
||||
XP_Bool strip_p,
|
||||
XP_Bool all_p);
|
||||
|
||||
/* Given a header of the form of the MIME "Content-" headers, extracts a
|
||||
named parameter from it, if it exists. For example,
|
||||
MimeHeaders_get_parameter("text/plain; charset=us-ascii", "charset")
|
||||
would return "us-ascii".
|
||||
|
||||
Returns NULL if there is no match, or if there is an allocation failure.
|
||||
*/
|
||||
extern char *MimeHeaders_get_parameter (const char *header_value,
|
||||
const char *parm_name);
|
||||
|
||||
extern MimeHeaders *MimeHeaders_copy (MimeHeaders *srcHeaders);
|
||||
|
||||
extern void MimeHeaders_free (MimeHeaders *hdrs);
|
||||
|
||||
/* Some defines for various standard header field names.
|
||||
*/
|
||||
#define HEADER_BCC "BCC"
|
||||
#define HEADER_CC "CC"
|
||||
#define HEADER_CONTENT_BASE "Content-Base"
|
||||
#define HEADER_CONTENT_DESCRIPTION "Content-Description"
|
||||
#define HEADER_CONTENT_DISPOSITION "Content-Disposition"
|
||||
#define HEADER_CONTENT_ENCODING "Content-Encoding"
|
||||
#define HEADER_CONTENT_LENGTH "Content-Length"
|
||||
#define HEADER_CONTENT_NAME "Content-Name"
|
||||
#define HEADER_CONTENT_TRANSFER_ENCODING "Content-Transfer-Encoding"
|
||||
#define HEADER_CONTENT_TYPE "Content-Type"
|
||||
#define HEADER_DATE "Date"
|
||||
#define HEADER_DISTRIBUTION "Distribution"
|
||||
#define HEADER_FCC "FCC"
|
||||
#define HEADER_FOLLOWUP_TO "Followup-To"
|
||||
#define HEADER_FROM "From"
|
||||
#define HEADER_LINES "Lines"
|
||||
#define HEADER_MESSAGE_ID "Message-ID"
|
||||
#define HEADER_MIME_VERSION "MIME-Version"
|
||||
#define HEADER_NEWSGROUPS "Newsgroups"
|
||||
#define HEADER_ORGANIZATION "Organization"
|
||||
#define HEADER_REFERENCES "References"
|
||||
#define HEADER_REPLY_TO "Reply-To"
|
||||
#define HEADER_RESENT_COMMENTS "Resent-Comments"
|
||||
#define HEADER_RESENT_DATE "Resent-Date"
|
||||
#define HEADER_RESENT_FROM "Resent-From"
|
||||
#define HEADER_RESENT_MESSAGE_ID "Resent-Message-ID"
|
||||
#define HEADER_RESENT_SENDER "Resent-Sender"
|
||||
#define HEADER_RESENT_TO "Resent-To"
|
||||
#define HEADER_RESENT_CC "Resent-CC"
|
||||
#define HEADER_SENDER "Sender"
|
||||
#define HEADER_SUBJECT "Subject"
|
||||
#define HEADER_TO "To"
|
||||
#define HEADER_X_MAILER "X-Mailer"
|
||||
#define HEADER_X_NEWSREADER "X-Newsreader"
|
||||
#define HEADER_X_POSTING_SOFTWARE "X-Posting-Software"
|
||||
#define HEADER_X_MOZILLA_STATUS "X-Mozilla-Status"
|
||||
#define HEADER_X_MOZILLA_NEWSHOST "X-Mozilla-News-Host"
|
||||
#define HEADER_X_MOZILLA_DRAFT_INFO "X-Mozilla-Draft-Info"
|
||||
#define HEADER_X_UIDL "X-UIDL"
|
||||
#define HEADER_XREF "XREF"
|
||||
#define HEADER_X_SUN_CHARSET "X-Sun-Charset"
|
||||
#define HEADER_X_SUN_CONTENT_LENGTH "X-Sun-Content-Length"
|
||||
#define HEADER_X_SUN_CONTENT_LINES "X-Sun-Content-Lines"
|
||||
#define HEADER_X_SUN_DATA_DESCRIPTION "X-Sun-Data-Description"
|
||||
#define HEADER_X_SUN_DATA_NAME "X-Sun-Data-Name"
|
||||
#define HEADER_X_SUN_DATA_TYPE "X-Sun-Data-Type"
|
||||
#define HEADER_X_SUN_ENCODING_INFO "X-Sun-Encoding-Info"
|
||||
#define HEADER_X_PRIORITY "X-Priority"
|
||||
|
||||
#define HEADER_PARM_BOUNDARY "BOUNDARY"
|
||||
#define HEADER_PARM_FILENAME "FILENAME"
|
||||
#define HEADER_PARM_NAME "NAME"
|
||||
#define HEADER_PARM_TYPE "TYPE"
|
||||
|
||||
|
||||
typedef enum {
|
||||
MimeHeadersAll, /* Show all headers */
|
||||
MimeHeadersSome, /* Show all "interesting" headers */
|
||||
MimeHeadersSomeNoRef, /* Same, but suppress the `References' header
|
||||
(for when we're printing this message.) */
|
||||
MimeHeadersMicro, /* Show a one-line header summary */
|
||||
MimeHeadersMicroPlus, /* Same, but show the full recipient list as
|
||||
well (To, CC, etc.) */
|
||||
MimeHeadersCitation /* A one-line summary geared toward use in a
|
||||
reply citation ("So-and-so wrote:") */
|
||||
} MimeHeadersState;
|
||||
|
||||
|
||||
/* The signature for various callbacks in the MimeDisplayOptions structure.
|
||||
*/
|
||||
typedef char *(*MimeHTMLGeneratorFunction) (const char *data, void *closure,
|
||||
MimeHeaders *headers);
|
||||
|
||||
struct MimeDisplayOptions
|
||||
{
|
||||
const char *url; /* Base URL for the document. This string should
|
||||
be freed by the caller, after the parser
|
||||
completes (possibly at the same time as the
|
||||
MimeDisplayOptions itself.) */
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
MSG_Pane* pane; /* The libmsg pane object that corresponds to
|
||||
what we're showing. This is used by very
|
||||
little... */
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
MimeHeadersState headers; /* How headers should be displayed. */
|
||||
XP_Bool fancy_headers_p; /* Whether to do clever formatting of headers
|
||||
using tables, instead of spaces. */
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
XP_Bool output_vcard_buttons_p; /* Whether to output the buttons */
|
||||
/* on vcards. */
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
XP_Bool fancy_links_p; /* Whether to insert fancy links, so you can
|
||||
do things like click on an email address to
|
||||
add it to your address book. Something you
|
||||
don't want to do while printing. */
|
||||
|
||||
XP_Bool variable_width_plaintext_p; /* Whether text/plain messages should
|
||||
be in variable width, or fixed. */
|
||||
XP_Bool wrap_long_lines_p; /* Whether to wrap long lines in text/plain
|
||||
messages. */
|
||||
|
||||
XP_Bool rot13_p; /* Whether text/plain parts should be rotated
|
||||
Set by "?rot13=true" */
|
||||
XP_Bool no_inline_p; /* Whether inline display of attachments should
|
||||
be suppressed. Set by "?inline=false" */
|
||||
char *part_to_load; /* The particular part of the multipart which
|
||||
we are extracting. Set by "?part=3.2.4" */
|
||||
|
||||
XP_Bool write_html_p; /* Whether the output should be HTML, or raw. */
|
||||
|
||||
XP_Bool decrypt_p; /* Whether all traces of encryption should be
|
||||
eradicated -- this is only meaningful when
|
||||
write_html_p is FALSE; we set this when
|
||||
attaching a message for forwarding, since
|
||||
forwarding someone else a message that wasn't
|
||||
encrypted for them doesn't work. We have to
|
||||
decrypt it before sending it.
|
||||
*/
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
XP_Bool nice_html_only_p; /* If TRUE, then we only should write html if
|
||||
it's pretty HTML (stuff that we're willing
|
||||
to get shipped out in mail messages). If we
|
||||
can't generate nice stuff for some part,
|
||||
then don't say anything at all. */
|
||||
|
||||
XP_Bool dont_touch_citations_p; /* If TRUE, then we should leave citations
|
||||
alone in plaintext parts. If FALSE, then
|
||||
go ahead and tweak the fonts according
|
||||
to preferences. */
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
char *default_charset; /* If this is non-NULL, then it is the charset to
|
||||
assume when no other one is specified via a
|
||||
`charset' parameter.
|
||||
*/
|
||||
char *override_charset; /* If this is non-NULL, then we will assume that
|
||||
all data is in this charset, regardless of what
|
||||
the `charset' parameter of that part says.
|
||||
This overrides `default_charset' as well.
|
||||
(This is to cope with the fact that, in the
|
||||
real world, many messages are mislabelled with
|
||||
the wrong charset.)
|
||||
*/
|
||||
|
||||
/* =======================================================================
|
||||
Stream-related callbacks; for these functions, the `closure' argument
|
||||
is what is found in `options->stream_closure'. (One possible exception
|
||||
is for output_fn; see "output_closure" below.)
|
||||
*/
|
||||
void *stream_closure;
|
||||
|
||||
/* For setting up the display stream, so that the MIME parser can inform
|
||||
the caller of the type of the data it will be getting. */
|
||||
int (*output_init_fn) (const char *type,
|
||||
const char *charset,
|
||||
const char *name,
|
||||
const char *x_mac_type,
|
||||
const char *x_mac_creator,
|
||||
void *stream_closure);
|
||||
|
||||
/* How the MIME parser feeds its output (HTML or raw) back to the caller. */
|
||||
int (*output_fn) (char *buf, int32 size, void *closure);
|
||||
|
||||
/* Closure to pass to the above output_fn. If NULL, then the
|
||||
stream_closure is used. */
|
||||
void *output_closure;
|
||||
|
||||
/* A callback used to encapsulate an HTML section and to reset the
|
||||
HTML parser to its default state at the end of a section.
|
||||
start_p indicates whether this is being called just before the
|
||||
start or immediately after the end of the encapsulated HTML.
|
||||
layer_encapsulate_p indicates whether or not to put special
|
||||
ILAYER container tags around the HTML -- Also, when start_p is
|
||||
FALSE, this function should close off any tags we've left open,
|
||||
reset the font size and face, etc. This may be called multiple
|
||||
times -- in particular, it will be called at the end of each
|
||||
message part which might contain human-generated (and thus
|
||||
arbitrarily buggy) markup. The `abort_p' argument specifies
|
||||
whether it's ok for data to be discarded.
|
||||
*/
|
||||
int (*set_html_state_fn) (void *stream_closure,
|
||||
XP_Bool layer_encapsulate_p,
|
||||
XP_Bool start_p,
|
||||
XP_Bool abort_p);
|
||||
|
||||
/* A hook for the caller to perform charset-conversion before HTML is
|
||||
returned. Each set of characters which originated in a mail message
|
||||
(body or headers) will be run through this filter before being converted
|
||||
into HTML. (This should return bytes which may appear in an HTML file,
|
||||
ie, we must be able to scan through the string to search for "<" and
|
||||
turn it in to "<", and so on.)
|
||||
|
||||
`input' is a non-NULL-terminated string of a single line from the message.
|
||||
`input_length' is how long it is.
|
||||
`input_charset' is a string representing the charset of this string (as
|
||||
specified by MIME headers.)
|
||||
`output_charset' is the charset to which conversion is desired.
|
||||
`output_ret' is where a newly-malloced string is returned. It may be
|
||||
NULL if no translation is needed.
|
||||
`output_size_ret' is how long the returned string is (it need not be
|
||||
NULL-terminated.).
|
||||
*/
|
||||
int (*charset_conversion_fn) (const char *input_line, int32 input_length,
|
||||
const char *input_charset,
|
||||
const char *output_charset,
|
||||
char **output_ret, int32 *output_size_ret,
|
||||
void *stream_closure);
|
||||
|
||||
/* A hook for the caller to perform both charset-conversion and decoding of
|
||||
MIME-2 header fields (using RFC-1522 encoding.) Arguments and returned
|
||||
values are as for `charset_conversion_fn'.
|
||||
*/
|
||||
int (*rfc1522_conversion_fn) (const char *input_line, int32 input_length,
|
||||
const char *input_charset,
|
||||
const char *output_charset,
|
||||
char **output_ret, int32 *output_size_ret,
|
||||
void *stream_closure);
|
||||
|
||||
/* A hook for the caller to translate a time string into a prettier or more
|
||||
compact or localized form. */
|
||||
char *(*reformat_date_fn) (const char *old_date, void *stream_closure);
|
||||
|
||||
/* A hook for the caller to turn a file name into a content-type. */
|
||||
char *(*file_type_fn) (const char *filename, void *stream_closure);
|
||||
|
||||
/* A hook for the caller to turn a content-type into descriptive text. */
|
||||
char *(*type_description_fn) (const char *content_type,void *stream_closure);
|
||||
|
||||
/* A hook for the caller to turn a content-type into an image icon. */
|
||||
char *(*type_icon_name_fn) (const char *content_type, void *stream_closure);
|
||||
|
||||
/* A hook by which the user may be prompted for a password by the security
|
||||
library. (This is really of type `SECKEYGetPasswordKey'; see sec.h.) */
|
||||
void *(*passwd_prompt_fn)(void *arg1, void *arg2);
|
||||
void *passwd_prompt_fn_arg;
|
||||
|
||||
/* =======================================================================
|
||||
Various callbacks; for all of these functions, the `closure' argument
|
||||
is what is found in `html_closure'.
|
||||
*/
|
||||
void *html_closure;
|
||||
|
||||
/* For emitting some HTML before the start of the outermost message
|
||||
(this is called before any HTML is written to layout.) */
|
||||
MimeHTMLGeneratorFunction generate_header_html_fn;
|
||||
|
||||
/* For emitting some HTML after the outermost header block, but before
|
||||
the body of the first message. */
|
||||
MimeHTMLGeneratorFunction generate_post_header_html_fn;
|
||||
|
||||
/* For emitting some HTML at the very end (this is called after libmime
|
||||
has written everything it's going to write.) */
|
||||
MimeHTMLGeneratorFunction generate_footer_html_fn;
|
||||
|
||||
/* For turning a message ID into a loadable URL. */
|
||||
MimeHTMLGeneratorFunction generate_reference_url_fn;
|
||||
|
||||
/* For turning a mail address into a mailto URL. */
|
||||
MimeHTMLGeneratorFunction generate_mailto_url_fn;
|
||||
|
||||
/* For turning a newsgroup name into a news URL. */
|
||||
MimeHTMLGeneratorFunction generate_news_url_fn;
|
||||
|
||||
/* =======================================================================
|
||||
Callbacks to handle the backend-specific inlined image display
|
||||
(internal-external-reconnect junk.) For `image_begin', the `closure'
|
||||
argument is what is found in `stream_closure'; but for all of the
|
||||
others, the `closure' argument is the data that `image_begin' returned.
|
||||
*/
|
||||
|
||||
/* Begins processing an embedded image; the URL and content_type are of the
|
||||
image itself. */
|
||||
void *(*image_begin) (const char *image_url, const char *content_type,
|
||||
void *stream_closure);
|
||||
|
||||
/* Stop processing an image. */
|
||||
void (*image_end) (void *image_closure, int status);
|
||||
|
||||
/* Dump some raw image data down the stream. */
|
||||
int (*image_write_buffer) (char *buf, int32 size, void *image_closure);
|
||||
|
||||
/* What HTML should be dumped out for this image. */
|
||||
char *(*make_image_html) (void *image_closure);
|
||||
|
||||
|
||||
/* =======================================================================
|
||||
Other random opaque state.
|
||||
*/
|
||||
MimeParseStateObject *state; /* Some state used by libmime internals;
|
||||
initialize this to 0 and leave it alone.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef MIME_DRAFTS
|
||||
/* =======================================================================
|
||||
Mail Draft hooks -- 09-19-1996
|
||||
*/
|
||||
XP_Bool decompose_file_p; /* are we decomposing a mime msg
|
||||
into separate files */
|
||||
XP_Bool done_parsing_outer_headers; /* are we done parsing the outer message
|
||||
headers; this is really useful when
|
||||
we have multiple Message/RFC822
|
||||
headers */
|
||||
XP_Bool is_multipart_msg; /* are we decomposing a multipart
|
||||
message */
|
||||
|
||||
int decompose_init_count; /* used for non multipart message only
|
||||
*/
|
||||
|
||||
XP_Bool signed_p; /* to tell draft this is a signed
|
||||
message */
|
||||
|
||||
/* Callback to gather the outer most headers so we could use the
|
||||
information to initialize the addressing/subject/newsgroups fields
|
||||
for the composition window. */
|
||||
int (*decompose_headers_info_fn) (void *closure,
|
||||
MimeHeaders *headers);
|
||||
|
||||
/* Callbacks to create temporary files for drafts attachments. */
|
||||
int (*decompose_file_init_fn) (void *stream_closure,
|
||||
MimeHeaders *headers );
|
||||
|
||||
int (*decompose_file_output_fn) (char *buf, int32 size,
|
||||
void *stream_closure);
|
||||
|
||||
int (*decompose_file_close_fn) (void *stream_closure);
|
||||
#endif /* MIME_DRAFTS */
|
||||
|
||||
int32 attachment_icon_layer_id; /* Hackhackhack. This is zero if we have
|
||||
not yet emitted the attachment layer
|
||||
stuff. If we have, then this is the
|
||||
id number for that layer, which is a
|
||||
unique random number every time, to keep
|
||||
evil people from writing javascript code
|
||||
to hack it. */
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Mozilla-specific interfaces
|
||||
*/
|
||||
|
||||
/* Given a URL, this might return a better suggested name to save it as.
|
||||
|
||||
When you have a URL, you can sometimes get a suggested name from
|
||||
URL_s->content_name, but if you're saving a URL to disk before the
|
||||
URL_Struct has been filled in by netlib, you don't have that yet.
|
||||
|
||||
So if you're about to prompt for a file name *before* you call FE_GetURL
|
||||
with a format_out of FO_SAVE_AS, call this function first to see if it
|
||||
can offer you advice about what the suggested name for that URL should be.
|
||||
|
||||
(This works by looking in a cache of recently-displayed MIME objects, and
|
||||
seeing if this URL matches. If it does, the remembered content-name will
|
||||
be used.)
|
||||
*/
|
||||
extern char *MimeGuessURLContentName(MWContext *context, const char *url);
|
||||
|
||||
/* Given a URL, return the content type for the mime part, if the passed context
|
||||
recently parsed a message containing the part specified by the URL.
|
||||
This is used to figure out if we need to open the url in a browser window,
|
||||
or if we're just going to do a save as, anyay.
|
||||
*/
|
||||
extern char *MimeGetURLContentType(MWContext *context, const char *url);
|
||||
|
||||
|
||||
/* Determines whether the given context is currently showing a text/html
|
||||
message. (Used by libmsg to determine if replys should bring up the
|
||||
text/html editor. */
|
||||
|
||||
extern XP_Bool MimeShowingTextHtml(MWContext* context);
|
||||
|
||||
|
||||
|
||||
/* Yeech, hack... Determine the URL to use to save just the HTML part of the
|
||||
currently-displayed message to disk. If the current message doesn't have
|
||||
a text/html part, returns NULL. Otherwise, the caller must free the
|
||||
returned string using XP_FREE(). */
|
||||
|
||||
extern char* MimeGetHtmlPartURL(MWContext* context);
|
||||
|
||||
|
||||
/* Return how many attachments are in the currently-displayed message. */
|
||||
extern int MimeGetAttachmentCount(MWContext* context);
|
||||
|
||||
/* Returns what attachments are being viewed in the currently-displayed
|
||||
message. The returned data must be free'd using
|
||||
MimeFreeAttachmentList(). */
|
||||
extern int MimeGetAttachmentList(MWContext* context,
|
||||
MSG_AttachmentData** data);
|
||||
|
||||
extern void MimeFreeAttachmentList(MSG_AttachmentData* data);
|
||||
|
||||
|
||||
/* Call this when destroying a context; this frees up some memory.
|
||||
*/
|
||||
extern void MimeDestroyContextData(MWContext *context);
|
||||
|
||||
|
||||
/* After a message has been fully displayed (the document has finished
|
||||
loading) FEs call this with a Mail or News window to determine how
|
||||
the "security" toolbar button should be rendered.
|
||||
|
||||
The first two values are whether it was an encrypted and/or signed
|
||||
message; the second two are whether it was *valid*.
|
||||
*/
|
||||
extern void MIME_GetMessageCryptoState(MWContext *context,
|
||||
XP_Bool *signed_return,
|
||||
XP_Bool *encrypted_return,
|
||||
XP_Bool *signed_ok_return,
|
||||
XP_Bool *encrypted_ok_return);
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
/* Used only by libnet, this indicates that the user bonked on the "show me
|
||||
details about attachments" button. */
|
||||
|
||||
extern int MIME_DisplayAttachmentPane(MWContext* context);
|
||||
#endif /* MOZILLA_30 */
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* _LIBMIME_H_ */
|
||||
543
mozilla/include/libmocha.h
Normal file
543
mozilla/include/libmocha.h
Normal file
@@ -0,0 +1,543 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Header file for Mocha in the Navigator (libmocha).
|
||||
*/
|
||||
|
||||
#ifndef libmocha_h___
|
||||
#define libmocha_h___
|
||||
|
||||
#include "ntypes.h"
|
||||
#include "il_types.h"
|
||||
#include "prtypes.h"
|
||||
#include "plhash.h"
|
||||
#include "prthread.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
/* enable JavaScript Debugger support */
|
||||
#if defined (_WIN32) || defined(XP_UNIX) || defined(powerc) || defined(__powerc) || defined(XP_OS2)
|
||||
#ifdef JAVA
|
||||
#define JSDEBUGGER 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
NSPR_BEGIN_EXTERN_C
|
||||
|
||||
typedef struct JSTimeout JSTimeout;
|
||||
typedef struct JSPrincipalsList JSPrincipalsList;
|
||||
typedef struct JSNestingUrl JSNestingUrl;
|
||||
|
||||
/*
|
||||
* There exists one MochaDecoder per top-level MWContext that decodes Mocha,
|
||||
* either from an HTML page or from a "mocha:[expr]" URL.
|
||||
*/
|
||||
typedef struct MochaDecoder {
|
||||
int32 forw_count; /* forward reference count */
|
||||
int32 back_count; /* back (up the tree) count */
|
||||
JSContext *js_context;
|
||||
MWContext *window_context;
|
||||
JSObject *window_object;
|
||||
NET_StreamClass *stream;
|
||||
int32 stream_owner; /* id of layer that's loading the stream */
|
||||
URL_Struct *url_struct;
|
||||
JSTimeout *timeouts;
|
||||
JSTimeout *saved_timeouts;
|
||||
uint16 signature_ordinal;
|
||||
PRPackedBool replace_location;
|
||||
PRPackedBool resize_reload;
|
||||
PRPackedBool load_event_sent;
|
||||
PRPackedBool visited;
|
||||
PRPackedBool writing_input;
|
||||
PRPackedBool free_stream_on_close;
|
||||
PRPackedBool in_window_quota;
|
||||
PRPackedBool called_win_close;
|
||||
PRPackedBool principals_compromised;
|
||||
const char *source_url;
|
||||
JSNestingUrl *nesting_url;
|
||||
uint32 error_count;
|
||||
uint32 event_mask;
|
||||
int32 active_layer_id;
|
||||
uint32 active_form_id;
|
||||
uint32 event_bit;
|
||||
int32 doc_id;
|
||||
|
||||
/*
|
||||
* Class prototype objects, in alphabetical order. Must be CLEARed (set
|
||||
* to null) in LM_PutMochaDecoder, HELD (GC roots added) in lm_NewWindow,
|
||||
* and DROPped (removed as GC roots) in lm_DestroyWindow.
|
||||
* XXXbe clean up, clear via bzero, using a sub-structure.
|
||||
*/
|
||||
JSObject *anchor_prototype;
|
||||
JSObject *bar_prototype;
|
||||
JSObject *document_prototype;
|
||||
JSObject *event_prototype;
|
||||
JSObject *event_capturer_prototype;
|
||||
JSObject *event_receiver_prototype;
|
||||
JSObject *form_prototype;
|
||||
JSObject *image_prototype;
|
||||
JSObject *input_prototype;
|
||||
JSObject *layer_prototype;
|
||||
JSObject *option_prototype;
|
||||
JSObject *rect_prototype;
|
||||
JSObject *url_prototype;
|
||||
|
||||
/*
|
||||
* Window sub-objects. These must also follow the CLEAR/HOLD/DROP
|
||||
* protocol mentioned above.
|
||||
*/
|
||||
JSObject *document;
|
||||
JSObject *history;
|
||||
JSObject *location;
|
||||
JSObject *navigator;
|
||||
JSObject *components;
|
||||
JSObject *screen;
|
||||
JSObject *hardware;
|
||||
JSObject *crypto;
|
||||
JSObject *pkcs11;
|
||||
|
||||
/*
|
||||
* Ad-hoc GC roots.
|
||||
*/
|
||||
JSObject *event_receiver;
|
||||
JSObject *opener;
|
||||
|
||||
JSVersion firstVersion; /* First JS script tag version. */
|
||||
|
||||
/*
|
||||
* Security info for all of this decoder's scripts, except those
|
||||
* contained in layers.
|
||||
*/
|
||||
JSPrincipals *principals;
|
||||
JSPrincipalsList*early_access_list;
|
||||
|
||||
IL_GroupContext *image_context; /* Image context for anonymous images */
|
||||
|
||||
/*
|
||||
* Table that maintains an id to JS object mapping for reflected
|
||||
* elements. This is used during resize to reestablish the connection
|
||||
* between layout elements and their corresponding JS object.
|
||||
* Form elements are special, since they can't use the same keying
|
||||
*/
|
||||
PRHashTable *id_to_object_map;
|
||||
} MochaDecoder;
|
||||
|
||||
/*
|
||||
* Number of buckets for the id-to-object hash table.
|
||||
*/
|
||||
#define LM_ID_TO_OBJ_MAP_SIZE 20
|
||||
#define LM_FORM_ELEMENT_MAP_SIZE 10
|
||||
|
||||
/*
|
||||
* Types of objects reflected into Mocha
|
||||
*/
|
||||
typedef enum {
|
||||
LM_APPLETS = 0,
|
||||
LM_FORMS,
|
||||
LM_LINKS,
|
||||
LM_NAMEDANCHORS,
|
||||
LM_EMBEDS,
|
||||
LM_IMAGES,
|
||||
LM_FORMELEMENTS,
|
||||
LM_LAYERS
|
||||
} ReflectedObject;
|
||||
|
||||
/*
|
||||
* Generates an id-to-object mapping key from the ReflectedObject
|
||||
* type, the containing layer id and the id of the object itself.
|
||||
* The key is 4 bits type, 14 bits layer_id and 14 bits id.
|
||||
*/
|
||||
#define LM_GET_MAPPING_KEY(obj_type, layer_id, id) \
|
||||
(void *)(((((uint32)obj_type) << 28) & 0xF0000000UL) | \
|
||||
((((uint32)layer_id) << 14) & 0x0FFFC000UL) | \
|
||||
(((uint32)id) & 0x00003FFFUL))
|
||||
|
||||
/*
|
||||
* Public, well-known string constants.
|
||||
*/
|
||||
extern char js_language_name[]; /* "JavaScript" */
|
||||
extern char js_content_type[]; /* "application/x-javascript" */
|
||||
|
||||
/*
|
||||
* Initialize and finalize Mocha-in-the-client.
|
||||
*/
|
||||
extern void LM_InitMocha(void);
|
||||
extern void LM_FinishMocha(void);
|
||||
|
||||
/*
|
||||
* Force mocha on in the given context, even if the user pref is set to
|
||||
* disable mocha.
|
||||
*/
|
||||
extern void LM_ForceJSEnabled(MWContext *cx);
|
||||
|
||||
/*
|
||||
* Initialize and finalize Mocha-Java connection
|
||||
*/
|
||||
#define LM_MOJA_UNINITIALIZED 0
|
||||
#define LM_MOJA_OK 1
|
||||
#define LM_MOJA_JAVA_FAILED 2
|
||||
#define LM_MOJA_OUT_OF_MEMORY 3
|
||||
extern int LM_InitMoja(void);
|
||||
extern void LM_FinishMoja(void);
|
||||
extern int LM_IsMojaInitialized(void);
|
||||
|
||||
/*
|
||||
* Enter or leave the big mocha lock. Any thread which wants to
|
||||
* preserve JavaScript run-to-completion semantics must bracket
|
||||
* JavaScript evaluation with these calls.
|
||||
*/
|
||||
typedef void
|
||||
(PR_CALLBACK *JSLockReleaseFunc)(void * data);
|
||||
|
||||
|
||||
extern void PR_CALLBACK LM_LockJS(void);
|
||||
extern void PR_CALLBACK LM_UnlockJS(void);
|
||||
extern JSBool PR_CALLBACK LM_AttemptLockJS(JSLockReleaseFunc fn, void * data);
|
||||
extern JSBool PR_CALLBACK LM_ClearAttemptLockJS(JSLockReleaseFunc fn, void * data);
|
||||
extern PRBool PR_CALLBACK
|
||||
LM_HandOffJSLock(PRThread * oldOwner, PRThread *newOwner);
|
||||
|
||||
/*
|
||||
* For interruption purposes we will sometimes need to know the
|
||||
* context who is holding the JS lock
|
||||
*/
|
||||
extern void LM_JSLockSetContext(MWContext * context);
|
||||
extern MWContext * LM_JSLockGetContext(void);
|
||||
|
||||
/*
|
||||
* Enable/disable for Mocha-in-the-client.
|
||||
*/
|
||||
#define LM_SwitchMocha(toggle) LM_SetMochaEnabled(toggle)
|
||||
|
||||
extern JSBool
|
||||
LM_GetMochaEnabled(void);
|
||||
|
||||
/*
|
||||
* Get (create if necessary) a MochaDecoder for context, adding a reference
|
||||
* to its window_object. Put drops the reference, destroying window_object
|
||||
* when the count reaches zero. These functions should only be called in
|
||||
* the mocha thread or while holding the JS-lock
|
||||
*/
|
||||
extern MochaDecoder *
|
||||
LM_GetMochaDecoder(MWContext *context);
|
||||
|
||||
extern void
|
||||
LM_PutMochaDecoder(MochaDecoder *decoder);
|
||||
|
||||
/*
|
||||
* Get the source URL for script being loaded by document. This URL will be
|
||||
* the document's URL for inline script, or the SRC= URL for included script.
|
||||
* The returned pointer is safe only within the extent of the function that
|
||||
* calls LM_GetSourceURL().
|
||||
*/
|
||||
extern const char *
|
||||
LM_GetSourceURL(MochaDecoder *decoder);
|
||||
|
||||
/*
|
||||
* Set the current layer and hence the current scope for script evaluation.
|
||||
*/
|
||||
extern void
|
||||
LM_SetActiveLayer(MWContext * context, int32 layer_id);
|
||||
|
||||
/*
|
||||
* Get the current layer and hence the current scope for script evaluation.
|
||||
*/
|
||||
extern int32
|
||||
LM_GetActiveLayer(MWContext * context);
|
||||
|
||||
/*
|
||||
* Evaluate the contents of a SCRIPT tag. You can specify the JSObject
|
||||
* to use as the base scope. Pass NULL to use the default window_object
|
||||
*/
|
||||
extern JSBool
|
||||
LM_EvaluateBuffer(MochaDecoder *decoder, void *base, size_t length,
|
||||
uint lineno, char * scope_to, struct JSPrincipals *principals,
|
||||
JSBool unicode, jsval *result);
|
||||
|
||||
/*
|
||||
* Evaluate an expression entity in an HTML attribute (WIDTH="&{height/2};").
|
||||
* Returns null on error, otherwise a pointer to the malloc'd string result.
|
||||
* The caller is responsible for freeing the string result.
|
||||
*/
|
||||
extern char *
|
||||
LM_EvaluateAttribute(MWContext *context, char *expr, uint lineno);
|
||||
|
||||
/*
|
||||
* Remove any MochaDecoder window_context pointer to an MWContext that's
|
||||
* being destroyed.
|
||||
*/
|
||||
extern void
|
||||
LM_RemoveWindowContext(MWContext *context, History_entry * he);
|
||||
|
||||
extern void
|
||||
LM_DropSavedWindow(MWContext *context, void *window);
|
||||
|
||||
/*
|
||||
* Set and clear the HTML stream and URL for the MochaDecoder
|
||||
* associated with the given context
|
||||
*/
|
||||
extern JSBool
|
||||
LM_SetDecoderStream(MWContext * context, NET_StreamClass *stream,
|
||||
URL_Struct *url_struct, JSBool free_stream_on_close);
|
||||
|
||||
/*
|
||||
* Start caching HTML or plain text generated by document.write() where the
|
||||
* script is running on mc, the document is being generated into decoder's
|
||||
* window, and url_struct tells about the generator.
|
||||
*/
|
||||
extern NET_StreamClass *
|
||||
LM_WysiwygCacheConverter(MWContext *context, URL_Struct *url_struct,
|
||||
const char * wysiwyg_url, const char * base_href);
|
||||
|
||||
/*
|
||||
* Skip over the "wysiwyg://docid/" in url_string and return a pointer to the
|
||||
* real URL hidden after the prefix. If url_string is not of "wysiwyg:" type,
|
||||
* just return url_string. Never returns null.
|
||||
*/
|
||||
extern const char *
|
||||
LM_StripWysiwygURLPrefix(const char *url_string);
|
||||
|
||||
/*
|
||||
* This function works only on "wysiwyg:" type URLs -- don't call it unless
|
||||
* you know that NET_URL_Type(url_string) is WYSIWYG_TYPE_URL. It'll return
|
||||
* null if url_string seems too short, or if it can't find the third slash.
|
||||
*/
|
||||
extern const char *
|
||||
LM_SkipWysiwygURLPrefix(const char *url_string);
|
||||
|
||||
/*
|
||||
* Return a pointer to a malloc'd string of the form "<BASE HREF=...>" where
|
||||
* the "..." URL is the directory of cx's origin URL. Such a base URL is the
|
||||
* default base for relative URLs in generated HTML.
|
||||
*/
|
||||
extern char *
|
||||
LM_GetBaseHrefTag(JSContext *cx, JSPrincipals *principals);
|
||||
|
||||
/*
|
||||
* XXX Make these public LO_... typedefs in lo_ele.h/ntypes.h?
|
||||
*/
|
||||
struct lo_FormData_struct;
|
||||
struct lo_NameList_struct;
|
||||
|
||||
extern struct lo_FormData_struct *
|
||||
LO_GetFormDataByID(MWContext *context, int32 layer_id, intn form_id);
|
||||
|
||||
extern uint
|
||||
LO_EnumerateForms(MWContext *context, int32 layer_id);
|
||||
|
||||
extern struct LO_ImageStruct_struct *
|
||||
LO_GetImageByIndex(MWContext *context, int32 layer_id, intn image_id);
|
||||
|
||||
extern uint
|
||||
LO_EnumerateImages(MWContext *context, int32 layer_id);
|
||||
|
||||
/*
|
||||
* Reflect display layers into Mocha.
|
||||
*/
|
||||
extern JSObject *
|
||||
LM_ReflectLayer(MWContext *context, int32 layer_id, int32 parent_layer_id,
|
||||
PA_Tag *tag);
|
||||
|
||||
extern LO_FormElementStruct *
|
||||
LO_GetFormElementByIndex(struct lo_FormData_struct *form_data, int32 index);
|
||||
|
||||
extern uint
|
||||
LO_EnumerateFormElements(MWContext *context,
|
||||
struct lo_FormData_struct *form_data);
|
||||
|
||||
/*
|
||||
* Layout helper function to find a named anchor by its index in the
|
||||
* document.anchors[] array.
|
||||
*/
|
||||
extern struct lo_NameList_struct *
|
||||
LO_GetNamedAnchorByIndex(MWContext *context, int32 layer_id, uint index);
|
||||
|
||||
extern uint
|
||||
LO_EnumerateNamedAnchors(MWContext *context, int32 layer_id);
|
||||
|
||||
/*
|
||||
* Layout Mocha helper function to find an HREF Anchor by its index in the
|
||||
* document.links[] array.
|
||||
*/
|
||||
extern LO_AnchorData *
|
||||
LO_GetLinkByIndex(MWContext *context, int32 layer_id, uint index);
|
||||
|
||||
extern uint
|
||||
LO_EnumerateLinks(MWContext *context, int32 layer_id);
|
||||
|
||||
extern LO_JavaAppStruct *
|
||||
LO_GetAppletByIndex(MWContext *context, int32 layer_id, uint index);
|
||||
|
||||
extern uint
|
||||
LO_EnumerateApplets(MWContext *context, int32 layer_id);
|
||||
|
||||
extern LO_EmbedStruct *
|
||||
LO_GetEmbedByIndex(MWContext *context, int32 layer_id, uint index);
|
||||
|
||||
extern uint
|
||||
LO_EnumerateEmbeds(MWContext *context, int32 layer_id);
|
||||
|
||||
/*
|
||||
* Get and set a color attribute in the current document state.
|
||||
*/
|
||||
extern void
|
||||
LO_GetDocumentColor(MWContext *context, int type, LO_Color *color);
|
||||
|
||||
extern void
|
||||
LO_SetDocumentColor(MWContext *context, int type, LO_Color *color);
|
||||
|
||||
/*
|
||||
* Layout function to reallocate the lo_FormElementOptionData array pointed at
|
||||
* by lo_FormElementSelectData's options member to include space for the number
|
||||
* of options given by selectData->option_cnt.
|
||||
*/
|
||||
extern XP_Bool
|
||||
LO_ResizeSelectOptions(lo_FormElementSelectData *selectData);
|
||||
|
||||
/*
|
||||
* Discard the current document and all its subsidiary objects.
|
||||
*/
|
||||
extern void
|
||||
LM_ReleaseDocument(MWContext *context, JSBool resize_reload);
|
||||
|
||||
/*
|
||||
* Search if a the event is being captured in the frame hierarchy.
|
||||
*/
|
||||
extern XP_Bool
|
||||
LM_EventCaptureCheck(MWContext *context, uint32 current_event);
|
||||
|
||||
/*
|
||||
* Scroll a window to the given point.
|
||||
*/
|
||||
extern void LM_SendOnScroll(MWContext *context, int32 x, int32 y);
|
||||
|
||||
/*
|
||||
* Display a help topic.
|
||||
*/
|
||||
extern void LM_SendOnHelp(MWContext *context);
|
||||
|
||||
/*
|
||||
* Send a load or abort event for an image to a callback.
|
||||
*/
|
||||
typedef enum LM_ImageEvent {
|
||||
LM_IMGUNBLOCK = 0,
|
||||
LM_IMGLOAD = 1,
|
||||
LM_IMGABORT = 2,
|
||||
LM_IMGERROR = 3,
|
||||
LM_LASTEVENT = 3
|
||||
} LM_ImageEvent;
|
||||
|
||||
extern void
|
||||
LM_ProcessImageEvent(MWContext *context, LO_ImageStruct *image_data,
|
||||
LM_ImageEvent event);
|
||||
|
||||
/* This should be called when a named anchor is located. */
|
||||
extern JSBool
|
||||
LM_SendOnLocate(MWContext *context, struct lo_NameList_struct *name_rec);
|
||||
|
||||
extern JSObject *
|
||||
LM_ReflectApplet(MWContext *context, LO_JavaAppStruct *applet_data,
|
||||
PA_Tag * tag, int32 layer_id, uint index);
|
||||
|
||||
extern JSObject *
|
||||
LM_ReflectEmbed(MWContext *context, LO_EmbedStruct *lo_embed,
|
||||
PA_Tag * tag, int32 layer_id, uint index);
|
||||
|
||||
struct lo_FormData_struct;
|
||||
struct lo_NameList_struct;
|
||||
|
||||
extern JSObject *
|
||||
LM_ReflectForm(MWContext *context, struct lo_FormData_struct *form_data,
|
||||
PA_Tag * tag, int32 layer_id, uint index);
|
||||
|
||||
extern JSObject *
|
||||
LM_ReflectFormElement(MWContext *context, int32 layer_id, int32 form_id,
|
||||
int32 element_id, PA_Tag * tag);
|
||||
|
||||
extern JSObject *
|
||||
LM_ReflectLink(MWContext *context, LO_AnchorData *anchor_data, PA_Tag * tag,
|
||||
int32 layer_id, uint index);
|
||||
|
||||
extern JSObject *
|
||||
LM_ReflectNamedAnchor(MWContext *context, struct lo_NameList_struct *name_rec,
|
||||
PA_Tag * tag, int32 layer_id, uint index);
|
||||
|
||||
extern JSObject *
|
||||
LM_ReflectImage(MWContext *context, LO_ImageStruct *image_data,
|
||||
PA_Tag * tag, int32 layer_id, uint index);
|
||||
|
||||
extern JSBool
|
||||
LM_CanDoJS(MWContext *context);
|
||||
|
||||
extern JSBool
|
||||
LM_IsActive(MWContext *context);
|
||||
|
||||
/*
|
||||
* Security.
|
||||
*/
|
||||
|
||||
extern JSPrincipals *
|
||||
LM_NewJSPrincipals(URL_Struct *archive, char *name, const char *codebase);
|
||||
|
||||
extern char *
|
||||
LM_ExtractFromPrincipalsArchive(JSPrincipals *principals, char *name,
|
||||
uint *length);
|
||||
|
||||
extern JSBool
|
||||
LM_SetUntransformedSource(JSPrincipals *principals, char *original,
|
||||
char *transformed);
|
||||
|
||||
extern JSPrincipals * PR_CALLBACK
|
||||
LM_GetJSPrincipalsFromJavaCaller(JSContext *cx, int callerDepth);
|
||||
|
||||
/*
|
||||
* LM_RegisterPrincipals will verify and register a set of principals
|
||||
* in the decoder, modifying decoder->principals in the process. It
|
||||
* returns the modified decoder.
|
||||
*
|
||||
* The "name" parameter may be NULL if "principals" was created with a name.
|
||||
*/
|
||||
|
||||
extern JSPrincipals *
|
||||
LM_RegisterPrincipals(MochaDecoder *decoder, JSPrincipals *principals,
|
||||
char *name, char *src);
|
||||
/*
|
||||
* JavaScript Debugger support
|
||||
*/
|
||||
#ifdef JSDEBUGGER
|
||||
|
||||
extern NET_StreamClass*
|
||||
LM_StreamBuilder( int format_out,
|
||||
void *data_obj,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *mwcontext );
|
||||
|
||||
extern JSBool
|
||||
LM_GetJSDebugActive(void);
|
||||
|
||||
extern void
|
||||
LM_JamSourceIntoJSDebug( const char *filename,
|
||||
const char *str,
|
||||
int32 len,
|
||||
MWContext *mwcontext );
|
||||
|
||||
#endif
|
||||
|
||||
NSPR_END_EXTERN_C
|
||||
|
||||
#endif /* libmocha_h___ */
|
||||
29
mozilla/include/libnet.h
Normal file
29
mozilla/include/libnet.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------
|
||||
Collection of all the public libnet functions
|
||||
-----------------------------------------------------------------------------*/
|
||||
#ifndef _libnet_
|
||||
#define _libnet_
|
||||
|
||||
#include "mkutils.h"
|
||||
#include "mkstream.h"
|
||||
#include "mkgeturl.h"
|
||||
|
||||
#endif /* _libnet_ */
|
||||
|
||||
35
mozilla/include/libstyle.h
Normal file
35
mozilla/include/libstyle.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
|
||||
/* libstyle.h --- Exported style sheet routines */
|
||||
|
||||
#ifndef __LIBSTYLE_H_
|
||||
#define __LIBSTYLE_H_
|
||||
|
||||
#include "xp_core.h"
|
||||
#include "libmocha.h"
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
extern JSBool
|
||||
JSS_ResolveDocName(JSContext *mc, MWContext *context, JSObject *obj, jsval id);
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* __LIBSTYLE_H_ */
|
||||
1317
mozilla/include/lo_ele.h
Normal file
1317
mozilla/include/lo_ele.h
Normal file
File diff suppressed because it is too large
Load Diff
93
mozilla/include/m_cvstrm.h
Normal file
93
mozilla/include/m_cvstrm.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
** Mac_Convert_Stream.h
|
||||
** --------------------
|
||||
**
|
||||
** The header file for the constructing functions of apple file
|
||||
** encode/decode stream.
|
||||
**
|
||||
** 27sep95 mym created.
|
||||
*/
|
||||
|
||||
#ifndef M_CVStrm_h
|
||||
#define M_CVStrm_h
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
PUBLIC NET_StreamClass *
|
||||
fe_MakeBinHexEncodeStream (int format_out,
|
||||
void *data_obj,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *window_id,
|
||||
char* dst_filename);
|
||||
|
||||
PUBLIC NET_StreamClass *
|
||||
fe_MakeBinHexDecodeStream (int format_out,
|
||||
void *data_obj,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *window_id );
|
||||
|
||||
PUBLIC NET_StreamClass *
|
||||
fe_MakeAppleDoubleDecodeStream (int format_out,
|
||||
void *data_obj,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *window_id,
|
||||
XP_Bool write_as_binhex,
|
||||
char *dst_filename);
|
||||
|
||||
PUBLIC NET_StreamClass *
|
||||
fe_MakeAppleSingleDecodeStream (int format_out,
|
||||
void *data_obj,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *window_id,
|
||||
XP_Bool write_as_binhex,
|
||||
char *dst_filename);
|
||||
|
||||
#ifdef XP_MAC
|
||||
|
||||
PUBLIC NET_StreamClass *
|
||||
fe_MakeAppleDoubleEncodeStream (int format_out,
|
||||
void *data_obj,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *window_id,
|
||||
char* src_filename,
|
||||
char* dst_filename,
|
||||
char* separator);
|
||||
|
||||
XP_Bool isMacFile(char* filename);
|
||||
|
||||
#endif
|
||||
|
||||
PUBLIC NET_StreamClass *
|
||||
fe_MakeAppleDoubleDecodeStream_1 (int format_out,
|
||||
void *data_obj,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *window_id);
|
||||
|
||||
PUBLIC NET_StreamClass *
|
||||
fe_MakeAppleSingleDecodeStream_1 (int format_out,
|
||||
void *data_obj,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *window_id);
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif
|
||||
56
mozilla/include/makefile.win
Normal file
56
mozilla/include/makefile.win
Normal file
@@ -0,0 +1,56 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to install NSPR/INCLUDE header files into the distribution
|
||||
#// directory.
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the depth of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DEPTH = ..
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...)
|
||||
#// (these must come before the common makefiles are included)
|
||||
#//
|
||||
#// DIRS - There is a subdirectory to process
|
||||
#// INSTALL_FILES - Files to be installed in the distribution area
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
#INSTALL_FILE_LIST=*.h
|
||||
#INSTALL_DIR=$(XPDIST)\public\coreincl
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
||||
#export:: INSTALL_FILES
|
||||
|
||||
443
mozilla/include/mcom_db.h
Normal file
443
mozilla/include/mcom_db.h
Normal file
@@ -0,0 +1,443 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)db.h 8.7 (Berkeley) 6/16/94
|
||||
*/
|
||||
|
||||
#ifndef _DB_H_
|
||||
#define _DB_H_
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
#ifdef __sgi
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#define BIG_ENDIAN 4321
|
||||
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */
|
||||
#define __BIT_TYPES_DEFINED__
|
||||
#endif
|
||||
|
||||
#ifdef __sun
|
||||
#define BIG_ENDIAN 4321
|
||||
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */
|
||||
|
||||
#ifndef SVR4
|
||||
/* compat.h is only in 4.1.3 machines. - dp */
|
||||
#include <compat.h>
|
||||
#endif
|
||||
|
||||
/* XXX - dp
|
||||
* Need to find a general way of defining endian-ness in SunOS 5.3
|
||||
* SunOS 5.4 defines _BIG_ENDIAN and _LITTLE_ENDIAN
|
||||
* SunOS 5.3 does nothing like this.
|
||||
*/
|
||||
|
||||
#ifndef BYTE_ORDER
|
||||
|
||||
#if defined(_BIG_ENDIAN)
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#elif defined(_LITTLE_ENDIAN)
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#elif !defined(SVR4)
|
||||
/* 4.1.3 is always BIG_ENDIAN as it was released only on sparc platforms. */
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#elif !defined(vax) && !defined(ntohl) && !defined(lint) && !defined(i386)
|
||||
/* 5.3 big endian. Copied this above line from sys/byteorder.h */
|
||||
/* Now we are in a 5.3 SunOS rather non 5.4 or above SunOS */
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#else
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#endif /* !BYTE_ORDER */
|
||||
#endif /* __sun */
|
||||
|
||||
#ifdef __linux
|
||||
# include <endian.h>
|
||||
# ifndef BYTE_ORDER
|
||||
# define BYTE_ORDER __BYTE_ORDER
|
||||
# define BIG_ENDIAN __BIG_ENDIAN
|
||||
# define LITTLE_ENDIAN __LITTLE_ENDIAN
|
||||
# endif
|
||||
#endif /* __linux */
|
||||
|
||||
#if defined(SCO) || defined(UNIXWARE) || defined(SNI) || defined(NCR) || defined(NEC)
|
||||
#include <sys/types.h>
|
||||
#include <sys/byteorder.h>
|
||||
#endif
|
||||
|
||||
#ifdef SCO
|
||||
#include <sys/bitypes.h>
|
||||
#define MAXPATHLEN 1024
|
||||
#endif
|
||||
|
||||
#ifdef SNI
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#define BIG_ENDIAN 4321
|
||||
#define LITTLE_ENDIAN 1234
|
||||
#endif
|
||||
|
||||
#ifdef NCR
|
||||
#include <sys/endian.h>
|
||||
#endif
|
||||
|
||||
#ifdef macintosh
|
||||
#include <unix.h>
|
||||
#endif
|
||||
|
||||
#ifndef macintosh
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WINDOWS) || defined(XP_OS2)
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifndef XP_OS2
|
||||
#define MAXPATHLEN 1024
|
||||
#else
|
||||
#include "os2file.h" /* includes dirent.h */
|
||||
#endif
|
||||
|
||||
#define EFTYPE EINVAL /* POSIX 1003.1 format errno. */
|
||||
|
||||
#ifndef STDERR_FILENO
|
||||
#define STDIN_FILENO 0 /* ANSI C #defines */
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
#endif
|
||||
|
||||
#ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */
|
||||
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
|
||||
#endif
|
||||
|
||||
#ifdef BYTE_ORDER
|
||||
#undef BYTE_ORDER
|
||||
#endif
|
||||
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */
|
||||
#define BIG_ENDIAN 4321
|
||||
#endif
|
||||
|
||||
#if defined(_WINDOWS) && !defined(_WIN32)
|
||||
/* 16 bit windows defines */
|
||||
#define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef macintosh
|
||||
#include <stdio.h>
|
||||
#include "xp_mcom.h"
|
||||
#ifndef NSPR20
|
||||
#include "prmacos.h"
|
||||
#endif
|
||||
#define BIG_ENDIAN 4321
|
||||
#define LITTLE_ENDIAN 1234
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#define O_ACCMODE 3 /* Mask for file access modes */
|
||||
#define EFTYPE 2000
|
||||
XP_BEGIN_PROTOS
|
||||
int mkstemp(const char *path);
|
||||
XP_END_PROTOS
|
||||
#endif /* MACINTOSH */
|
||||
|
||||
#if defined(XP_OS2)
|
||||
#include <xp_mcom.h>
|
||||
#include <pros2os.h>
|
||||
XP_BEGIN_PROTOS
|
||||
int mkstemp(char *path);
|
||||
XP_END_PROTOS
|
||||
#endif
|
||||
|
||||
#ifndef macintosh
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_WINDOWS) && !defined(macintosh) && !defined(XP_OS2)
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#include "cdefs.h"
|
||||
|
||||
#ifndef _WINDOWS /* included above to prevent spurious warnings chouck 12-Sep-95 */
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#define RET_ERROR -1 /* Return values. */
|
||||
#define RET_SUCCESS 0
|
||||
#define RET_SPECIAL 1
|
||||
|
||||
#if defined(__386BSD__) || defined(SCO)
|
||||
#define __BIT_TYPES_DEFINED__
|
||||
#endif
|
||||
|
||||
#define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */
|
||||
|
||||
#ifndef __sgi
|
||||
typedef uint32 pgno_t;
|
||||
#endif
|
||||
|
||||
#define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */
|
||||
typedef uint16 indx_t;
|
||||
#define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */
|
||||
typedef uint32 recno_t;
|
||||
|
||||
/* define EFTYPE since most don't */
|
||||
#ifndef EFTYPE
|
||||
#define EFTYPE EINVAL /* POSIX 1003.1 format errno. */
|
||||
#endif
|
||||
|
||||
/* Key/data structure -- a Data-Base Thang. */
|
||||
typedef struct {
|
||||
void *data; /* data */
|
||||
size_t size; /* data length */
|
||||
} DBT;
|
||||
|
||||
/* Routine flags. */
|
||||
#define R_CURSOR 1 /* del, put, seq */
|
||||
#define __R_UNUSED 2 /* UNUSED */
|
||||
#define R_FIRST 3 /* seq */
|
||||
#define R_IAFTER 4 /* put (RECNO) */
|
||||
#define R_IBEFORE 5 /* put (RECNO) */
|
||||
#define R_LAST 6 /* seq (BTREE, RECNO) */
|
||||
#define R_NEXT 7 /* seq */
|
||||
#define R_NOOVERWRITE 8 /* put */
|
||||
#define R_PREV 9 /* seq (BTREE, RECNO) */
|
||||
#define R_SETCURSOR 10 /* put (RECNO) */
|
||||
#define R_RECNOSYNC 11 /* sync (RECNO) */
|
||||
|
||||
typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
|
||||
|
||||
typedef enum { LockOutDatabase, UnlockDatabase } DBLockFlagEnum;
|
||||
|
||||
/*
|
||||
* !!!
|
||||
* The following flags are included in the dbopen(3) call as part of the
|
||||
* open(2) flags. In order to avoid conflicts with the open flags, start
|
||||
* at the top of the 16 or 32-bit number space and work our way down. If
|
||||
* the open flags were significantly expanded in the future, it could be
|
||||
* a problem. Wish I'd left another flags word in the dbopen call.
|
||||
*
|
||||
* !!!
|
||||
* None of this stuff is implemented yet. The only reason that it's here
|
||||
* is so that the access methods can skip copying the key/data pair when
|
||||
* the DB_LOCK flag isn't set.
|
||||
*/
|
||||
#if UINT_MAX > 65535
|
||||
#define DB_LOCK 0x20000000 /* Do locking. */
|
||||
#define DB_SHMEM 0x40000000 /* Use shared memory. */
|
||||
#define DB_TXN 0x80000000 /* Do transactions. */
|
||||
#else
|
||||
#define DB_LOCK 0x2000 /* Do locking. */
|
||||
#define DB_SHMEM 0x4000 /* Use shared memory. */
|
||||
#define DB_TXN 0x8000 /* Do transactions. */
|
||||
#endif
|
||||
|
||||
/* Access method description structure. */
|
||||
typedef struct __db {
|
||||
DBTYPE type; /* Underlying db type. */
|
||||
int (*close) (struct __db *);
|
||||
int (*del) (const struct __db *, const DBT *, uint);
|
||||
int (*get) (const struct __db *, const DBT *, DBT *, uint);
|
||||
int (*put) (const struct __db *, DBT *, const DBT *, uint);
|
||||
int (*seq) (const struct __db *, DBT *, DBT *, uint);
|
||||
int (*sync) (const struct __db *, uint);
|
||||
void *internal; /* Access method private. */
|
||||
int (*fd) (const struct __db *);
|
||||
} DB;
|
||||
|
||||
#define BTREEMAGIC 0x053162
|
||||
#define BTREEVERSION 3
|
||||
|
||||
/* Structure used to pass parameters to the btree routines. */
|
||||
typedef struct {
|
||||
#define R_DUP 0x01 /* duplicate keys */
|
||||
uint32 flags;
|
||||
uint cachesize; /* bytes to cache */
|
||||
int maxkeypage; /* maximum keys per page */
|
||||
int minkeypage; /* minimum keys per page */
|
||||
uint psize; /* page size */
|
||||
int (*compare) /* comparison function */
|
||||
(const DBT *, const DBT *);
|
||||
size_t (*prefix) /* prefix function */
|
||||
(const DBT *, const DBT *);
|
||||
int lorder; /* byte order */
|
||||
} BTREEINFO;
|
||||
|
||||
#define HASHMAGIC 0x061561
|
||||
#define HASHVERSION 2
|
||||
|
||||
/* Structure used to pass parameters to the hashing routines. */
|
||||
typedef struct {
|
||||
uint bsize; /* bucket size */
|
||||
uint ffactor; /* fill factor */
|
||||
uint nelem; /* number of elements */
|
||||
uint cachesize; /* bytes to cache */
|
||||
uint32 /* hash function */
|
||||
(*hash) (const void *, size_t);
|
||||
int lorder; /* byte order */
|
||||
} HASHINFO;
|
||||
|
||||
/* Structure used to pass parameters to the record routines. */
|
||||
typedef struct {
|
||||
#define R_FIXEDLEN 0x01 /* fixed-length records */
|
||||
#define R_NOKEY 0x02 /* key not required */
|
||||
#define R_SNAPSHOT 0x04 /* snapshot the input */
|
||||
uint32 flags;
|
||||
uint cachesize; /* bytes to cache */
|
||||
uint psize; /* page size */
|
||||
int lorder; /* byte order */
|
||||
size_t reclen; /* record length (fixed-length records) */
|
||||
uint8 bval; /* delimiting byte (variable-length records */
|
||||
char *bfname; /* btree file name */
|
||||
} RECNOINFO;
|
||||
|
||||
/* #ifdef __DBINTERFACE_PRIVATE */
|
||||
/*
|
||||
* Little endian <==> big endian 32-bit swap macros.
|
||||
* M_32_SWAP swap a memory location
|
||||
* P_32_SWAP swap a referenced memory location
|
||||
* P_32_COPY swap from one location to another
|
||||
*/
|
||||
#define M_32_SWAP(a) { \
|
||||
uint32 _tmp = a; \
|
||||
((char *)&a)[0] = ((char *)&_tmp)[3]; \
|
||||
((char *)&a)[1] = ((char *)&_tmp)[2]; \
|
||||
((char *)&a)[2] = ((char *)&_tmp)[1]; \
|
||||
((char *)&a)[3] = ((char *)&_tmp)[0]; \
|
||||
}
|
||||
#define P_32_SWAP(a) { \
|
||||
uint32 _tmp = *(uint32 *)a; \
|
||||
((char *)a)[0] = ((char *)&_tmp)[3]; \
|
||||
((char *)a)[1] = ((char *)&_tmp)[2]; \
|
||||
((char *)a)[2] = ((char *)&_tmp)[1]; \
|
||||
((char *)a)[3] = ((char *)&_tmp)[0]; \
|
||||
}
|
||||
#define P_32_COPY(a, b) { \
|
||||
((char *)&(b))[0] = ((char *)&(a))[3]; \
|
||||
((char *)&(b))[1] = ((char *)&(a))[2]; \
|
||||
((char *)&(b))[2] = ((char *)&(a))[1]; \
|
||||
((char *)&(b))[3] = ((char *)&(a))[0]; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Little endian <==> big endian 16-bit swap macros.
|
||||
* M_16_SWAP swap a memory location
|
||||
* P_16_SWAP swap a referenced memory location
|
||||
* P_16_COPY swap from one location to another
|
||||
*/
|
||||
#define M_16_SWAP(a) { \
|
||||
uint16 _tmp = a; \
|
||||
((char *)&a)[0] = ((char *)&_tmp)[1]; \
|
||||
((char *)&a)[1] = ((char *)&_tmp)[0]; \
|
||||
}
|
||||
#define P_16_SWAP(a) { \
|
||||
uint16 _tmp = *(uint16 *)a; \
|
||||
((char *)a)[0] = ((char *)&_tmp)[1]; \
|
||||
((char *)a)[1] = ((char *)&_tmp)[0]; \
|
||||
}
|
||||
#define P_16_COPY(a, b) { \
|
||||
((char *)&(b))[0] = ((char *)&(a))[1]; \
|
||||
((char *)&(b))[1] = ((char *)&(a))[0]; \
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
__BEGIN_DECLS
|
||||
DB *dbopen (const char *, int, int, DBTYPE, const void *);
|
||||
|
||||
/* set or unset a global lock flag to disable the
|
||||
* opening of any DBM file
|
||||
*/
|
||||
void dbSetOrClearDBLock(DBLockFlagEnum type);
|
||||
|
||||
/* #ifdef __DBINTERFACE_PRIVATE */
|
||||
DB *__bt_open (const char *, int, int, const BTREEINFO *, int);
|
||||
DB *__hash_open (const char *, int, int, const HASHINFO *, int);
|
||||
DB *__rec_open (const char *, int, int, const RECNOINFO *, int);
|
||||
void __dbpanic (DB *dbp);
|
||||
/* #endif */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#if defined(linux) && !defined(MACLINUX)
|
||||
/*
|
||||
* Why you would want to override the system defines?
|
||||
*/
|
||||
#if BYTE_ORDER != LITTLE_ENDIAN
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__hpux) || defined(__hppa)
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#define BIG_ENDIAN 4321
|
||||
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */
|
||||
#endif
|
||||
|
||||
#if defined(AIXV3)
|
||||
/* BYTE_ORDER, LITTLE_ENDIAN, BIG_ENDIAN are all defined here */
|
||||
#include <sys/machine.h>
|
||||
#endif
|
||||
|
||||
#ifdef __alpha
|
||||
#include <endian.h>
|
||||
#endif
|
||||
|
||||
#endif /* !_DB_H_ */
|
||||
94
mozilla/include/mcom_ndbm.h
Normal file
94
mozilla/include/mcom_ndbm.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Margo Seltzer.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ndbm.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
#ifndef _NDBM_H_
|
||||
#define _NDBM_H_
|
||||
|
||||
#include "mcom_db.h"
|
||||
|
||||
/* Map dbm interface onto db(3). */
|
||||
#define DBM_RDONLY O_RDONLY
|
||||
|
||||
/* Flags to dbm_store(). */
|
||||
#define DBM_INSERT 0
|
||||
#define DBM_REPLACE 1
|
||||
|
||||
/*
|
||||
* The db(3) support for ndbm(3) always appends this suffix to the
|
||||
* file name to avoid overwriting the user's original database.
|
||||
*/
|
||||
#define DBM_SUFFIX ".db"
|
||||
|
||||
typedef struct {
|
||||
char *dptr;
|
||||
int dsize;
|
||||
} datum;
|
||||
|
||||
typedef DB DBM;
|
||||
#define dbm_pagfno(a) DBM_PAGFNO_NOT_AVAILABLE
|
||||
|
||||
__BEGIN_DECLS
|
||||
void dbm_close (DBM *);
|
||||
int dbm_delete (DBM *, datum);
|
||||
datum dbm_fetch (DBM *, datum);
|
||||
datum dbm_firstkey (DBM *);
|
||||
long dbm_forder (DBM *, datum);
|
||||
datum dbm_nextkey (DBM *);
|
||||
DBM *dbm_open (const char *, int, int);
|
||||
int dbm_store (DBM *, datum, datum, int);
|
||||
int dbm_dirfno (DBM *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_NDBM_H_ */
|
||||
74
mozilla/include/merrors.h
Normal file
74
mozilla/include/merrors.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/* -*- Mode: C; tab-width: 8; 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.
|
||||
*/
|
||||
|
||||
|
||||
/* merrors.h --- error codes for netlib. */
|
||||
|
||||
|
||||
#ifndef _MERRORS_H_
|
||||
#define _MERRORS_H_
|
||||
|
||||
/*
|
||||
* Return codes
|
||||
*/
|
||||
|
||||
#define MK_INTERRUPTED -201
|
||||
|
||||
#define MK_UNABLE_TO_CONVERT -208
|
||||
|
||||
#define MK_UNABLE_TO_LOGIN -210
|
||||
|
||||
#define MK_NO_NEWS_SERVER -224
|
||||
#define MK_USE_FTP_INSTEAD -225
|
||||
#define MK_USE_COPY_FROM_CACHE -226
|
||||
#define MK_EMPTY_NEWS_LIST -227
|
||||
|
||||
#define MK_MAILTO_NOT_READY -228
|
||||
|
||||
#define MK_OBJECT_NOT_IN_CACHE -239
|
||||
|
||||
#define MK_UNABLE_TO_LISTEN_ON_SOCKET -244
|
||||
|
||||
#define MK_WAITING_FOR_LOOKUP -248 /* response for async dns */
|
||||
#define MK_DO_REDIRECT -249 /* tells mkgeturl to redirect */
|
||||
|
||||
#define MK_MIME_NEED_B64 -270 /* used internally */
|
||||
#define MK_MIME_NEED_QP -271 /* used internally */
|
||||
#define MK_MIME_NEED_TEXT_CONVERTER -272 /* used internally */
|
||||
#define MK_MIME_NEED_PS_CONVERTER -273 /* used internally */
|
||||
|
||||
#define MK_IMAGE_LOSSAGE -277
|
||||
|
||||
#define MK_TOO_MANY_OPEN_FILES -310
|
||||
|
||||
#define MK_FILE_WRITE_ERROR -350
|
||||
|
||||
#define MK_GET_REST_OF_PARTIAL_FILE_FROM_NETWORK -399
|
||||
|
||||
#define MK_MULTIPART_MESSAGE_COMPLETED -437
|
||||
|
||||
#define MK_OFFLINE -438
|
||||
|
||||
/* success codes */
|
||||
#define MK_DATA_LOADED 1
|
||||
#define MK_NO_DATA 2
|
||||
#define MK_NO_ACTION 3
|
||||
#define MK_CHANGING_CONTEXT 4
|
||||
|
||||
|
||||
#endif /* _MERRORS_H_ */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user