home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / nsfast / root.9 / usr / ns-home / nsapi / include / frame / conf.h / conf
Text File  |  1998-08-19  |  6KB  |  218 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.  * conf.h: Deals with the server configuration file.
  16.  * 
  17.  * Object configuration is an entirely different matter. This deals with
  18.  * things like what port the server runs on, how many children it spawns,
  19.  * and other server-related issues. Information related configuration is
  20.  * handled by the object conf.
  21.  * 
  22.  * Rob McCool
  23.  */
  24.  
  25.  
  26. #ifndef CONF_H
  27. #define CONF_H
  28.  
  29. #include "netsite.h"
  30. #include "frame/objset.h"
  31. #include "base/daemon.h"        /* daemon struct */
  32.  
  33.  
  34. #ifdef XP_UNIX
  35. #include <pwd.h>      /* struct passwd */
  36. #endif /* XP_UNIX */
  37.  
  38. /* ------------------------------ Constants ------------------------------- */
  39.  
  40.  
  41. /* The longest line in the configuration file */
  42. #define CONF_MAXLEN 16384
  43.  
  44. #define LF 10
  45. #define CR 13
  46.  
  47.  
  48. #if defined(DAEMON_ANY)
  49. #ifdef MCC_PROXY
  50. #define DEFAULT_PORT 8080
  51. #else
  52. #define DEFAULT_PORT 80
  53. #endif
  54. #endif
  55.  
  56. #if defined(DAEMON_UNIX_MOBRULE) || defined(DAEMON_WIN32)
  57. #define DEFAULT_POOL_MAX 50
  58. #endif
  59.  
  60.  
  61.  
  62. /* ------------------------------- Globals -------------------------------- */
  63.  
  64.  
  65.  
  66. /*
  67.  * These server parameters are made global because they really don't
  68.  * belong anywhere else. 
  69.  */
  70.  
  71.  
  72. #include <sys/types.h>
  73.  
  74. /* These can't be macros because they're used in daemon.h. */
  75. extern char *pidfn;
  76. extern int port;
  77. extern char *chr;
  78.  
  79. #ifdef NET_SSL
  80. extern char *secure_keyfn;
  81. extern char *secure_certfn;
  82. extern int secure_auth;
  83. #endif
  84.  
  85. typedef struct {
  86.  
  87.     /* What port we listen to */
  88.     int Vport;
  89.  
  90.     /* What address to bind to */
  91.     char *Vaddr;
  92.  
  93.     /* User to run as */
  94. #define userpw conf_getglobals()->Vuserpw
  95.     struct passwd *Vuserpw;
  96.  
  97.     /* Directory to chroot to */
  98.     char *Vchr;
  99.  
  100.     /* Where to log our pid to */
  101.     char *Vpidfn;
  102.  
  103. #if defined(DAEMON_UNIX_MOBRULE) || defined(DAEMON_WIN32)
  104.     /* The maximum number of processes to keep in the pool */
  105. #define pool_max conf_getglobals()->Vpool_max
  106.     int Vpool_max;
  107.     /* The minimum number of processes to keep in the pool */
  108. #define pool_min conf_getglobals()->Vpool_min
  109.     int Vpool_min;
  110.     /* The maximum number of requests each process should handle. -1=default */
  111. #define pool_life conf_getglobals()->Vpool_life
  112.     int Vpool_life;
  113. #endif /* DAEMON_UNIX_MOBRULE || DAEMON_WIN32 */
  114. #ifdef THREAD_ANY
  115.     /* For multiprocess UNIX servers, the maximum threads per process */
  116. #define pool_maxthreads conf_getglobals()->Vpool_maxthreads
  117.     int Vpool_maxthreads;
  118.     /* For multiprocess UNIX servers, the minimum threads per process */
  119. #define pool_minthreads conf_getglobals()->Vpool_minthreads
  120.     int Vpool_minthreads;
  121. #endif
  122. #ifdef NET_SSL
  123.  
  124.     char *Vsecure_keyfn;
  125.     char *Vsecure_certfn;
  126.  
  127. #define security_active conf_getglobals()->Vsecurity_active
  128.     int Vsecurity_active;
  129. #define ssl3_active conf_getglobals()->Vssl3_active
  130.     int Vssl3_active;
  131. #define ssl2_active conf_getglobals()->Vssl2_active
  132.     int Vssl2_active;
  133.     int Vsecure_auth;
  134. #define security_session_timeout conf_getglobals()->Vsecurity_session_timeout
  135.     int Vsecurity_session_timeout;
  136. #define ssl3_session_timeout conf_getglobals()->Vssl3_session_timeout
  137.     long Vssl3_session_timeout;
  138.  
  139. #endif /* NET_SSL */
  140.  
  141.     /* The server's hostname as should be reported in self-ref URLs */
  142. #define server_hostname conf_getglobals()->Vserver_hostname
  143.     char *Vserver_hostname;
  144.  
  145.     /* The main object from which all are derived */
  146. #define root_object conf_getglobals()->Vroot_object
  147.     char *Vroot_object;
  148.  
  149.     /* The object set the administrator has asked us to load */
  150. #define std_os conf_getglobals()->Vstd_os
  151.     httpd_objset *Vstd_os;
  152.  
  153.     /* The root of ACL data structures */
  154.     void *Vacl_root;
  155. #define acl_root conf_getglobals()->Vacl_root
  156.  
  157.     /* The main error log, where all errors are logged */
  158. #define master_error_log conf_getglobals()->Vmaster_error_log
  159.     char *Vmaster_error_log;
  160.  
  161. #ifdef XP_WIN32
  162.     /* The server root ( in which the server sits while executing ) */
  163. #define server_root conf_getglobals()->Vserver_root
  164.     char *Vserver_root;
  165.  
  166.     /* This server's id */
  167. #define server_id conf_getglobals()->Vserver_id
  168.     char *Vserver_id;
  169.  
  170. #endif /* XP_WIN32 */
  171.  
  172.     int single_accept;        /* daemon mode  Internal use only */
  173.     int num_keep_alives;    /* number of KA threads Internal use only */
  174.     int log_verbose;        /* Flag to log LOG_VERBOSE messages */
  175.     int mmap_flags;        /* mmap flags for file cache mmaping - internal use only */
  176.     int mmap_prots;        /* mmap prots for file cache mmaping - internal use only */
  177.     int mp_optimization;    /* let nscp do mp optimizations - internal use only */
  178.     int concurrency;        /* set concurrency for threading system */
  179.  
  180. } conf_global_vars_s;
  181.  
  182.  
  183.  
  184. /* ------------------------------ Prototypes ------------------------------ */
  185.  
  186.  
  187. /*
  188.  * conf_init reads the given configuration file and sets any non-default
  189.  * parameters to their given setting.
  190.  */
  191.  
  192. NSAPI_PUBLIC char *conf_init(char *cfn);
  193. /*
  194.  * conf_terminate frees any data the conf routines may be holding.
  195.  */
  196.  
  197. NSAPI_PUBLIC void conf_terminate(void);
  198.  
  199.  
  200. /*
  201.  * Get a structure with the global variables for this server.
  202.  */
  203. NSAPI_PUBLIC conf_global_vars_s *conf_getglobals(void);
  204.  
  205.  
  206. /*
  207.  * conf_vars2daemon transfers these globals to a daemon structure 
  208.  */
  209. NSAPI_PUBLIC void conf_vars2daemon(daemon_s *d);
  210.  
  211. #ifdef XP_WIN32
  212.  
  213. NSAPI_PUBLIC BOOLEAN GetDomainAddresses(PCHAR ErrMsg);
  214.  
  215. #endif /* XP_WIN32 */
  216.  
  217. #endif
  218.