Annotation of sbbs/src/sbbs3/services.h, revision 1.1.1.2

1.1       root        1: /* services.h */
                      2: 
                      3: /* Synchronet main/telnet server thread startup structure */
                      4: 
1.1.1.2 ! root        5: /* $Id: services.h,v 1.39 2011/09/01 02:50:16 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 2011 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: 
                     38: #ifndef _SERVICES_H_
                     39: #define _SERVICES_H_
                     40: 
                     41: #include "startup.h"
                     42: 
                     43: typedef struct {
                     44: 
                     45:        DWORD   size;                           /* sizeof(bbs_struct_t) */
                     46:     DWORD   interface_addr;
                     47:     DWORD      options;                        /* See BBS_OPT definitions */
                     48:        WORD    sem_chk_freq;                   /* semaphore file checking frequency (in seconds) */
                     49: 
                     50:        void*   cbdata;                                 /* Private data passed to callbacks */ 
                     51: 
                     52:        /* Callbacks (NULL if unused) */
1.1.1.2 ! root       53:        int     (*lputs)(void*, int level, const char*);                /* Log - put string */
        !            54:        void    (*errormsg)(void*, int level, const char* msg);
        !            55:        void    (*status)(void*, const char*);
1.1       root       56:     void       (*started)(void*);
                     57:        void    (*recycle)(void*);
                     58:     void       (*terminated)(void*, int code);
                     59:     void       (*clients)(void*, int active);
                     60:     void       (*thread_up)(void*, BOOL up, BOOL setuid);
                     61:        void    (*socket_open)(void*, BOOL open);
                     62:     void       (*client_on)(void*, BOOL on, int sock, client_t*, BOOL update);
                     63:     BOOL       (*seteuid)(BOOL user);
                     64:        BOOL    (*setuid)(BOOL force);
                     65: 
                     66:        /* Paths */
                     67:     char    ctrl_dir[128];
                     68:        char    temp_dir[128];
                     69:        char    answer_sound[128];
                     70:        char    hangup_sound[128];
                     71: 
                     72:        /* Misc */
                     73:     char       host_name[128];
                     74:        BOOL    recycle_now;
                     75:        BOOL    shutdown_now;
                     76:        int             log_level;
                     77:        uint    bind_retry_count;               /* Number of times to retry bind() calls */
                     78:        uint    bind_retry_delay;               /* Time to wait between each bind() retry */
                     79: 
                     80:        /* JavaScript operating parameters */
                     81:        js_startup_t js;
                     82: 
1.1.1.2 ! root       83:        /* Login Attempt parameters */
        !            84:        ulong   login_attempt_delay;
        !            85:        ulong   login_attempt_throttle;
        !            86:        ulong   login_attempt_hack_threshold;
        !            87:        ulong   login_attempt_filter_threshold;
        !            88:        link_list_t* login_attempt_list;
        !            89: 
1.1       root       90: } services_startup_t;
                     91: 
                     92: #if 0
                     93: /* startup options that requires re-initialization/recycle when changed */
                     94: static struct init_field services_init_fields[] = { 
                     95:         OFFSET_AND_SIZE(services_startup_t,interface_addr)
                     96:        ,OFFSET_AND_SIZE(services_startup_t,ctrl_dir)
                     97:        ,{ 0,0 }        /* terminator */
                     98: };
                     99: #endif
                    100: 
                    101: /* Option bit definitions      */
                    102: #define SERVICE_OPT_UDP                        (1<<0)  /* UDP Socket */
                    103: #define SERVICE_OPT_STATIC             (1<<1)  /* Static service (accepts client connectsions) */
                    104: #define SERVICE_OPT_STATIC_LOOP (1<<2) /* Loop static service until terminated */
                    105: #define SERVICE_OPT_NATIVE             (1<<3)  /* non-JavaScript service */
                    106: #define SERVICE_OPT_FULL_ACCEPT        (1<<4)  /* Accept/close connections when server is full */
                    107: 
                    108: /* services_startup_t.options bits that require re-init/recycle when changed */
1.1.1.2 ! root      109: #define SERVICE_INIT_OPTS      (0)
1.1       root      110: 
                    111: #if defined(STARTUP_INI_BITDESC_TABLES) || defined(SERVICES_INI_BITDESC_TABLE)
                    112: static ini_bitdesc_t service_options[] = {
                    113: 
                    114:        { BBS_OPT_NO_HOST_LOOKUP                ,"NO_HOST_LOOKUP"               },
                    115:        { BBS_OPT_GET_IDENT                             ,"GET_IDENT"                    },
                    116:        { BBS_OPT_NO_RECYCLE                    ,"NO_RECYCLE"                   },
                    117:        { BBS_OPT_MUTE                                  ,"MUTE"                                 },
                    118:        { SERVICE_OPT_UDP                               ,"UDP"                                  },
                    119:        { SERVICE_OPT_STATIC                    ,"STATIC"                               },
                    120:        { SERVICE_OPT_STATIC_LOOP               ,"LOOP"                                 },
                    121:        { SERVICE_OPT_NATIVE                    ,"NATIVE"                               },
                    122:        { SERVICE_OPT_FULL_ACCEPT               ,"FULL_ACCEPT"                  },
                    123:        /* terminator */                                
                    124:        { 0                                                     ,NULL                                   }
                    125: };
                    126: #endif
                    127: 
                    128: #ifdef __cplusplus
                    129: extern "C" {
                    130: #endif
                    131: 
                    132: #ifdef DLLEXPORT
                    133: #undef DLLEXPORT
                    134: #endif
                    135: #ifdef DLLCALL
                    136: #undef DLLCALL
                    137: #endif
                    138: 
                    139: #ifdef _WIN32
                    140:        #ifdef SERVICES_EXPORTS
                    141:                #define DLLEXPORT __declspec(dllexport)
                    142:        #else
                    143:                #define DLLEXPORT __declspec(dllimport)
                    144:        #endif
                    145:        #ifdef __BORLANDC__
                    146:                #define DLLCALL __stdcall
                    147:        #else
                    148:                #define DLLCALL
                    149:        #endif
                    150: #else
                    151:        #define DLLEXPORT
                    152:        #define DLLCALL
                    153: #endif
                    154: 
                    155: /* arg is pointer to static bbs_startup_t* */
                    156: DLLEXPORT void                 DLLCALL services_thread(void* arg);
                    157: DLLEXPORT void                 DLLCALL services_terminate(void);
                    158: DLLEXPORT const char*  DLLCALL services_ver(void);
                    159: 
                    160: #ifdef __cplusplus
                    161: }
                    162: #endif
                    163: 
                    164: #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.