home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / libnet / mkutils.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.9 KB  |  173 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. #ifndef MKUTILS_H
  19. #define MKUTILS_H
  20.  
  21. /* Used throughout netlib. */
  22. #ifndef MAXHOSTNAMELEN
  23. #define MAXHOSTNAMELEN 64
  24. #endif
  25.  
  26. /* use the fancy new mail reading stuff
  27.  */
  28. #undef NEW_MAIL_STUFF
  29.  
  30. #include "net.h"
  31. #include "xp.h"                 /* The cross-platform API */
  32. #include "mktrace.h"
  33. #include "mkselect.h"           /* needed by all files in netlib */
  34.  
  35. #define CONST const             /* "const" only exists in STDC? */
  36.  
  37. #include <stdlib.h>
  38. #include <stdio.h>
  39. #include <ctype.h>
  40. #ifdef XP_UNIX
  41. #include <unistd.h>
  42. #include <signal.h>
  43. #endif /* XP_UNIX */
  44. /*#include "version.h"*/
  45.  
  46. #ifndef NSPR20
  47. #if defined(__sun)
  48. # include "sunos4.h"
  49. #endif /* __sun */
  50. #endif /* NSPR20 */
  51.  
  52. #define FREE_AND_CLEAR(x) NET_f_a_c(&x) 
  53.  
  54. XP_BEGIN_PROTOS
  55. typedef struct WritePostDataData WritePostDataData;
  56. extern void NET_free_write_post_data_object(struct WritePostDataData *obj);
  57.  
  58. PUBLIC void 
  59. NET_SetDNSExpirationPref(int32 n);
  60. MODULE_PRIVATE int PR_CALLBACK
  61. NET_DNSExpirationPrefChanged(const char * newpref, void * data);
  62.  
  63. extern int NET_URL_Type (CONST char *URL);
  64. extern void del_front_spaces (char *string);
  65. extern void NET_f_a_c (char **obj);
  66.  
  67. extern void NET_ParseContentTypeHeader(MWContext *context, char *value, URL_Struct *URL_s, XP_Bool is_http);
  68.  
  69. /*
  70.  * This function takes an error code and associated error data
  71.  * and creates a string containing a textual description of
  72.  * what the error is and why it happened.
  73.  *
  74.  * The returned string is allocated and thus should be freed
  75.  * once it has been used.
  76.  *
  77.  * This function is defined in mkmessag.c.
  78.  */
  79. extern char * NET_ExplainErrorDetails (int code, ...);
  80.  
  81. /* Find an Author's mail address
  82.  *
  83.  * THE EMAIL ADDRESS IS CORRUPTED
  84.  *
  85.  * For example, returns "montulli@netscape.com" if given any of
  86.  *      " Lou Montullism <montulli@netscape.com> "
  87.  *  or  " montulli@netscape.com ( Lou "The Stud :)" Montulli ) "
  88.  *  or  "montulli@netscape.com"
  89. */
  90. extern char * NET_EmailAddress (char *email);
  91.  
  92. /* this function is called repeatably to write
  93.  * the post data body onto the network.
  94.  *
  95.  * Returns negative on fatal error
  96.  * Returns zero when done
  97.  * Returns positive if not yet completed
  98.  */
  99. extern int
  100. NET_WritePostData(MWContext  *context,
  101.                   URL_Struct *URL_s,
  102.                   PRFileDesc     *sock,
  103.                   void      **write_post_data_data,
  104.                   XP_Bool     add_crlf_to_line_endings);
  105.  
  106. extern char * NET_SpaceToPlus(char * string);
  107.  
  108. /* returns true if the functions thinks the string contains
  109.  * HTML
  110.  */
  111. extern Bool NET_ContainsHTML(char * string, int32 length);
  112.  
  113. /* try to make sure that this is a fully qualified
  114.  * email address including a host and domain
  115.  */
  116. extern Bool NET_IsFQDNMailAddress(const char * string);
  117.  
  118. extern int NET_UUEncode(unsigned char *src, unsigned char *dst, int srclen);
  119.  
  120. extern void NET_Progress(MWContext *context, char *msg);
  121.  
  122. /*
  123. #define AUTH_SKEY_DEFINED 
  124. */
  125. #ifdef AUTH_SKEY_DEFINED
  126. /* MD4 SKEY 64-bit password crunching and hashing function
  127.  * see skey.h for more details information.
  128.  */
  129. extern int keycrunch(char *result, char *seed, char *passwd);
  130. extern void f(char *x);
  131. #endif
  132.  
  133. /* returns Base64 encoded string
  134.  * caller must free
  135.  */
  136. extern char * NET_Base64Encode(char *src, int32 srclen);
  137.  
  138. /* returns Base64 decoded string
  139.  * caller must free
  140.  */
  141. extern char * NET_Base64Decode(char *src, int32 srclen);
  142.  
  143. /* a stub function for URN protocol converter.
  144.  * right now we only proxy URN's
  145.  * if URN's ever get worked on move this to another file
  146.  */
  147. extern void NET_InitURNProtocol(void);
  148.  
  149. /* a stub function for NFS protocol converter.
  150.  * right now we only proxy NFS's
  151.  * if NFS ever gets worked on move this to another file
  152.  */
  153. extern void NET_InitNFSProtocol(void);
  154.  
  155. /* a stub function for WAIS protocol converter.
  156.  * right now we only proxy WAIS 
  157.  * if WAIS ever gets worked on move this to another file
  158.  */
  159. extern void NET_InitWAISProtocol(void);
  160.  
  161. XP_END_PROTOS
  162. #ifndef FREE
  163. #define FREE(obj)    XP_FREE(obj)
  164. #endif
  165. #ifndef FREEIF
  166. #define FREEIF(obj)  {if(obj) {XP_FREE(obj); obj=0;}}
  167. #endif
  168.  
  169.  
  170. #endif /* MKUTILS_H */
  171.  
  172.  
  173.