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

1.1       root        1: /* ftpsrvr.h */
                      2: 
                      3: /* Synchronet FTP server */
                      4: 
1.1.1.2 ! root        5: /* $Id: ftpsrvr.h,v 1.49 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 _FTPSRVR_H_
                     39: #define _FTPSRVR_H_
                     40: 
                     41: #include "startup.h"
                     42: 
                     43: typedef struct {
                     44: 
                     45:        DWORD   size;                           /* sizeof(ftp_startup_t) */
                     46:        WORD    port;
                     47:        WORD    max_clients;
                     48:        WORD    max_inactivity;
                     49:        WORD    qwk_timeout;
                     50:        WORD    sem_chk_freq;           /* semaphore file checking frequency (in seconds) */
                     51:     DWORD   interface_addr;
                     52:        DWORD   pasv_ip_addr;
                     53:        WORD    pasv_port_low;
                     54:        WORD    pasv_port_high;
                     55:     DWORD      options;                        /* See FTP_OPT definitions */
                     56: 
                     57:        void*   cbdata;                         /* Private data passed to callbacks */ 
                     58: 
                     59:        /* Callbacks (NULL if unused) */
1.1.1.2 ! root       60:        int     (*lputs)(void*, int level, const char* msg);
        !            61:        void    (*errormsg)(void*, int level, const char* msg);
        !            62:        void    (*status)(void*, const char*);
1.1       root       63:     void       (*started)(void*);
                     64:        void    (*recycle)(void*);
                     65:     void       (*terminated)(void*, int code);
                     66:     void       (*clients)(void*, int active);
                     67:     void       (*thread_up)(void*, BOOL up, BOOL setuid);
                     68:        void    (*socket_open)(void*, BOOL open);
                     69:     void       (*client_on)(void*, BOOL on, int sock, client_t*, BOOL update);
                     70:     BOOL       (*seteuid)(BOOL user);
                     71:     BOOL       (*setuid)(BOOL force);
                     72: 
                     73:        /* Paths */
                     74:     char    ctrl_dir[128];
                     75:     char       index_file_name[64];
                     76:     char       html_index_file[64];
                     77:     char       html_index_script[64];
                     78:     char       temp_dir[128];
                     79:        char    answer_sound[128];
                     80:        char    hangup_sound[128];
                     81:     char       hack_sound[128];
                     82: 
                     83:        /* Misc */
                     84:     char       host_name[128];
                     85:        BOOL    recycle_now;
                     86:        BOOL    shutdown_now;
                     87:        int             log_level;
                     88:        uint    bind_retry_count;               /* Number of times to retry bind() calls */
                     89:        uint    bind_retry_delay;               /* Time to wait between each bind() retry */
                     90: 
                     91:        /* JavaScript operating parameters */
                     92:        js_startup_t js;
                     93: 
1.1.1.2 ! root       94:        /* Login Attempt parameters */
        !            95:        ulong   login_attempt_delay;
        !            96:        ulong   login_attempt_throttle;
        !            97:        ulong   login_attempt_hack_threshold;
        !            98:        ulong   login_attempt_filter_threshold;
        !            99:        link_list_t* login_attempt_list;
        !           100: 
1.1       root      101: } ftp_startup_t;
                    102: 
                    103: /* startup options that requires re-initialization/recycle when changed */
                    104: #if defined(STARTUP_INIT_FIELD_TABLES)
                    105: static struct init_field ftp_init_fields[] = { 
                    106:         OFFSET_AND_SIZE(ftp_startup_t,port)
                    107:        ,OFFSET_AND_SIZE(ftp_startup_t,interface_addr)
                    108:        ,OFFSET_AND_SIZE(ftp_startup_t,ctrl_dir)
                    109:        ,OFFSET_AND_SIZE(ftp_startup_t,temp_dir)
                    110:        ,{ 0,0 }        /* terminator */
                    111: };
                    112: #endif
                    113: 
                    114: #define FTP_OPT_DEBUG_RX                       (1<<0)
                    115: #define FTP_OPT_DEBUG_DATA                     (1<<1)
                    116: #define FTP_OPT_INDEX_FILE                     (1<<2)  /* Auto-generate ASCII Index files */
                    117: #define FTP_OPT_DEBUG_TX                       (1<<3)
                    118: #define FTP_OPT_ALLOW_QWK                      (1<<4)
                    119: #define FTP_OPT_NO_LOCAL_FSYS          (1<<5)
                    120: #define FTP_OPT_DIR_FILES                      (1<<6)  /* Allow access to files in dir but not in database */
                    121: #define FTP_OPT_KEEP_TEMP_FILES                (1<<7)  /* Don't delete temp files (for debugging) */
                    122: #define FTP_OPT_HTML_INDEX_FILE                (1<<8)  /* Auto-generate HTML index files */
                    123: #define FTP_OPT_LOOKUP_PASV_IP         (1<<9)  /* resolve public IP address for PASV response */
                    124: #define FTP_OPT_NO_HOST_LOOKUP         (1<<11)
                    125: #define FTP_OPT_NO_RECYCLE                     (1<<27) /* Disable recycling of server          */
                    126: #define FTP_OPT_NO_JAVASCRIPT          (1<<29) /* JavaScript disabled                          */
                    127: #define FTP_OPT_MUTE                           (1<<31)
                    128: 
                    129: /* ftp_startup_t.options bits that require re-init/recycle when changed */
1.1.1.2 ! root      130: #define FTP_INIT_OPTS  (0)
1.1       root      131: 
                    132: #if defined(STARTUP_INI_BITDESC_TABLES)
                    133: static ini_bitdesc_t ftp_options[] = {
                    134: 
                    135:        { FTP_OPT_DEBUG_RX                              ,"DEBUG_RX"                             },
                    136:        { FTP_OPT_DEBUG_DATA                    ,"DEBUG_DATA"                   },      
                    137:        { FTP_OPT_INDEX_FILE                    ,"INDEX_FILE"                   },
                    138:        { FTP_OPT_DEBUG_TX                              ,"DEBUG_TX"                             },
                    139:        { FTP_OPT_ALLOW_QWK                             ,"ALLOW_QWK"                    },
                    140:        { FTP_OPT_NO_LOCAL_FSYS                 ,"NO_LOCAL_FSYS"                },
                    141:        { FTP_OPT_DIR_FILES                             ,"DIR_FILES"                    },
                    142:        { FTP_OPT_KEEP_TEMP_FILES               ,"KEEP_TEMP_FILES"              },
                    143:        { FTP_OPT_HTML_INDEX_FILE               ,"HTML_INDEX_FILE"              },
                    144:        { FTP_OPT_LOOKUP_PASV_IP                ,"LOOKUP_PASV_IP"               },
                    145:        { FTP_OPT_NO_HOST_LOOKUP                ,"NO_HOST_LOOKUP"               },
                    146:        { FTP_OPT_NO_RECYCLE                    ,"NO_RECYCLE"                   },
                    147:        { FTP_OPT_NO_JAVASCRIPT                 ,"NO_JAVASCRIPT"                },
                    148:        { FTP_OPT_MUTE                                  ,"MUTE"                                 },
                    149:        /* terminator */                                                                                
                    150:        { 0                                                     ,NULL                                   }
                    151: };
                    152: #endif
                    153: 
                    154: #ifdef DLLEXPORT
                    155: #undef DLLEXPORT
                    156: #endif
                    157: #ifdef DLLCALL
                    158: #undef DLLCALL
                    159: #endif
                    160: 
                    161: #ifdef _WIN32
                    162:        #ifdef FTPSRVR_EXPORTS
                    163:                #define DLLEXPORT __declspec(dllexport)
                    164:        #else
                    165:                #define DLLEXPORT __declspec(dllimport)
                    166:        #endif
                    167:        #ifdef __BORLANDC__
                    168:                #define DLLCALL __stdcall
                    169:        #else
                    170:                #define DLLCALL
                    171:        #endif
                    172: #else
                    173:        #define DLLEXPORT
                    174:        #define DLLCALL
                    175: #endif
                    176: 
                    177: #ifdef __cplusplus
                    178: extern "C" {
                    179: #endif
                    180: /* arg is pointer to static ftp_startup_t */
                    181: DLLEXPORT void                 DLLCALL ftp_server(void* arg);
                    182: DLLEXPORT void                 DLLCALL ftp_terminate(void);
                    183: DLLEXPORT const char*  DLLCALL ftp_ver(void);
                    184: #ifdef __cplusplus
                    185: }
                    186: #endif
                    187: 
                    188: #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.