Annotation of sbbs/sbbs3/startup.h, revision 1.1.1.2

1.1       root        1: /* startup.h */
                      2: 
                      3: /* Synchronet main/telnet server thread startup structure */
                      4: 
1.1.1.2 ! root        5: /* $Id: startup.h,v 1.56 2004/11/06 02:13:08 rswindell Exp $ */
1.1       root        6: 
                      7: /****************************************************************************
                      8:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
                      9:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
                     10:  *                                                                                                                                                     *
1.1.1.2 ! root       11:  * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html         *
1.1       root       12:  *                                                                                                                                                     *
                     13:  * This program is free software; you can redistribute it and/or                       *
                     14:  * modify it under the terms of the GNU General Public License                         *
                     15:  * as published by the Free Software Foundation; either version 2                      *
                     16:  * of the License, or (at your option) any later version.                                      *
                     17:  * See the GNU General Public License for more details: gpl.txt or                     *
                     18:  * http://www.fsf.org/copyleft/gpl.html                                                                                *
                     19:  *                                                                                                                                                     *
                     20:  * Anonymous FTP access to the most recent released source is available at     *
                     21:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
                     22:  *                                                                                                                                                     *
                     23:  * Anonymous CVS access to the development source and modification history     *
                     24:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
                     25:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
                     26:  *     (just hit return, no password is necessary)                                                     *
                     27:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
                     28:  *                                                                                                                                                     *
                     29:  * For Synchronet coding style and modification guidelines, see                                *
                     30:  * http://www.synchro.net/source.html                                                                          *
                     31:  *                                                                                                                                                     *
                     32:  * You are encouraged to submit any modifications (preferably in Unix diff     *
                     33:  * format) via e-mail to [email protected]                                                                      *
                     34:  *                                                                                                                                                     *
                     35:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
                     36:  ****************************************************************************/
                     37: 
1.1.1.2 ! root       38: #ifndef _STARTUP_H_
        !            39: #define _STARTUP_H_
1.1       root       40: 
1.1.1.2 ! root       41: #include <stddef.h>            /* offsetof */
1.1       root       42: #include "client.h"
                     43: #include "ringbuf.h"
1.1.1.2 ! root       44: #include "semwrap.h"   /* sem_t */
        !            45: #include "ini_file.h"  /* INI_MAX_VALUE_LEN */
        !            46: #include "sbbsdefs.h"  /* LOG_* (syslog.h) values */
        !            47: 
        !            48: typedef struct {
        !            49:        ulong   max_bytes;
        !            50:        ulong   cx_stack;
        !            51:        ulong   branch_limit;
        !            52:        ulong   gc_interval;
        !            53:        ulong   yield_interval;
        !            54: } js_startup_t;
1.1       root       55: 
                     56: typedef struct {
                     57: 
1.1.1.2 ! root       58:        char    ctrl_dir[INI_MAX_VALUE_LEN];
        !            59:        char    temp_dir[INI_MAX_VALUE_LEN];
        !            60:        char    host_name[INI_MAX_VALUE_LEN];
        !            61:        ushort  sem_chk_freq;
        !            62:        ulong   interface_addr;
        !            63:        ulong   log_mask;
        !            64:        js_startup_t js;
        !            65:        uint    bind_retry_count;               /* Number of times to retry bind() calls */
        !            66:        uint    bind_retry_delay;               /* Time to wait between each bind() retry */
        !            67: 
        !            68: } global_startup_t;
        !            69: 
        !            70: typedef struct {
        !            71: 
        !            72:        DWORD   size;                           /* sizeof(bbs_struct_t) */
1.1       root       73:     WORD       first_node;
                     74:     WORD       last_node;
                     75:        WORD    telnet_port;
                     76:        WORD    rlogin_port;
1.1.1.2 ! root       77:        WORD    outbuf_highwater_mark;  /* output block size control */
        !            78:        WORD    outbuf_drain_timeout;
        !            79:        WORD    sem_chk_freq;           /* semaphore file checking frequency (in seconds) */
1.1       root       80:     DWORD   telnet_interface;
1.1.1.2 ! root       81:     DWORD      options;                        /* See BBS_OPT definitions */
1.1       root       82:     DWORD      rlogin_interface;
1.1.1.2 ! root       83:     DWORD      xtrn_polls_before_yield;
        !            84:     DWORD      js_max_bytes;
        !            85:        DWORD   js_cx_stack;
        !            86:        DWORD   js_branch_limit;
        !            87:        DWORD   js_yield_interval;
        !            88:        DWORD   js_gc_interval;
        !            89:     RingBuf** node_spybuf;                     /* Spy output buffer (each node)        */
        !            90:     RingBuf** node_inbuf;                      /* User input buffer (each node)        */
        !            91:     sem_t**    node_spysem;                    /* Spy output semaphore (each node)     */
        !            92: 
        !            93:        void*   cbdata;                                 /* Private data passed to callbacks */ 
        !            94: 
        !            95:        /* Callbacks (NULL if unused) */
        !            96:        int     (*lputs)(void*, int, char*);    /* Log - put string                                     */
        !            97:     int        (*event_lputs)(int, char*);             /* Event log - put string                       */
        !            98:        void    (*status)(void*, char*);
        !            99:     void       (*started)(void*);
        !           100:        void    (*recycle)(void*);
        !           101:     void       (*terminated)(void*, int code);
        !           102:     void       (*clients)(void*, int active);
        !           103:     void       (*thread_up)(void*, BOOL up, BOOL setuid);
        !           104:        void    (*socket_open)(void*, BOOL open);
        !           105:     void       (*client_on)(void*, BOOL on, int sock, client_t*, BOOL update);
        !           106:     BOOL       (*seteuid)(BOOL user);  /* Set Unix uid for thread (bind) */
        !           107:        BOOL    (*setuid)(BOOL force);
        !           108: 
        !           109:        /* Paths */
1.1       root      110:     char    ctrl_dir[128];
1.1.1.2 ! root      111:     char       dosemu_path[128];
        !           112:     char       temp_dir[128];
1.1       root      113:        char    answer_sound[128];
                    114:        char    hangup_sound[128];
1.1.1.2 ! root      115: 
        !           116:        /* Miscellaneous */
        !           117:        char    xtrn_term_ansi[32];             /* external ANSI terminal type (e.g. "ansi-bbs") */
        !           118:        char    xtrn_term_dumb[32];             /* external dumb terminal type (e.g. "dumb") */
        !           119:        char    host_name[128];
        !           120:        BOOL    recycle_now;
        !           121:        BOOL    shutdown_now;
        !           122:        DWORD   log_mask;
        !           123:        uint    bind_retry_count;               /* Number of times to retry bind() calls */
        !           124:        uint    bind_retry_delay;               /* Time to wait between each bind() retry */
1.1       root      125: 
                    126: } bbs_startup_t;
                    127: 
1.1.1.2 ! root      128: /* startup options that requires re-initialization/recycle when changed */
        !           129: #define OFFSET_AND_SIZE(s, f)  { offsetof(s,f), sizeof(((s *)0)->f) }
        !           130: 
        !           131: #if defined(STARTUP_INIT_FIELD_TABLES)
        !           132: static struct init_field {
        !           133:        size_t  offset;
        !           134:        size_t  size;
        !           135: } bbs_init_fields[] = { 
        !           136:         OFFSET_AND_SIZE(bbs_startup_t,first_node)
        !           137:        ,OFFSET_AND_SIZE(bbs_startup_t,last_node)
        !           138:        ,OFFSET_AND_SIZE(bbs_startup_t,telnet_port)
        !           139:        ,OFFSET_AND_SIZE(bbs_startup_t,rlogin_port)
        !           140:        ,OFFSET_AND_SIZE(bbs_startup_t,telnet_interface)
        !           141:        ,OFFSET_AND_SIZE(bbs_startup_t,rlogin_interface)
        !           142:        ,OFFSET_AND_SIZE(bbs_startup_t,ctrl_dir)
        !           143:        ,OFFSET_AND_SIZE(bbs_startup_t,temp_dir)
        !           144:        ,{ 0,0 }        /* terminator */
        !           145: };
        !           146: #endif
        !           147: 
1.1       root      148: #define BBS_OPT_XTRN_MINIMIZED         (1<<1)  /* Run externals minimized                      */
                    149: #define BBS_OPT_AUTO_LOGON                     (1<<2)  /* Auto-logon via IP                            */
                    150: #define BBS_OPT_DEBUG_TELNET           (1<<3)  /* Debug telnet commands                        */
                    151: #define BBS_OPT_SYSOP_AVAILABLE                (1<<4)  /* Available for chat                           */
                    152: #define BBS_OPT_ALLOW_RLOGIN           (1<<5)  /* Allow logins via BSD RLogin          */
                    153: #define BBS_OPT_USE_2ND_RLOGIN         (1<<6)  /* Use 2nd username in BSD RLogin       */
                    154: #define BBS_OPT_NO_QWK_EVENTS          (1<<7)  /* Don't run QWK-related events         */
1.1.1.2 ! root      155: #define BBS_OPT_NO_TELNET_GA           (1<<8)  /* Don't send periodic Telnet GAs       */
        !           156: #define BBS_OPT_NO_EVENTS                      (1<<9)  /* Don't run event thread                       */
        !           157: #define BBS_OPT_NO_SPY_SOCKETS         (1<<10) /* Don't create spy sockets                     */
1.1       root      158: #define BBS_OPT_NO_HOST_LOOKUP         (1<<11)
1.1.1.2 ! root      159: #define BBS_OPT_NO_RECYCLE                     (1<<27) /* Disable recycling of server          */
        !           160: #define BBS_OPT_GET_IDENT                      (1<<28) /* Get Identity (RFC 1413)                      */
        !           161: #define BBS_OPT_NO_JAVASCRIPT          (1<<29) /* JavaScript disabled                          */
        !           162: #define BBS_OPT_LOCAL_TIMEZONE         (1<<30) /* Don't force UTC/GMT                          */
1.1       root      163: #define BBS_OPT_MUTE                           (1<<31) /* Mute sounds                                          */
                    164: 
1.1.1.2 ! root      165: /* bbs_startup_t.options bits that require re-init/recycle when changed */
        !           166: #define BBS_INIT_OPTS  (BBS_OPT_ALLOW_RLOGIN|BBS_OPT_NO_EVENTS|BBS_OPT_NO_SPY_SOCKETS \
        !           167:                                                |BBS_OPT_NO_JAVASCRIPT|BBS_OPT_LOCAL_TIMEZONE)
        !           168: 
        !           169: #if defined(STARTUP_INI_BITDESC_TABLES)
        !           170: static ini_bitdesc_t bbs_options[] = {
        !           171: 
        !           172:        { BBS_OPT_XTRN_MINIMIZED                ,"XTRN_MINIMIZED"               },
        !           173:        { BBS_OPT_AUTO_LOGON                    ,"AUTO_LOGON"                   },
        !           174:        { BBS_OPT_DEBUG_TELNET                  ,"DEBUG_TELNET"                 },
        !           175:        { BBS_OPT_SYSOP_AVAILABLE               ,"SYSOP_AVAILABLE"              },
        !           176:        { BBS_OPT_ALLOW_RLOGIN                  ,"ALLOW_RLOGIN"                 },
        !           177:        { BBS_OPT_USE_2ND_RLOGIN                ,"USE_2ND_RLOGIN"               },
        !           178:        { BBS_OPT_NO_QWK_EVENTS                 ,"NO_QWK_EVENTS"                },
        !           179:        { BBS_OPT_NO_TELNET_GA                  ,"NO_TELNET_GA"                 },
        !           180:        { BBS_OPT_NO_EVENTS                             ,"NO_EVENTS"                    },
        !           181:        { BBS_OPT_NO_HOST_LOOKUP                ,"NO_HOST_LOOKUP"               },
        !           182:        { BBS_OPT_NO_SPY_SOCKETS                ,"NO_SPY_SOCKETS"               },
        !           183:        { BBS_OPT_NO_RECYCLE                    ,"NO_RECYCLE"                   },
        !           184:        { BBS_OPT_GET_IDENT                             ,"GET_IDENT"                    },
        !           185:        { BBS_OPT_NO_JAVASCRIPT                 ,"NO_JAVASCRIPT"                },
        !           186:        { BBS_OPT_LOCAL_TIMEZONE                ,"LOCAL_TIMEZONE"               },
        !           187:        { BBS_OPT_MUTE                                  ,"MUTE"                                 },
        !           188:        /* terminator */                                                                                
        !           189:        { 0                                                             ,NULL                                   }
        !           190: };
        !           191: 
        !           192: static ini_bitdesc_t log_mask_bits[] = {
        !           193:        { (1<<LOG_EMERG)                                ,"EMERG"                                },
        !           194:        { (1<<LOG_ALERT)                                ,"ALERT"                                },
        !           195:        { (1<<LOG_CRIT)                                 ,"CRIT"                                 },
        !           196:        { (1<<LOG_ERR)                                  ,"ERR"                                  },
        !           197:        { (1<<LOG_WARNING)                              ,"WARNING"                              },
        !           198:        { (1<<LOG_NOTICE)                               ,"NOTICE"                               },
        !           199:        { (1<<LOG_INFO)                                 ,"INFO"                                 },
        !           200:        { (1<<LOG_DEBUG)                                ,"DEBUG"                                },
        !           201:        /* the Gubinator */                             
        !           202:        { 0                                                             ,NULL                                   }
        !           203: };
        !           204: #endif
        !           205: 
        !           206: #ifdef __cplusplus
        !           207: extern "C" {
        !           208: #endif
        !           209: 
        !           210: #ifdef DLLEXPORT
        !           211: #undef DLLEXPORT
        !           212: #endif
        !           213: #ifdef DLLCALL
        !           214: #undef DLLCALL
        !           215: #endif
        !           216: 
        !           217: #ifdef _WIN32
        !           218:        #ifdef SBBS_EXPORTS
        !           219:                #define DLLEXPORT __declspec(dllexport)
        !           220:        #else
        !           221:                #define DLLEXPORT __declspec(dllimport)
        !           222:        #endif
        !           223:        #ifdef __BORLANDC__
        !           224:                #define DLLCALL __stdcall
        !           225:        #else
        !           226:                #define DLLCALL
        !           227:        #endif
        !           228: #else
        !           229:        #define DLLEXPORT
        !           230:        #define DLLCALL
        !           231: #endif
        !           232: 
        !           233: /* arg is pointer to static bbs_startup_t* */
        !           234: DLLEXPORT void                 DLLCALL bbs_thread(void* arg);
        !           235: DLLEXPORT void                 DLLCALL bbs_terminate(void);
        !           236: DLLEXPORT const char*  DLLCALL js_ver(void);
        !           237: DLLEXPORT const char*  DLLCALL bbs_ver(void);
        !           238: DLLEXPORT long                 DLLCALL bbs_ver_num(void);
        !           239: 
        !           240: #ifdef __cplusplus
        !           241: }
        !           242: #endif
        !           243: 
        !           244: #endif /* Don't add anything after this line */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.