home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / libnet / mkaccess.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.8 KB  |  132 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. #ifndef MKACCESS_H
  20. #define MKACCESS_H
  21.  
  22. #ifndef MKGETURL_H
  23. #include "mkgeturl.h"
  24. #endif
  25. /* returns TRUE if authorization is required
  26.  */
  27. extern Bool NET_AuthorizationRequired(char * address);
  28.  
  29. /* returns false if the user wishes to cancel authorization
  30.  * and TRUE if the user wants to continue with a new authorization
  31.  * string
  32.  */
  33. extern Bool NET_AskForAuthString(MWContext * context,
  34.                                      URL_Struct *URL_s,
  35.                                      char * authenticate,
  36.                                      char * prot_template,
  37.                                     Bool already_sent_auth);
  38.  
  39. /* returns a authorization string if one is required, otherwise
  40.  * returns NULL
  41.  */
  42. extern char * NET_BuildAuthString(MWContext * context, URL_Struct *URL_s);
  43.  
  44. /* removes all authorization structs from the auth list */
  45. extern void
  46. NET_RemoveAllAuthorizations();
  47.  
  48. /* removes all cookies structs from the cookie list */
  49. extern void
  50. NET_RemoveAllCookies();
  51.  
  52. /* returns TRUE if authorization is required
  53.  */
  54. extern char *
  55. NET_GetCookie(MWContext * context, char * address);
  56.  
  57. extern void
  58. NET_SetCookieString(MWContext * context,
  59.                      char * cur_url,
  60.                      char * set_cookie_header);
  61.  
  62. /* wrapper of NET_SetCookieString for netlib use. We need outformat and url_struct to determine
  63.  * whether we're dealing with inline cookies */
  64. extern void
  65. NET_SetCookieStringFromHttp(FO_Present_Types outputFormat,
  66.                             URL_Struct * URL_s,
  67.                             MWContext * context, 
  68.                             char * cur_url,
  69.                             char * set_cookie_header);
  70.  
  71. /* saves out the HTTP cookies to disk
  72.  *
  73.  * on entry pass in the name of the file to save
  74.  *
  75.  * returns 0 on success -1 on failure.
  76.  *
  77.  */
  78. extern int NET_SaveCookies(char * filename);
  79.  
  80. /* reads HTTP cookies from disk
  81.  *
  82.  * on entry pass in the name of the file to read
  83.  *
  84.  * returns 0 on success -1 on failure.
  85.  *
  86.  */
  87. extern int NET_ReadCookies(char * filename);
  88.  
  89.  
  90. /*
  91.  * Builds the Proxy-authorization string
  92.  */
  93. extern char *
  94. NET_BuildProxyAuthString(MWContext * context,
  95.              URL_Struct * url_s,
  96.              char * proxy_addr);
  97.  
  98. /*
  99.  * Returns FALSE if the user wishes to cancel proxy authorization
  100.  * and TRUE if the user wants to continue with a new authorization
  101.  * string.
  102.  */
  103. PUBLIC XP_Bool
  104. NET_AskForProxyAuth(MWContext * context,
  105.             char *   proxy_addr,
  106.             char *   pauth_params,
  107.             XP_Bool  already_sent_auth);
  108.  
  109. /*
  110.  * Figure out better of two {WWW,Proxy}-Authenticate headers;
  111.  * SimpleMD5 is better than Basic.  Uses the order of AuthType
  112.  * enum values.
  113.  *
  114.  */
  115. extern XP_Bool
  116. net_IsBetterAuth(char *new_auth, char *old_auth);
  117.  
  118. /* create an HTML stream and push a bunch of HTML about cookies */
  119. extern void
  120. NET_DisplayCookieInfoAsHTML(ActiveEntry * cur_entry);
  121.  
  122. MODULE_PRIVATE int PR_CALLBACK
  123. NET_CookieBehaviorPrefChanged(const char * newpref, void * data);
  124.  
  125. MODULE_PRIVATE int PR_CALLBACK
  126. NET_CookieWarningPrefChanged(const char * newpref, void * data);
  127.  
  128. MODULE_PRIVATE int PR_CALLBACK
  129. NET_CookieScriptPrefChanged(const char * newpref, void * data);
  130.  
  131. #endif /* MKACCESS_H */
  132.