home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / nsfast / root.9 / usr / ns-home / nsapi / include / netsite.h / netsite
Text File  |  1998-08-19  |  6KB  |  197 lines

  1. /*
  2.  * Copyright (c) 1994, 1995.  Netscape Communications Corporation.  All
  3.  * rights reserved.
  4.  * 
  5.  * Use of this software is governed by the terms of the license agreement for
  6.  * the Netscape FastTrack or Netscape Enterprise Server between the
  7.  * parties.
  8.  */
  9.  
  10.  
  11. /* ------------------------------------------------------------------------ */
  12.  
  13.  
  14. /*
  15.  * Standard defs for NetSite servers.
  16.  */
  17.  
  18.  
  19. #ifndef NETSITE_H
  20. #define NETSITE_H
  21.  
  22. #include "base/systems.h"  /* NSAPI_PUBLIC def */
  23.  
  24. #include "version.h"
  25.  
  26. #ifdef MCC_PROXY
  27. #define MAGNUS_VERSION PROXY_VERSION_DEF
  28. #define MAGNUS_VERSION_STRING PROXY_VERSION_STRING
  29.  
  30. #elif defined(NS_CMS)
  31. #define MAGNUS_VERSION CMS_VERSION_DEF
  32. #define MAGNUS_VERSION_STRING CMS_VERSION_STRING
  33.  
  34. #elif defined(NS_DS)
  35. #define MAGNUS_VERSION DS_VERSION_DEF
  36. #define MAGNUS_VERSION_STRING DS_VERSION_STRING
  37.  
  38. #elif defined(MCC_ADMSERV)
  39. #define MAGNUS_VERSION ADMSERV_VERSION_DEF
  40. #define MAGNUS_VERSION_STRING ADMSERV_VERSION_STRING
  41.  
  42. #elif defined(NS_CATALOG)
  43. #define MAGNUS_VERSION CATALOG_VERSION_DEF
  44. #define MAGNUS_VERSION_STRING CATALOG_VERSION_STRING
  45.  
  46. #elif defined(NS_RDS)
  47. #define MAGNUS_VERSION RDS_VERSION_DEF
  48. #define MAGNUS_VERSION_STRING RDS_VERSION_STRING
  49.  
  50. #elif defined(MCC_HTTPD)
  51.  
  52. #ifdef NS_PERSONAL
  53. #define MAGNUS_VERSION PERSONAL_VERSION_DEF
  54. #else
  55. #define MAGNUS_VERSION ENTERPRISE_VERSION_DEF
  56. #endif
  57.  
  58. #if defined(XP_UNIX) || defined(USE_ADMSERV)
  59. #if defined(NS_DS)
  60. #define MAGNUS_VERSION_STRING DS_VERSION_STRING
  61. #elif defined(NS_PERSONAL)
  62. #define MAGNUS_VERSION_STRING PERSONAL_VERSION_STRING
  63. #elif defined(NS_CATALOG)
  64. #define MAGNUS_VERSION_STRING CATALOG_VERSION_STRING
  65. #elif defined(NS_RDS)
  66. #define MAGNUS_VERSION_STRING RDS_VERSION_STRING
  67. #elif defined(NS_CMS)
  68. #define MAGNUS_VERSION_STRING CMS_VERSION_STRING
  69. #else
  70. #define MAGNUS_VERSION_STRING ENTERPRISE_VERSION_STRING
  71. #endif
  72. #endif /* XP_UNIX */
  73.  
  74. #elif defined(MCC_NEWS)
  75. #define MAGNUS_VERSION_STRING NEWS_VERSION_STRING
  76.  
  77. #elif defined(NS_MAIL)
  78. #define MAGNUS_VERSION MAIL_VERSION_DEF
  79. #define MAGNUS_VERSION_STRING MAIL_VERSION_STRING
  80.  
  81. #elif defined(MCC_BATMAN)
  82. #define MAGNUS_VERSION BATMAN_VERSION_DEF
  83. #define MAGNUS_VERSION_STRING BATMAN_VERSION_STRING
  84.  
  85. #endif
  86.  
  87. /* Used in some places as a length limit on error messages */
  88. #define MAGNUS_ERROR_LEN 8192
  89.  
  90. /* Carraige return and line feed */
  91. #define CR 13
  92. #define LF 10
  93. #ifdef XP_WIN32
  94. #define ENDLINE "\r\n"
  95. #else
  96. #define ENDLINE "\n"
  97. #endif
  98.  
  99. /* -------------------------- System version on NT------------------------- */
  100.  
  101. /* Encode the server version as a number to be able to provide inexpensive
  102.  * dynamic checks on server version - this isn't added in yet. */
  103.  
  104. #define ENTERPRISE_VERSION 1  
  105. #define PERSONAL_VERSION 2       
  106. #define CATALOG_VERSION 3      
  107. #define RDS_VERSION 4       
  108. #define CMS_VERSION 5
  109. #define DS_VERSION 6
  110.  
  111. /* Return server version */
  112. NSAPI_PUBLIC char *system_version();
  113.  
  114. #define server_fasttrack (!strcmp(MAGNUS_VERSION_STRING, PERSONAL_VERSION_STRING))
  115. #define server_enterprise (!strcmp(MAGNUS_VERSION_STRING, ENTERPRISE_VERSION_STRING))
  116.  
  117. /* This definition of MAGNUS_VERSION_STRING on NT should be used
  118.  * only when building the ns-http DLL */
  119.  
  120. #if defined(MCC_HTTPD) && defined(XP_WIN32) && !defined(USE_ADMSERV) && !defined(MCC_ADMSERV)
  121. #define MAGNUS_VERSION_STRING system_version()
  122. #endif /* XP_WIN32 */
  123.  
  124. /* Set server's version dynamically */
  125. NSAPI_PUBLIC void system_version_set(char *ptr);
  126.  
  127. /* -------------------------- Memory allocation --------------------------- */
  128.  
  129.  
  130. #include <stdlib.h>
  131.  
  132. /*
  133.    Depending on the system, memory allocated via these macros may come from 
  134.    an arena. If these functions are called from within an Init function, they 
  135.    will be allocated from permanent storage. Otherwise, they will be freed 
  136.    when the current request is finished.
  137.  */
  138.  
  139. #define MALLOC(size) system_malloc(size)
  140. NSAPI_PUBLIC void *system_malloc(int size);
  141.  
  142. #define CALLOC(size) system_calloc(size)
  143. NSAPI_PUBLIC void *system_calloc(int size);
  144.  
  145. #define REALLOC(ptr, size) system_realloc(ptr, size)
  146. NSAPI_PUBLIC void *system_realloc(void *ptr, int size);
  147.  
  148. #define FREE(ptr) system_free((void *) ptr)
  149. NSAPI_PUBLIC void system_free(void *ptr);
  150.  
  151. #define STRDUP(ptr) system_strdup(ptr)
  152. NSAPI_PUBLIC char *system_strdup(char *ptr);
  153.  
  154. /*
  155.    These macros always provide permanent storage, for use in global variables
  156.    and such. They are checked at runtime to prevent them from returning NULL.
  157.  */
  158.  
  159. #ifndef MALLOC_DEBUG
  160. #define PERM_MALLOC(size) system_malloc_perm(size)
  161. NSAPI_PUBLIC void *system_malloc_perm(int size);
  162.  
  163. #define PERM_CALLOC(size) system_calloc_perm(size)
  164. NSAPI_PUBLIC void *system_calloc_perm(int size);
  165.  
  166. #define PERM_REALLOC(ptr, size) system_realloc_perm(ptr, size)
  167. NSAPI_PUBLIC void *system_realloc_perm(void *ptr, int size);
  168.  
  169. #define PERM_FREE(ptr) system_free_perm((void *) ptr)
  170. NSAPI_PUBLIC void system_free_perm(void *ptr);
  171.  
  172. #define PERM_STRDUP(ptr) system_strdup_perm(ptr)
  173. NSAPI_PUBLIC char *system_strdup_perm(char *ptr);
  174.  
  175. #else
  176. #define PERM_MALLOC(size) system_malloc_perm(size, __LINE__, __FILE__)
  177. NSAPI_PUBLIC void *system_malloc_perm(int size, int line, char *file);
  178.  
  179. #define PERM_CALLOC(size) system_calloc_perm(size, __LINE__, __FILE__)
  180. NSAPI_PUBLIC void *system_calloc_perm(int size, int line, char *file);
  181.  
  182. #define PERM_REALLOC(ptr, size) system_realloc_perm(ptr, size, __LINE__, __FILE__)
  183. NSAPI_PUBLIC void *system_realloc_perm(void *ptr, int size, int line, char *file);
  184.  
  185. #define PERM_FREE(ptr) system_free_perm((void *) ptr, __LINE__, __FILE__)
  186. NSAPI_PUBLIC void system_free_perm(void *ptr, int line, char *file);
  187.  
  188. #define PERM_STRDUP(ptr) system_strdup_perm(ptr, __LINE__, __FILE__)
  189. NSAPI_PUBLIC char *system_strdup_perm(char *ptr, int line, char *file);
  190. #endif
  191.  
  192.  
  193. /* Not sure where to put this. */
  194. NSAPI_PUBLIC void magnus_atrestart(void (*fn)(void *), void *data);
  195.  
  196. #endif
  197.