home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / libnet / mkpadpac.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.8 KB  |  94 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. /* mkpadpac.h -- Proxy auto-discovery documentation.
  20.    Created: Judson Valeski, 01.15.1998
  21.  
  22.    Proxy auto-discovery (pad) allows the client to search for and use a 
  23.    pre-determined proxy auto-configuration (pac) file. The file it looks up 
  24.    and parses is named in the users prefs file (network.padPacURL). The feature
  25.    can be completely disabled by setting the network.enablePad preference to 
  26.    false.
  27.  
  28.    Holding to tradition, I've piggy-backed pad onto the current pac file 
  29.    implementation. If pad is enabled, the MKproxy_ac_url variable (as defined in
  30.    mkautocf.c/h) is set to point at the MK_padPacURL. This means that all the 
  31.    current pac file logic is used once a pac file is located by pad. A pad pac 
  32.    file is located by asyncronously searching for the host in the pad pac url 
  33.    in mkconect.c>NET_findAddress(). If the host is found then MKproxy_ac_url is
  34.    set to MK_padPacURL (this happens in mkgeturl.c>NET_getURL()) and we treat the 
  35.    pad pac file just like a pac file. The only difference is that when there's 
  36.    a problem with the pad pac file, we failover silently to a direct connection, 
  37.    no error messages get to the user. All the silent failover happens in 
  38.    mkautocf.c, except for one case in mkhttp.c which handles the case when there
  39.    is a problem actually loading the pac file itself.
  40.  */
  41.  
  42. #ifndef MKPADPAC_H
  43. #define MKPADPAC_H
  44.  
  45. #include "xp.h"
  46.  
  47. /* Pad js pref names */
  48. #define pref_padPacURL "network.padPacURL"
  49. #define pref_enablePad "network.enablePad"
  50.  
  51. /* Global pad variables */
  52. extern XP_Bool foundPADPAC;
  53. extern char *MK_padPacURL;
  54. extern XP_Bool MK_PadEnabled;
  55.  
  56. /* ***** FUNCTION PROTOTYPES */
  57.  
  58. /* Setup internal variables to use or not use the proxy 
  59.  * autodiscovery feature. Actually not that simple. */
  60. MODULE_PRIVATE void net_UsePadPac(XP_Bool useIt);
  61.  
  62. /* Return whether we're currently using a pac file via proxy autodiscovery. 
  63.  * This function takes three items into consideration:
  64.  * 1. Is padpac enabled.
  65.  * 2. Was the padpac host found.
  66.  * 3. Is the user's proxy style pref set to NONE (i.e. the user is set to go
  67.  *    direct connection, not proxy, or auto proxy.
  68.  * 
  69.  * If all these are true, then we're using a padpac file.
  70.  */
  71. PUBLIC XP_Bool NET_UsingPadPac(void);
  72.  
  73. /* Return whether or not we are currently in the process of loading
  74.  * a proxy autoconfig url. */
  75. PUBLIC XP_Bool NET_LoadingPac(void);
  76.  
  77. /* Set the MK_padPacURL varialbe to point to the url passed in,
  78.  * after checking the url for size limits. 
  79.  * Returns TRUE if successful, FALSE otherwise. */
  80. PUBLIC XP_Bool NET_SetPadPacURL(char * url);
  81.  
  82. /* Called by js prefs when the padpac url changes. */
  83. MODULE_PRIVATE int PR_CALLBACK net_PadPacURLPrefChanged(const char *pref, void *data);
  84.  
  85. /* Called by js prefs when the enable padpac pref changes. */
  86. MODULE_PRIVATE int PR_CALLBACK net_EnablePadPrefChanged(const char *pref, void *data);
  87.  
  88. /* Registers the above callbacks with js prefs. */
  89. PUBLIC void NET_RegisterPadPrefCallbacks(void);
  90.  
  91. /* ***** END FUNCTION PROTOTYPES */
  92.  
  93. #endif /* MKPADPAC_H */
  94.