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

1.1       root        1: /* sbbs.h */
                      2: 
                      3: /* Synchronet class (sbbs_t) definition and exported function prototypes */
                      4: 
1.1.1.2 ! root        5: /* $Id: sbbs.h,v 1.358 2011/09/21 03:10:53 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 _SBBS_H
                     39: #define _SBBS_H
                     40: 
                     41: /****************************/
                     42: /* Standard library headers */
                     43: /****************************/
                     44: 
                     45: /***************/
                     46: /* OS-specific */
                     47: /***************/
                     48: #if defined(_WIN32)                    /* Windows */
                     49: 
                     50:        #define NOCRYPT     /* Stop windows.h from loading wincrypt.h */
                     51:                     /* Is windows.h REALLY necessary?!?! */
                     52:        #define WIN32_LEAN_AND_MEAN
                     53:        #include <io.h>
                     54:        #include <share.h>
                     55:        #include <windows.h>
                     56:        #include <process.h>    /* _beginthread() prototype */
                     57:        #include <direct.h>             /* _mkdir() prototype */
                     58:        #include <mmsystem.h>   /* SND_ASYNC */
                     59: 
                     60:        #if defined(_DEBUG) && defined(_MSC_VER)
                     61:                #include <crtdbg.h> /* Windows debug macros and stuff */
                     62:        #endif
                     63: 
                     64: #if defined(__cplusplus)
                     65:        extern "C"
                     66: #endif
                     67:        extern HINSTANCE hK32;
                     68: 
                     69: #elif defined(__unix__)                /* Unix-variant */
                     70: 
                     71:        #include <unistd.h>             /* close */
                     72: 
                     73: #endif
                     74: 
                     75: #ifdef _THREAD_SUID_BROKEN
                     76: extern int     thread_suid_broken;                     /* NPTL is no longer broken */
                     77: #else
                     78: #define thread_suid_broken FALSE
                     79: #endif
                     80: 
                     81: /******************/
                     82: /* ANSI C Library */
                     83: /******************/
                     84: #include <time.h>
                     85: #include <errno.h>
                     86: #include <stdio.h>
                     87: #include <ctype.h>
                     88: #include <fcntl.h>                     /* open */
                     89: #include <stdarg.h>
                     90: #include <stdlib.h>
                     91: #include <string.h>
                     92: 
                     93: #ifndef __unix__
                     94: 
                     95:        #include <malloc.h>
                     96: 
                     97: #endif
                     98: 
                     99: #include <sys/stat.h>
                    100: 
                    101: #ifdef JAVASCRIPT
                    102:        #ifdef __unix__
                    103:                #define XP_UNIX
                    104:        #else
                    105:                #define XP_PC
                    106:                #define XP_WIN
                    107:        #endif
                    108:        #define JS_THREADSAFE   /* Required! */
                    109:        #include <jsapi.h>
                    110:        #include <jsprf.h>              /* JS-safe sprintf functions */
                    111:        #include <jsnum.h>              /* JSDOUBLE_IS_NaN() */
                    112: 
                    113: #endif
                    114: 
                    115: #ifdef USE_CRYPTLIB
                    116: #include <cryptlib.h>
                    117: #endif
                    118: 
                    119: /* xpdev */
                    120: #ifndef LINK_LIST_THREADSAFE
                    121:  #define LINK_LIST_THREADSAFE
                    122: #endif
                    123: #include "genwrap.h"
                    124: #include "semfile.h"
1.1.1.2 ! root      125: #include "netwrap.h"
1.1       root      126: #include "dirwrap.h"
                    127: #include "filewrap.h"
1.1.1.2 ! root      128: #include "datewrap.h"
1.1       root      129: #include "sockwrap.h"
1.1.1.2 ! root      130: #include "eventwrap.h"
1.1       root      131: #include "link_list.h"
                    132: #include "msg_queue.h"
1.1.1.2 ! root      133: #include "xpdatetime.h"
1.1       root      134: 
1.1.1.2 ! root      135: /***********************/
        !           136: /* Synchronet-specific */
        !           137: /***********************/
        !           138: #include "startup.h"
        !           139: #ifdef __cplusplus
        !           140:        #include "threadwrap.h" /* pthread_mutex_t */
        !           141: #endif
        !           142: 
        !           143: #include "comio.h"
1.1       root      144: #include "smblib.h"
                    145: #include "ars_defs.h"
                    146: #include "scfgdefs.h"
                    147: #include "scfglib.h"
                    148: #include "userdat.h"
                    149: #include "riodefs.h"
                    150: #include "cmdshell.h"
                    151: #include "ringbuf.h"    /* RingBuf definition */
                    152: #include "client.h"            /* client_t definition */
                    153: #include "crc16.h"
                    154: #include "crc32.h"
                    155: #include "telnet.h"
                    156: #include "nopen.h"
1.1.1.2 ! root      157: #include "text.h"
1.1       root      158: 
                    159: /* Synchronet Node Instance class definition */
                    160: #ifdef __cplusplus
                    161: class sbbs_t
                    162: {
                    163: 
                    164: public:
                    165: 
1.1.1.2 ! root      166:        sbbs_t(ushort node_num, SOCKADDR_IN addr, const char* host_name, SOCKET
1.1       root      167:                ,scfg_t*, char* text[], client_t* client_info);
                    168:        ~sbbs_t();
                    169: 
                    170:        bbs_startup_t*  startup;
                    171: 
                    172:        bool    init(void);
                    173:        BOOL    terminated;
                    174: 
                    175:        client_t client;
                    176:        SOCKET  client_socket;
                    177:        SOCKET  client_socket_dup;
1.1.1.2 ! root      178:        SOCKADDR_IN     client_addr;
1.1       root      179:        char    client_name[128];
                    180:        char    client_ident[128];
                    181:        DWORD   local_addr;
                    182: #ifdef USE_CRYPTLIB
                    183:        CRYPT_SESSION   ssh_session;
                    184:        bool    ssh_mode;
                    185:        SOCKET  passthru_socket;
                    186:     bool       passthru_output_thread_running;
                    187:     bool       passthru_input_thread_running;
                    188: #endif
                    189: 
                    190:        scfg_t  cfg;
                    191: 
                    192:        int             outchar_esc;               // track ANSI escape seq output
                    193: 
                    194:        int     rioctl(ushort action); // remote i/o control
                    195:        bool    rio_abortable;
                    196: 
                    197:     RingBuf    inbuf;
                    198:     RingBuf    outbuf;
                    199:        HANDLE  input_thread;
                    200:        pthread_mutex_t input_thread_mutex;
                    201:        bool    input_thread_mutex_locked;      // by someone other than the input_thread
                    202: 
                    203:        int     outcom(uchar ch);          // send character
                    204:        int     incom(unsigned long timeout=0);            // receive character
                    205: 
1.1.1.2 ! root      206:        void    spymsg(const char *msg);                // send message to active spies
1.1       root      207: 
1.1.1.2 ! root      208:        int             putcom(const char *str, size_t len=0);  // Send string
1.1       root      209:        void    hangup(void);              // Hangup modem
                    210: 
                    211:        uchar   telnet_local_option[0x100];
                    212:        uchar   telnet_remote_option[0x100];
                    213:        void    send_telnet_cmd(uchar cmd, uchar opt);
1.1.1.2 ! root      214:        bool    request_telnet_opt(uchar cmd, uchar opt, unsigned waitforack=0);
1.1       root      215: 
                    216:     uchar      telnet_cmd[64];
                    217:     uint       telnet_cmdlen;
                    218:        ulong   telnet_mode;
                    219:        uchar   telnet_last_rxch;
1.1.1.2 ! root      220:        char    telnet_location[128];
1.1       root      221:        char    terminal[TELNET_TERM_MAXLEN+1];
1.1.1.2 ! root      222:        xpevent_t       telnet_ack_event;
1.1       root      223: 
                    224:        time_t  event_time;                             // Time of next exclusive event
                    225:        char*   event_code;                             // Internal code of next exclusive event
                    226:        bool    event_thread_running;
                    227:     bool       output_thread_running;
                    228:     bool       input_thread_running;
                    229: 
                    230: #ifdef JAVASCRIPT
                    231: 
                    232:        JSRuntime*      js_runtime;
                    233:        JSContext*      js_cx;
                    234:        JSObject*       js_glob;
                    235:        js_branch_t     js_branch;
1.1.1.2 ! root      236:        long            js_execfile(const char *fname, const char* startup_dir, JSObject* scope=NULL);
1.1       root      237:        bool            js_init(ulong* stack_frame);
1.1.1.2 ! root      238:        void            js_cleanup(const char* node);
1.1       root      239:        void            js_create_user_objects(void);
                    240: 
                    241: #endif
                    242: 
                    243:        char    menu_dir[128];  /* Over-ride default menu dir */
                    244:        char    menu_file[128]; /* Over-ride menu file */
                    245: 
                    246:        user_t  useron;                 /* User currently online */
                    247:        node_t  thisnode;               /* Node information */
                    248:        smb_t   smb;                    /* Currently open message base */
                    249:        char    rlogin_name[LEN_ALIAS+1];
                    250:        char    rlogin_pass[LEN_PASS+1];
                    251: 
                    252:        uint    temp_dirnum;
                    253: 
                    254:        FILE    *nodefile_fp,
                    255:                        *node_ext_fp,
                    256:                        *logfile_fp;
                    257: 
                    258:        int     nodefile;               /* File handle for node.dab */
                    259:        int             node_ext;               /* File handle for node.exb */
                    260:        int     inputfile;              /* File handle to use for input */
                    261: 
                    262:                                                        /* Batch download queue */
                    263:        char    **batdn_name;   /* Filenames */
                    264:        ushort  *batdn_alt;     /* Alternate path */
                    265:        uint    *batdn_dir,     /* Directory for each file */
                    266:                         batdn_total;   /* Total files */
                    267:        long    *batdn_offset;  /* Offset for data */
                    268:        ulong   *batdn_size;    /* Size of file in bytes */
                    269:        ulong   *batdn_cdt;     /* Credit value of file */
                    270: 
                    271:                                                        /* Batch upload queue */
                    272:        char    **batup_desc,   /* Description for each file */
                    273:                        **batup_name;   /* Filenames */
                    274:        long    *batup_misc;    /* Miscellaneous bits */
                    275:        ushort  *batup_alt;     /* Alternate path */
                    276:        uint    *batup_dir,     /* Directory for each file */
                    277:                        batup_total;    /* Total files */
                    278: 
                    279:        /*********************************/
                    280:        /* Color Configuration Variables */
                    281:        /*********************************/
                    282:        char    *text[TOTAL_TEXT];                      /* Text from ctrl\text.dat */
                    283:        char    *text_sav[TOTAL_TEXT];          /* Text from ctrl\text.dat */
1.1.1.2 ! root      284: 
1.1       root      285:        char    dszlog[127];    /* DSZLOG enviornment variable */
                    286:     int     keybuftop,keybufbot;    /* Keyboard input buffer pointers (for ungetkey) */
1.1.1.2 ! root      287:        char    keybuf[KEY_BUFSIZE];    /* Keyboard input buffer */
        !           288: 
        !           289:        ushort  node_connection;
        !           290:        char    connection[LEN_MODEM+1];        /* Connection Description */
1.1       root      291:        ulong   cur_rate;               /* Current Connection (DCE) Rate */
                    292:        ulong   cur_cps;                /* Current Average Transfer CPS */
                    293:        ulong   dte_rate;               /* Current COM Port (DTE) Rate */
                    294:        time_t  timeout;                /* User inactivity timeout reference */
                    295:        ulong   timeleft_warn;  /* low timeleft warning flag */
                    296:        uchar   curatr;                 /* Current Text Attributes Always */
                    297:        uchar   attr_stack[64]; /* Saved attributes (stack) */
                    298:        int     attr_sp;                /* Attribute stack pointer */
                    299:        long    lncntr;                 /* Line Counter - for PAUSE */
                    300:        long    tos;                    /* Top of Screen */
                    301:        long    rows;                   /* Current number of Rows for User */
                    302:        long    cols;                   /* Current number of Columns for User */
1.1.1.2 ! root      303:        long    column;                 /* Current column counter (for line counter) */
1.1       root      304:        long    autoterm;               /* Autodetected terminal type */
                    305:        char    slbuf[SAVE_LINES][LINE_BUFSIZE+1]; /* Saved for redisplay */
                    306:        char    slatr[SAVE_LINES];      /* Starting attribute of each line */
                    307:        char    slcuratr[SAVE_LINES];   /* Ending attribute of each line */
                    308:        int     slcnt;                  /* Number of lines currently saved */
                    309:        char    lbuf[LINE_BUFSIZE+1];/* Temp storage for each line output */
                    310:        int             lbuflen;                /* Number of characters in line buffer */
                    311:        char    latr;                   /* Starting attribute of line buffer */
                    312:        ulong   console;                /* Defines current Console settings */
                    313:        char    wordwrap[81];   /* Word wrap buffer */
                    314:        time_t  now,                    /* Used to store current time in Unix format */
                    315:                        answertime,     /* Time call was answered */
                    316:                        logontime,              /* Time user logged on */
                    317:                        starttime,              /* Time stamp to use for time left calcs */
                    318:                        ns_time,                /* File new-scan time */
                    319:                        last_ns_time;   /* Most recent new-file-scan this call */
                    320:        uchar   action;                 /* Current action of user */
                    321:        long    online;                 /* Remote/Local or not online */
                    322:        long    sys_status;     /* System Status */
                    323:        subscan_t       *subscan;       /* User sub configuration/scan info */
                    324: 
                    325:        ulong   logon_ulb,              /* Upload Bytes This Call */
                    326:                        logon_dlb,              /* Download Bytes This Call */
                    327:                        logon_uls,              /* Uploads This Call */
                    328:                        logon_dls,              /* Downloads This Call */
                    329:                        logon_posts,    /* Posts This Call */
                    330:                        logon_emails,   /* Emails This Call */
                    331:                        logon_fbacks;   /* Feedbacks This Call */
                    332:        uchar   logon_ml;               /* ML of the user upon logon */
                    333: 
                    334:        uint    main_cmds;              /* Number of Main Commands this call */
                    335:        uint    xfer_cmds;              /* Number of Xfer Commands this call */
                    336:        ulong   posts_read;     /* Number of Posts read this call */
                    337:        char    temp_uler[31];  /* User who uploaded the files to temp dir */
                    338:        char    temp_file[41];  /* Origin of extracted temp files */
                    339:        long    temp_cdt;               /* Credit value of file that was extracted */
1.1.1.2 ! root      340:        bool    autohang;               /* Used for auto-hangup after transfer */
1.1       root      341:        size_t  logcol;                 /* Current column of log file */
                    342:        uint    criterrs;               /* Critical error counter */
                    343: 
                    344:        uint    curgrp;                 /* Current group */
                    345:        uint    *cursub;                /* Current sub-board for each group */
                    346:        uint    curlib;                 /* Current library */
                    347:        uint    *curdir;                /* Current directory for each library */
                    348:        uint    *usrgrp;                /* Real group numbers */
                    349:        uint    usrgrps;                /* Number groups this user has access to */
                    350:        uint    usrgrp_total;   /* Total number of groups */
                    351:        uint    *usrlib;                /* Real library numbers */
                    352:        uint    usrlibs;                /* Number of libs this user can access */
                    353:        uint    usrlib_total;   /* Total number of libraries */
                    354:        uint    **usrsub;               /* Real sub numbers */
                    355:        uint    *usrsubs;               /* Num of subs with access for each grp */
                    356:        uint    **usrdir;               /* Real dir numbers */
                    357:        uint    *usrdirs;               /* Num of dirs with access for each lib */
                    358:        uint    cursubnum;              /* For ARS */
                    359:        uint    curdirnum;              /* For ARS */
                    360:        ulong   timeleft;               /* Number of seconds user has left online */
                    361: 
                    362:        char    *comspec;               /* Pointer to environment variable COMSPEC */
                    363:        ushort  altul;                  /* Upload to alternate path flag */
                    364:        char    cid[LEN_CID+1]; /* Caller ID (IP Address) of current caller */
                    365:        char    *noaccess_str;  /* Why access was denied via ARS */
                    366:        long    noaccess_val;   /* Value of parameter not met in ARS */
                    367:        int             errorlevel;     /* Error level of external program */
                    368: 
                    369:        csi_t   main_csi;               /* Main Command Shell Image */
                    370: 
                    371:        smbmsg_t*       current_msg;    /* For message header @-codes */
                    372: 
                    373:                        /* Global command shell variables */
                    374:        uint    global_str_vars;
                    375:        char ** global_str_var;
1.1.1.2 ! root      376:        int32_t *       global_str_var_name;
1.1       root      377:        uint    global_int_vars;
1.1.1.2 ! root      378:        int32_t *       global_int_var;
        !           379:        int32_t *       global_int_var_name;
1.1       root      380:        char *  sysvar_p[MAX_SYSVARS];
                    381:        uint    sysvar_pi;
1.1.1.2 ! root      382:        int32_t sysvar_l[MAX_SYSVARS];
1.1       root      383:        uint    sysvar_li;
                    384: 
                    385:     /* ansi_term.cpp */
1.1.1.2 ! root      386:        const char*     ansi(int atr);                  /* Returns ansi escape sequence for atr */
        !           387:        char*   ansi(int atr, int curatr, char* str);
        !           388:     bool       ansi_gotoxy(int x, int y);
        !           389:        bool    ansi_getxy(int* x, int* y);
        !           390:        bool    ansi_save(void);
        !           391:        bool    ansi_restore(void);
1.1       root      392:        void    ansi_getlines(void);
                    393: 
                    394:                        /* Command Shell Methods */
                    395:        int             exec(csi_t *csi);
                    396:        int             exec_function(csi_t *csi);
                    397:        int             exec_misc(csi_t *csi, char *path);
                    398:        int             exec_net(csi_t *csi);
                    399:        int             exec_msg(csi_t *csi);
                    400:        int             exec_file(csi_t *csi);
1.1.1.2 ! root      401:        long    exec_bin(const char *mod, csi_t *csi, const char* startup_dir=NULL);
1.1       root      402:        void    clearvars(csi_t *bin);
                    403:        void    freevars(csi_t *bin);
1.1.1.2 ! root      404:        char**  getstrvar(csi_t *bin, int32_t name);
        !           405:        int32_t*        getintvar(csi_t *bin, int32_t name);
1.1       root      406:        char*   copystrvar(csi_t *csi, char *p, char *str);
                    407:        void    skipto(csi_t *csi, uchar inst);
1.1.1.2 ! root      408:        bool    ftp_cmd(csi_t* csi, SOCKET ctrl_sock, const char* cmdsrc, char* rsp);
1.1       root      409:        bool    ftp_put(csi_t* csi, SOCKET ctrl_sock, char* src, char* dest);
                    410:        bool    ftp_get(csi_t* csi, SOCKET ctrl_sock, char* src, char* dest, bool dir=false);
                    411:        SOCKET  ftp_data_sock(csi_t* csi, SOCKET ctrl_sock, SOCKADDR_IN*);
                    412: 
                    413:        bool    select_shell(void);
                    414:        bool    select_editor(void);
                    415: 
                    416:        void    sys_info(void);
                    417:        void    user_info(void);
                    418:        void    xfer_policy(void);
                    419: 
                    420:        void    xfer_prot_menu(enum XFER_TYPE);
                    421:        void    node_stats(uint node_num);
                    422:        void    sys_stats(void);
                    423:        void    logonlist(void);
                    424:        bool    spy(uint node_num);
                    425: 
                    426:        void    reset_logon_vars(void);
                    427: 
                    428:        uint    finduser(char *str);
                    429: 
                    430:        int     sub_op(uint subnum);
1.1.1.2 ! root      431:        ulong   getlastmsg(uint subnum, uint32_t *ptr, time_t *t);
1.1       root      432:        time_t  getmsgtime(uint subnum, ulong ptr);
                    433:        ulong   getmsgnum(uint subnum, time_t t);
                    434: 
                    435:        int             dir_op(uint dirnum);
                    436:        int             getuserxfers(int fromuser, int destuser, char *fname);
                    437: 
                    438:        void    getmsgptrs(void);
                    439:        void    putmsgptrs(void);
                    440:        void    getusrsubs(void);
                    441:        void    getusrdirs(void);
                    442:        uint    getusrsub(uint subnum);
                    443:        uint    getusrgrp(uint subnum);
                    444: 
                    445:        uint    userdatdupe(uint usernumber, uint offset, uint datlen, char *dat
1.1.1.2 ! root      446:                                ,bool del=false, bool next=false);
        !           447:        ulong   gettimeleft(bool handle_out_of_time=true);
1.1       root      448:        bool    gettimeleft_inside;
                    449: 
                    450:        /* str.cpp */
1.1.1.2 ! root      451:        char*   timestr(time_t intime);
1.1       root      452:     char       timestr_output[60];
                    453:        void    userlist(long mode);
1.1.1.2 ! root      454:        size_t  gettmplt(char *outstr, const char *tmplt, long mode);
1.1       root      455:        void    sif(char *fname, char *answers, long len);      /* Synchronet Interface File */
                    456:        void    sof(char *fname, char *answers, long len);
                    457:        void    create_sif_dat(char *siffile, char *datfile);
                    458:        void    read_sif_dat(char *siffile, char *datfile);
                    459:        void    printnodedat(uint number, node_t* node);
1.1.1.2 ! root      460:        bool    inputnstime32(time32_t *dt);
1.1       root      461:        bool    inputnstime(time_t *dt);
                    462:        bool    chkpass(char *pass, user_t* user, bool unique);
1.1.1.2 ! root      463:        char *  cmdstr(const char *instr, const char *fpath, const char *fspec, char *outstr);
1.1       root      464:        char    cmdstr_output[512];
                    465: 
                    466:        void    subinfo(uint subnum);
                    467:        void    dirinfo(uint dirnum);
1.1.1.2 ! root      468:        bool    trashcan(const char *insearch, const char *name);
1.1       root      469:        void    time_bank(void);
                    470:        void    change_user(void);
                    471: 
                    472:        /* writemsg.cpp */
                    473:        void    automsg(void);
1.1.1.2 ! root      474:        bool    writemsg(const char *str, const char *top, char *title, long mode, int subnum
        !           475:                                ,const char *dest, char** editor=NULL);
        !           476:        char*   quotes_fname(int xedit, char* buf, size_t len);
1.1       root      477:        char*   msg_tmp_fname(int xedit, char* fname, size_t len);
1.1.1.2 ! root      478:        char    putmsg(const char *str, long mode);
1.1       root      479:        bool    msgabort(void);
1.1.1.2 ! root      480:        bool    email(int usernumber, const char *top, const char *title, long mode);
1.1       root      481:        void    forwardmail(smbmsg_t* msg, int usernum);
                    482:        void    removeline(char *str, char *str2, char num, char skip);
1.1.1.2 ! root      483:        ulong   msgeditor(char *buf, const char *top, char *title);
        !           484:        bool    editfile(char *path);
1.1       root      485:        int             loadmsg(smbmsg_t *msg, ulong number);
                    486:        ushort  chmsgattr(ushort attr);
                    487:        void    show_msgattr(ushort attr);
                    488:        void    show_msghdr(smbmsg_t* msg);
                    489:        void    show_msg(smbmsg_t* msg, long mode);
                    490:        void    msgtotxt(smbmsg_t* msg, char *str, int header, int tails);
                    491:        void    quotemsg(smbmsg_t* msg, int tails);
                    492:        void    editmsg(smbmsg_t* msg, uint subnum);
1.1.1.2 ! root      493:        void    editor_inf(int xeditnum, const char *dest, const char *title, long mode
1.1       root      494:                                ,uint subnum);
                    495:        void    copyfattach(uint to, uint from, char *title);
                    496:        bool    movemsg(smbmsg_t* msg, uint subnum);
1.1.1.2 ! root      497:        int             process_edited_text(char* buf, FILE* stream, long mode, unsigned* lines);
        !           498:        int             process_edited_file(const char* src, const char* dest, long mode, unsigned* lines);
1.1       root      499: 
                    500:        /* postmsg.cpp */
                    501:        bool    postmsg(uint subnum, smbmsg_t* msg, long wm_mode);
                    502: 
                    503:        /* mail.cpp */
                    504:        int             delmail(uint usernumber,int which);
                    505:        void    telluser(smbmsg_t* msg);
1.1.1.2 ! root      506:        void    delallmail(uint usernumber, int which, bool permanent=true);
1.1       root      507: 
                    508:        /* getmsg.cpp */
1.1.1.2 ! root      509:        post_t* loadposts(int32_t *posts, uint subnum, ulong ptr, long mode);
1.1       root      510: 
                    511:        /* readmail.cpp */
                    512:        void    readmail(uint usernumber, int sent);
                    513: 
                    514:        /* bulkmail.cpp */
                    515:        bool    bulkmail(uchar *ar);
                    516:        int             bulkmailhdr(smb_t*, smbmsg_t*, uint usernum);
                    517: 
                    518:        /* con_out.cpp */
1.1.1.2 ! root      519:        int             bputs(const char *str);                                 /* BBS puts function */
        !           520:        int             rputs(const char *str, size_t len=0);   /* BBS raw puts function */
        !           521:        int             bprintf(const char *fmt, ...);                  /* BBS printf function */
        !           522:        int             rprintf(const char *fmt, ...);                  /* BBS raw printf function */
1.1       root      523:        void    backspace(void);                                /* Output a destructive backspace via outchar */
                    524:        void    outchar(char ch);                               /* Output a char - check echo and emu.  */
                    525:        void    center(char *str);
                    526:        void    clearline(void);
                    527:        void    cleartoeol(void);
                    528:        void    cursor_home(void);
                    529:        void    cursor_up(int count=1);
                    530:        void    cursor_down(int count=1);
                    531:        void    cursor_left(int count=1);
                    532:        void    cursor_right(int count=1);
                    533:        long    term_supports(long cmp_flags=0);
                    534: 
                    535:        /* getstr.cpp */
                    536:        size_t  getstr_offset;
                    537:        size_t  getstr(char *str, size_t length, long mode);
1.1.1.2 ! root      538:        long    getnum(ulong max, ulong dflt=0);
1.1       root      539:        void    insert_indicator(void);
                    540: 
                    541:        /* getkey.cpp */
                    542:        char    getkey(long mode);              /* Waits for a key hit local or remote  */
1.1.1.2 ! root      543:        long    getkeys(const char *str, ulong max);
1.1       root      544:        void    ungetkey(char ch);              /* Places 'ch' into the input buffer    */
1.1.1.2 ! root      545:        char    question[MAX_TEXTDAT_ITEM_LEN+1];
        !           546:        bool    yesno(const char *str);
        !           547:        bool    noyes(const char *str);
1.1       root      548:        void    pause(void);
1.1.1.2 ! root      549:        const char *    mnestr;
        !           550:        void    mnemonics(const char *str);
1.1       root      551: 
                    552:        /* inkey.cpp */
                    553:        char    inkey(long mode, unsigned long timeout=0);
                    554:        char    handle_ctrlkey(char ch, long mode=0);
                    555: 
                    556:        /* prntfile.cpp */
                    557:        void    printfile(char *str, long mode);
                    558:        void    printtail(char *str, int lines, long mode);
                    559:        void    menu(const char *code);
                    560: 
1.1.1.2 ! root      561:        int             uselect(int add, uint n, const char *title, const char *item, const uchar *ar);
1.1       root      562:        uint    uselect_total, uselect_num[500];
                    563: 
                    564:        void    redrwstr(char *strin, int i, int l, long mode);
                    565:        void    attr(int atr);                          /* Change local and remote text attributes */
                    566:        void    ctrl_a(char x);                 /* Peforms the Ctrl-Ax attribute changes */
                    567: 
                    568:        /* atcodes.cpp */
1.1.1.2 ! root      569:        int             show_atcode(const char *code);
        !           570:        const char*     atcode(char* sp, char* str, size_t maxlen);
1.1       root      571: 
                    572:        /* getnode.cpp */
                    573:        int             getsmsg(int usernumber);
                    574:        int             getnmsg(void);
                    575:        int             whos_online(bool listself);/* Lists active nodes, returns active nodes */
                    576:        void    nodelist(void);
                    577:        int             getnodeext(uint number, char * str);
                    578:        int             getnodedat(uint number, node_t * node, bool lock);
                    579:        void    nodesync(void);
                    580:        user_t  nodesync_user;
                    581:        bool    nodesync_inside;
                    582: 
                    583:        /* putnode.cpp */
                    584:        int             putnodedat(uint number, node_t * node);
                    585:        int             putnodeext(uint number, char * str);
                    586: 
1.1.1.2 ! root      587:        /* login.ccp */
1.1       root      588:        int             login(char *str, char *pw);
1.1.1.2 ! root      589:        void    badlogin(char* user, char* passwd);
        !           590: 
        !           591:        /* answer.cpp */
        !           592:        bool    answer();
        !           593: 
        !           594:        /* logon.ccp */
1.1       root      595:        bool    logon(void);
1.1.1.2 ! root      596: 
        !           597:        /* logout.cpp */
1.1       root      598:        void    logout(void);
                    599:        void    backout(void);
                    600: 
1.1.1.2 ! root      601:        /* newuser.cpp */
        !           602:        BOOL    newuser(void);                                  /* Get new user                                                 */
        !           603: 
1.1       root      604:        /* text_sec.cpp */
                    605:        int             text_sec(void);                                         /* Text sections */
                    606: 
                    607:        /* readmsgs.cpp */
1.1.1.2 ! root      608:        int             scanposts(uint subnum, long mode, const char* find);    /* Scan sub-board */
        !           609:        long    listsub(uint subnum, long mode, long start, const char* search);
1.1       root      610:        long    listmsgs(uint subnum, long mode, post_t* post, long start, long posts);
1.1.1.2 ! root      611:        long    searchposts(uint subnum, post_t* post, long start, long msgs, const char* find);
1.1       root      612:        long    showposts_toyou(post_t* post, ulong start, long posts);
                    613:        void    msghdr(smbmsg_t* msg);
                    614: 
                    615:        /* chat.cpp */
                    616:        void    chatsection(void);
                    617:        void    multinodechat(int channel=1);
                    618:        void    nodepage(void);
                    619:        void    nodemsg(void);
                    620:        uint    nodemsg_inside;
                    621:        uint    hotkey_inside;
                    622:        uchar   lastnodemsg;    /* Number of node last message was sent to */
                    623:        char    lastnodemsguser[LEN_ALIAS+1];
                    624:        void    guruchat(char* line, char* guru, int gurunum, char* last_answer);
                    625:        bool    guruexp(char **ptrptr, char *line);
                    626:        void    localguru(char *guru, int gurunum);
                    627:        bool    sysop_page(void);
                    628:        bool    guru_page(void);
                    629:        void    privchat(bool local=false);
                    630:        bool    chan_access(uint cnum);
                    631:        int             getnodetopage(int all, int telegram);
                    632: 
                    633:        /* main.cpp */
                    634:        void    printstatslog(uint node);
                    635:        ulong   logonstats(void);
                    636:        void    logoffstats(void);
                    637:        int             nopen(char *str, int access);
                    638:        int             mv(char *src, char *dest, char copy); /* fast file move/copy function */
                    639:        bool    chksyspass(void);
1.1.1.2 ! root      640:        bool    chk_ar(const uchar * str, user_t* user, client_t* client); /* checks access requirements */
        !           641:        bool    ar_exp(const uchar ** ptrptr, user_t*, client_t*);
1.1       root      642:        void    daily_maint(void);
                    643: 
                    644:        /* upload.cpp */
                    645:        bool    uploadfile(file_t* f);
                    646:        char    sbbsfilename[128],sbbsfiledesc[128]; /* env vars */
                    647:        bool    upload(uint dirnum);
                    648:     char       upload_lastdesc[LEN_FDESC+1];
                    649:        bool    bulkupload(uint dirnum);
                    650: 
                    651:        /* download.cpp */
                    652:        void    downloadfile(file_t* f);
                    653:        void    notdownloaded(ulong size, time_t start, time_t end);
                    654:        int             protocol(prot_t* prot, enum XFER_TYPE, char *fpath, char *fspec, bool cd);
1.1.1.2 ! root      655:        const char*     protcmdline(prot_t* prot, enum XFER_TYPE type);
1.1       root      656:        void    seqwait(uint devnum);
                    657:        void    autohangup(void);
                    658:        bool    checkdszlog(file_t*);
                    659:        bool    checkprotresult(prot_t*, int error, file_t*);
                    660:        bool    sendfile(char* fname, char prot=0);
                    661:        bool    recvfile(char* fname, char prot=0);
                    662: 
                    663:        /* file.cpp */
                    664:        void    fileinfo(file_t* f);
                    665:        void    openfile(file_t* f);
                    666:        void    closefile(file_t* f);
                    667:        bool    removefcdt(file_t* f);
1.1.1.2 ! root      668:        bool    removefile(file_t* f);
1.1       root      669:        bool    movefile(file_t* f, int newdir);
                    670:        char *  getfilespec(char *str);
                    671:        bool    checkfname(char *fname);
                    672:        bool    addtobatdl(file_t* f);
                    673: 
                    674:        /* listfile.cpp */
1.1.1.2 ! root      675:        bool    listfile(const char *fname, const char *buf, uint dirnum
        !           676:                                ,const char *search, const char letter, ulong datoffset);
        !           677:        int             listfiles(uint dirnum, const char *filespec, int tofile, long mode);
1.1       root      678:        int             listfileinfo(uint dirnum, char *filespec, long mode);
                    679:        void    listfiletofile(char *fname, char *buf, uint dirnum, int file);
                    680:        int             batchflagprompt(uint dirnum, file_t bf[], uint total, long totalfiles);
                    681: 
                    682:        /* bat_xfer.cpp */
                    683:        void    batchmenu(void);
                    684:        void    batch_create_list(void);
                    685:        void    batch_add_list(char *list);
                    686:        bool    create_batchup_lst(void);
                    687:        bool    create_batchdn_lst(bool native);
                    688:        bool    create_bimodem_pth(void);
                    689:        void    batch_upload(void);
                    690:        void    batch_download(int xfrprot);
                    691:        BOOL    start_batch_download(void);
                    692: 
                    693:        /* tmp_xfer.cpp */
                    694:        void    temp_xfer(void);
                    695:        void    extract(uint dirnum);
                    696:        char *  temp_cmd(void);                                 /* Returns temp file command line */
1.1.1.2 ! root      697:        ulong   create_filelist(const char *name, long mode);
1.1       root      698: 
                    699:        /* viewfile.cpp */
                    700:        int             viewfile(file_t* f, int ext);
                    701:        void    viewfiles(uint dirnum, char *fspec);
                    702:        void    viewfilecontents(file_t* f);
                    703: 
                    704:        /* sortdir.cpp */
                    705:        void    resort(uint dirnum);
                    706: 
                    707:        /* xtrn.cpp */
                    708:        int             external(const char* cmdline, long mode, const char* startup_dir=NULL);
                    709: 
                    710:        /* xtrn_sec.cpp */
                    711:        int             xtrn_sec(void);                                 /* The external program section  */
                    712:        void    xtrndat(char* name, char* dropdir, uchar type, ulong tleft
                    713:                                ,ulong misc);
                    714:        bool    exec_xtrn(uint xtrnnum);                        /* Executes online external program */
                    715:        bool    user_event(user_event_t);                       /* Executes user event(s) */
                    716:        char    xtrn_access(uint xnum);                 /* Does useron have access to xtrn? */
                    717:        void    moduserdat(uint xtrnnum);
                    718: 
                    719:        /* logfile.cpp */
1.1.1.2 ! root      720:        void    logentry(const char *code,const char *entry);
1.1       root      721:        void    log(char *str);                         /* Writes 'str' to node log */
                    722:        void    logch(char ch, bool comma);     /* Writes 'ch' to node log */
1.1.1.2 ! root      723:        void    logline(const char *code,const char *str); /* Writes 'str' on it's own line in log (LOG_INFO level) */
        !           724:        void    logline(int level, const char *code,const char *str);
1.1       root      725:        void    logofflist(void);              /* List of users logon activity */
1.1.1.2 ! root      726:        bool    syslog(const char* code, const char *entry);
1.1       root      727:        bool    errormsg_inside;
                    728:        void    errormsg(int line, const char *file, const char* action, const char *object
                    729:                                ,ulong access, const char *extinfo=NULL);
1.1.1.2 ! root      730:        BOOL    hacklog(char* prot, char* text);
        !           731: 
1.1       root      732:        /* qwk.cpp */
                    733:        bool    qwklogon;
                    734:        ulong   qwkmail_last;
                    735:        void    qwk_sec(void);
                    736:        int             qwk_route(char *inaddr, char *fulladdr);
                    737:        void    update_qwkroute(char *via);
                    738:        void    qwk_success(ulong msgcnt, char bi, char prepack);
                    739:        void    qwksetptr(uint subnum, char *buf, int reset);
                    740:        void    qwkcfgline(char *buf,uint subnum);
                    741:        int             set_qwk_flag(ulong flag);
                    742: 
                    743:        /* pack_qwk.cpp */
                    744:        bool    pack_qwk(char *packet, ulong *msgcnt, bool prepack);
                    745: 
                    746:        /* un_qwk.cpp */
                    747:        bool    unpack_qwk(char *packet,uint hubnum);
                    748: 
                    749:        /* pack_rep.cpp */
                    750:        bool    pack_rep(uint hubnum);
                    751: 
                    752:        /* un_rep.cpp */
                    753:        bool    unpack_rep(char* repfile=NULL);
1.1.1.2 ! root      754:        uint    resolve_qwkconf(uint n);
1.1       root      755: 
                    756:        /* msgtoqwk.cpp */
1.1.1.2 ! root      757:        ulong   msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, int subnum, int conf, FILE* hdrs_dat);
1.1       root      758: 
                    759:        /* qwktomsg.cpp */
1.1.1.2 ! root      760:        void    qwk_new_msg(smbmsg_t* msg, char* hdrblk, long offset, str_list_t headers, bool parse_sender_hfields);
        !           761:        bool    qwk_import_msg(FILE *qwk_fp, char *hdrblk, ulong blocks, char fromhub, uint subnum
        !           762:                                ,uint touser, smbmsg_t* msg);
1.1       root      763: 
                    764:        /* fido.cpp */
1.1.1.2 ! root      765:        bool    netmail(const char *into, const char *subj, long mode);
1.1       root      766:        void    qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub);
                    767:        bool    lookup_netuser(char *into);
                    768: 
1.1.1.2 ! root      769:        bool    inetmail(const char *into, const char *subj, long mode);
        !           770:        bool    qnetmail(const char *into, const char *subj, long mode);
1.1       root      771: 
                    772:        /* useredit.cpp */
                    773:        void    useredit(int usernumber);
                    774:        int             searchup(char *search,int usernum);
                    775:        int             searchdn(char *search,int usernum);
                    776:        void    maindflts(user_t* user);
                    777:        void    purgeuser(int usernumber);
                    778: 
                    779:        /* ver.cpp */
                    780:        void    ver(void);
                    781: 
                    782:        /* scansubs.cpp */
                    783:        void    scansubs(long mode);
                    784:        void    scanallsubs(long mode);
                    785:        void    new_scan_cfg(ulong misc);
                    786:        void    new_scan_ptr_cfg(void);
                    787: 
                    788:        /* scandirs.cpp */
                    789:        void    scanalldirs(long mode);
                    790:        void    scandirs(long mode);
                    791: 
                    792:        #define nosound()
                    793:        #define checkline()
                    794: 
                    795:        void    catsyslog(int crash);
                    796: 
                    797:        /* telgate.cpp */
                    798:        void    telnet_gate(char* addr, ulong mode);    // See TG_* for mode bits
                    799: 
                    800: };
                    801: 
                    802: #endif /* __cplusplus */
                    803: 
                    804: #ifdef DLLEXPORT
                    805: #undef DLLEXPORT
                    806: #endif
                    807: #ifdef DLLCALL
                    808: #undef DLLCALL
                    809: #endif
                    810: #ifdef _WIN32
                    811:        #ifdef SBBS_EXPORTS
                    812:                #define DLLEXPORT       __declspec(dllexport)
                    813:        #else
                    814:                #define DLLEXPORT       __declspec(dllimport)
                    815:        #endif
                    816:        #ifdef __BORLANDC__
                    817:                #define DLLCALL __stdcall
                    818:        #else
                    819:                #define DLLCALL
                    820:        #endif
                    821: #else  /* !_WIN32 */
                    822:        #define DLLEXPORT
                    823:        #define DLLCALL
                    824: #endif
                    825: 
                    826: #ifdef __cplusplus
                    827: extern "C" {
                    828: #endif
                    829: 
                    830:        /* main.cpp */
                    831:        DLLEXPORT int           DLLCALL sbbs_random(int);
                    832:        DLLEXPORT void          DLLCALL sbbs_srand(void);
                    833: 
                    834:        /* getstats.c */
                    835:        DLLEXPORT BOOL          DLLCALL getstats(scfg_t* cfg, char node, stats_t* stats);
                    836:        DLLEXPORT ulong         DLLCALL getposts(scfg_t* cfg, uint subnum);
                    837:        DLLEXPORT long          DLLCALL getfiles(scfg_t* cfg, uint dirnum);
                    838: 
                    839:        /* getmail.c */
                    840:        DLLEXPORT int           DLLCALL getmail(scfg_t* cfg, int usernumber, BOOL sent);
1.1.1.2 ! root      841:        DLLEXPORT mail_t *      DLLCALL loadmail(smb_t* smb, int32_t* msgs, uint usernumber
1.1       root      842:                                                                                ,int which, long mode);
                    843:        DLLEXPORT void          DLLCALL freemail(mail_t* mail);
                    844:        DLLEXPORT void          DLLCALL delfattach(scfg_t*, smbmsg_t*);
                    845: 
                    846:        /* postmsg.cpp */
1.1.1.2 ! root      847:        DLLEXPORT int           DLLCALL savemsg(scfg_t*, smb_t*, smbmsg_t*, client_t*, const char* server, char* msgbuf);
1.1       root      848:        DLLEXPORT void          DLLCALL signal_sub_sem(scfg_t*, uint subnum);
                    849:        DLLEXPORT int           DLLCALL msg_client_hfields(smbmsg_t*, client_t*);
1.1.1.2 ! root      850:        DLLEXPORT char*         DLLCALL msg_program_id(char* pid);
1.1       root      851: 
                    852:        /* filedat.c */
                    853:        DLLEXPORT BOOL          DLLCALL getfileixb(scfg_t* cfg, file_t* f);
                    854:        DLLEXPORT BOOL          DLLCALL putfileixb(scfg_t* cfg, file_t* f);
                    855:        DLLEXPORT BOOL          DLLCALL getfiledat(scfg_t* cfg, file_t* f);
                    856:        DLLEXPORT BOOL          DLLCALL putfiledat(scfg_t* cfg, file_t* f);
                    857:        DLLEXPORT void          DLLCALL putextdesc(scfg_t* cfg, uint dirnum, ulong datoffset, char *ext);
                    858:        DLLEXPORT void          DLLCALL getextdesc(scfg_t* cfg, uint dirnum, ulong datoffset, char *ext);
                    859:        DLLEXPORT char*         DLLCALL getfilepath(scfg_t* cfg, file_t* f, char* path);
                    860: 
                    861:        DLLEXPORT BOOL          DLLCALL removefiledat(scfg_t* cfg, file_t* f);
                    862:        DLLEXPORT BOOL          DLLCALL addfiledat(scfg_t* cfg, file_t* f);
                    863:        DLLEXPORT BOOL          DLLCALL findfile(scfg_t* cfg, uint dirnum, char *filename);
1.1.1.2 ! root      864:        DLLEXPORT char *        DLLCALL padfname(const char *filename, char *str);
        !           865:        DLLEXPORT char *        DLLCALL unpadfname(const char *filename, char *str);
1.1       root      866:        DLLEXPORT BOOL          DLLCALL rmuserxfers(scfg_t* cfg, int fromuser, int destuser, char *fname);
                    867: 
                    868:        DLLEXPORT int           DLLCALL update_uldate(scfg_t* cfg, file_t* f);
                    869: 
                    870:        /* str_util.c */
1.1.1.2 ! root      871:        DLLEXPORT char *        DLLCALL remove_ctrl_a(const char* instr, char* outstr);
        !           872:        DLLEXPORT char          DLLCALL ctrl_a_to_ascii_char(char code);
1.1       root      873:        DLLEXPORT char *        DLLCALL truncstr(char* str, const char* set);
                    874:        DLLEXPORT char *        DLLCALL ascii_str(uchar* str);
1.1.1.2 ! root      875:        DLLEXPORT char          DLLCALL exascii_to_ascii_char(uchar ch);
        !           876:        DLLEXPORT BOOL          DLLCALL findstr(const char *insearch, const char *fname);
        !           877:        DLLEXPORT BOOL          DLLCALL findstr_in_string(const char* insearchof, char* string);
        !           878:        DLLEXPORT BOOL          DLLCALL findstr_in_list(const char* insearchof, str_list_t list);
        !           879:        DLLEXPORT BOOL          DLLCALL trashcan(scfg_t* cfg, const char *insearch, const char *name);
        !           880:        DLLEXPORT char *        DLLCALL trashcan_fname(scfg_t* cfg, const char *name, char* fname, size_t);
        !           881:        DLLEXPORT str_list_t DLLCALL trashcan_list(scfg_t* cfg, const char* name);
        !           882:        DLLEXPORT char *        DLLCALL strip_exascii(const char *str, char* dest);
        !           883:        DLLEXPORT char *        DLLCALL strip_space(const char *str, char* dest);
        !           884:        DLLEXPORT char *        DLLCALL prep_file_desc(const char *str, char* dest);
        !           885:        DLLEXPORT char *        DLLCALL strip_ctrl(const char *str, char* dest);
1.1       root      886:        DLLEXPORT char *        DLLCALL net_addr(net_t* net);
1.1.1.2 ! root      887:        DLLEXPORT BOOL          DLLCALL valid_ctrl_a_attr(char a);
        !           888:        DLLEXPORT BOOL          DLLCALL valid_ctrl_a_code(char a);
1.1       root      889:        DLLEXPORT size_t        DLLCALL strip_invalid_attr(char *str);
                    890:        DLLEXPORT char *        DLLCALL ultoac(ulong l,char *str);
                    891:        DLLEXPORT char *        DLLCALL rot13(char* str);
                    892: 
                    893:        /* msg_id.c */
1.1.1.2 ! root      894:        DLLEXPORT char *        DLLCALL ftn_msgid(sub_t* sub, smbmsg_t* msg, char* msgid, size_t);
        !           895:        DLLEXPORT char *        DLLCALL get_msgid(scfg_t* cfg, uint subnum, smbmsg_t* msg, char* msgid, size_t);
1.1       root      896: 
                    897: 
                    898:        /* date_str.c */
                    899:        DLLEXPORT char *        DLLCALL zonestr(short zone);
1.1.1.2 ! root      900:        DLLEXPORT time_t        DLLCALL dstrtounix(scfg_t*, char *str);
1.1       root      901:        DLLEXPORT char *        DLLCALL unixtodstr(scfg_t*, time_t, char *str);
1.1.1.2 ! root      902:        DLLEXPORT char *        DLLCALL sectostr(uint sec, char *str);
1.1       root      903:        DLLEXPORT char *        DLLCALL hhmmtostr(scfg_t* cfg, struct tm* tm, char* str);
1.1.1.2 ! root      904:        DLLEXPORT char *        DLLCALL timestr(scfg_t* cfg, time_t intime, char* str);
1.1       root      905:        DLLEXPORT when_t        DLLCALL rfc822date(char* p);
                    906:        DLLEXPORT char *        DLLCALL msgdate(when_t when, char* buf);
                    907: 
                    908:        /* load_cfg.c */
                    909:        DLLEXPORT BOOL          DLLCALL load_cfg(scfg_t* cfg, char* text[], BOOL prep, char* error);
                    910:        DLLEXPORT void          DLLCALL free_cfg(scfg_t* cfg);
                    911:        DLLEXPORT void          DLLCALL free_text(char* text[]);
                    912:        DLLEXPORT ushort        DLLCALL sys_timezone(scfg_t* cfg);
                    913: 
                    914:        /* scfgsave.c */
                    915:        DLLEXPORT BOOL          DLLCALL save_cfg(scfg_t* cfg, int backup_level);
                    916:        DLLEXPORT BOOL          DLLCALL write_node_cfg(scfg_t* cfg, int backup_level);
                    917:        DLLEXPORT BOOL          DLLCALL write_main_cfg(scfg_t* cfg, int backup_level);
                    918:        DLLEXPORT BOOL          DLLCALL write_msgs_cfg(scfg_t* cfg, int backup_level);
                    919:        DLLEXPORT BOOL          DLLCALL write_file_cfg(scfg_t* cfg, int backup_level);
                    920:        DLLEXPORT BOOL          DLLCALL write_chat_cfg(scfg_t* cfg, int backup_level);
                    921:        DLLEXPORT BOOL          DLLCALL write_xtrn_cfg(scfg_t* cfg, int backup_level);
                    922:        DLLEXPORT BOOL          DLLCALL fcopy(char* src, char* dest);
                    923:        DLLEXPORT BOOL          DLLCALL fcompare(char* fn1, char* fn2);
                    924:        DLLEXPORT BOOL          DLLCALL backup(char *org, int backup_level, BOOL ren);
                    925:        DLLEXPORT void          DLLCALL refresh_cfg(scfg_t* cfg);
1.1.1.2 ! root      926: 
1.1       root      927: 
                    928:        /* scfglib1.c */
                    929:        DLLEXPORT char *        DLLCALL prep_dir(char* base, char* dir, size_t buflen);
                    930: 
                    931:        /* logfile.cpp */
1.1.1.2 ! root      932:        DLLEXPORT int           DLLCALL errorlog(scfg_t* cfg, const char* host, const char* text);
        !           933: 
        !           934:        DLLEXPORT BOOL          DLLCALL hacklog(scfg_t* cfg, char* prot, char* user, char* text
1.1       root      935:                                                                                ,char* host, SOCKADDR_IN* addr);
                    936:        DLLEXPORT BOOL          DLLCALL spamlog(scfg_t* cfg, char* prot, char* action, char* reason
                    937:                                                                                ,char* host, char* ip_addr, char* to, char* from);
                    938: 
1.1.1.2 ! root      939:        /* data.cpp */
        !           940:        DLLEXPORT time_t        DLLCALL getnextevent(scfg_t* cfg, event_t* event);
1.1       root      941: 
                    942:        /* data_ovl.cpp */
                    943:        DLLEXPORT BOOL          DLLCALL getmsgptrs(scfg_t* cfg, uint usernumber, subscan_t* subscan);
                    944:        DLLEXPORT BOOL          DLLCALL putmsgptrs(scfg_t* cfg, uint usernumber, subscan_t* subscan);
                    945: 
                    946:        /* sockopt.c */
                    947:        DLLEXPORT int           DLLCALL set_socket_options(scfg_t* cfg, SOCKET sock, const char* section
                    948:                ,char* error, size_t errlen);
                    949: 
                    950:        /* xtrn.cpp */
                    951:        DLLEXPORT char*         DLLCALL cmdstr(scfg_t* cfg, user_t* user, const char* instr
                    952:                                                                        ,const char* fpath, const char* fspec, char* cmd);
                    953: 
                    954: #ifdef JAVASCRIPT
                    955: 
                    956:        typedef struct {
                    957:                const char*             name;
                    958:                JSNative        call;
                    959:                uint8           nargs;
                    960:                int                             type;           /* return type */
                    961:                const char*             args;           /* arguments */
                    962:                const char*             desc;           /* description */
                    963:                int                             ver;            /* version added/modified */
                    964:        } jsSyncMethodSpec;
                    965: 
                    966:        typedef struct {
                    967:                const char      *name;
                    968:                int8            tinyid;
                    969:                uint8           flags;
                    970:                int                             ver;            /* version added/modified */
                    971:        } jsSyncPropertySpec;
                    972: 
                    973:        typedef struct {
                    974:                const char*             name;
                    975:                int                             val;
                    976:        } jsConstIntSpec;
                    977: 
                    978:        typedef struct {
                    979:                char            version[128];
                    980:                const char*     version_detail;
1.1.1.2 ! root      981:                uint32_t*       interface_addr;
        !           982:                uint32_t*       options;
        !           983:                uint32_t*       clients;
1.1       root      984:        } js_server_props_t;
                    985: 
                    986:        enum {
                    987:                 JSTYPE_ARRAY=JSTYPE_LIMIT
                    988:                ,JSTYPE_ALIAS
                    989:                ,JSTYPE_UNDEF
1.1.1.2 ! root      990: #if JS_VERSION < JSVERSION_1_6 /* JSTYPE_NULL was removed after 1.5 rc 6a (?) */
1.1       root      991:                ,JSTYPE_NULL
                    992: #endif
                    993:        };
                    994: 
                    995:        #ifdef BUILD_JSDOCS     /* String compiled into debug build only, for JS documentation generation */
                    996:                #define JSDOCSTR(s)     s
                    997:        #else
                    998:                #define JSDOCSTR(s)     NULL
                    999:        #endif
                   1000: 
                   1001:        /* main.cpp */
                   1002:        DLLEXPORT JSBool        DLLCALL js_DescribeSyncObject(JSContext* cx, JSObject* obj, const char*, int ver);
                   1003:        DLLEXPORT JSBool        DLLCALL js_DescribeSyncConstructor(JSContext* cx, JSObject* obj, const char*);
                   1004:        DLLEXPORT JSBool        DLLCALL js_DefineSyncMethods(JSContext* cx, JSObject* obj, jsSyncMethodSpec*, BOOL append);
                   1005:        DLLEXPORT JSBool        DLLCALL js_DefineSyncProperties(JSContext* cx, JSObject* obj, jsSyncPropertySpec*);
1.1.1.2 ! root     1006:        DLLEXPORT JSBool        DLLCALL js_SyncResolve(JSContext* cx, JSObject* obj, char *name, jsSyncPropertySpec* props, jsSyncMethodSpec* funcs, jsConstIntSpec* consts, int flags);
1.1       root     1007:        DLLEXPORT JSBool        DLLCALL js_DefineConstIntegers(JSContext* cx, JSObject* obj, jsConstIntSpec*, int flags);
                   1008:        DLLEXPORT JSBool        DLLCALL js_CreateArrayOfStrings(JSContext* cx, JSObject* parent
                   1009:                                                                                                                ,const char* name, char* str[], uintN flags);
                   1010:        DLLEXPORT char*         DLLCALL js_ValueToStringBytes(JSContext* cx, jsval val, size_t* len);
                   1011: 
                   1012:        #define JSVAL_IS_NUM(v)         (JSVAL_IS_NUMBER(v) && (!JSVAL_IS_DOUBLE(v) || !JSDOUBLE_IS_NaN(*JSVAL_TO_DOUBLE(v))))
                   1013: 
                   1014:        /* js_server.c */
                   1015:        DLLEXPORT JSObject* DLLCALL js_CreateServerObject(JSContext* cx, JSObject* parent
                   1016:                                                                                ,js_server_props_t* props);
                   1017: 
                   1018:        /* js_global.c */
1.1.1.2 ! root     1019:        DLLEXPORT JSObject* DLLCALL js_CreateGlobalObject(JSContext* cx, scfg_t* cfg, jsSyncMethodSpec* methods, js_startup_t*);
1.1       root     1020:        DLLEXPORT JSObject*     DLLCALL js_CreateCommonObjects(JSContext* cx
                   1021:                                                                                                        ,scfg_t* cfg                            /* common */
                   1022:                                                                                                        ,scfg_t* node_cfg                       /* node-specific */
                   1023:                                                                                                        ,jsSyncMethodSpec* methods      /* global */
                   1024:                                                                                                        ,time_t uptime                          /* system */
                   1025:                                                                                                        ,char* host_name                        /* system */
                   1026:                                                                                                        ,char* socklib_desc                     /* system */
1.1.1.2 ! root     1027:                                                                                                        ,js_branch_t*                           /* js */
        !          1028:                                                                                                        ,js_startup_t*                          /* js */
1.1       root     1029:                                                                                                        ,client_t* client                       /* client */
                   1030:                                                                                                        ,SOCKET client_socket           /* client */
                   1031:                                                                                                        ,js_server_props_t* props       /* server */
                   1032:                                                                                                        );
                   1033: 
                   1034:        /* js_internal.c */
1.1.1.2 ! root     1035:        DLLEXPORT JSObject* DLLCALL js_CreateInternalJsObject(JSContext*, JSObject* parent, js_branch_t*, js_startup_t*);
1.1       root     1036:        DLLEXPORT JSBool        DLLCALL js_CommonBranchCallback(JSContext*, js_branch_t*);
                   1037:        DLLEXPORT void          DLLCALL js_EvalOnExit(JSContext*, JSObject*, js_branch_t*);
1.1.1.2 ! root     1038:        DLLEXPORT void          DLLCALL js_PrepareToExecute(JSContext*, JSObject*, const char *filename, const char* startup_dir);
1.1       root     1039: 
                   1040:        /* js_system.c */
                   1041:        DLLEXPORT JSObject* DLLCALL js_CreateSystemObject(JSContext* cx, JSObject* parent
                   1042:                                                                                                        ,scfg_t* cfg, time_t uptime
                   1043:                                                                                                        ,char* host_name
                   1044:                                                                                                        ,char* socklib_desc);
                   1045: 
                   1046:        /* js_client.c */
                   1047:        DLLEXPORT JSObject* DLLCALL js_CreateClientObject(JSContext* cx, JSObject* parent
                   1048:                                                                                                        ,char* name, client_t* client, SOCKET sock);
                   1049:        /* js_user.c */
                   1050:        DLLEXPORT JSObject*     DLLCALL js_CreateUserClass(JSContext* cx, JSObject* parent, scfg_t* cfg);
                   1051:        DLLEXPORT JSObject* DLLCALL js_CreateUserObject(JSContext* cx, JSObject* parent, scfg_t* cfg
1.1.1.2 ! root     1052:                                                                                                        ,char* name, user_t* user, client_t* client, BOOL global_user);
1.1       root     1053:        DLLEXPORT JSBool        DLLCALL js_CreateUserObjects(JSContext* cx, JSObject* parent, scfg_t* cfg
1.1.1.2 ! root     1054:                                                                                                        ,user_t* user, client_t* client, char* html_index_file
1.1       root     1055:                                                                                                        ,subscan_t* subscan);
                   1056:        /* js_file_area.c */
1.1.1.2 ! root     1057:        DLLEXPORT JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_t* cfg
        !          1058:                                                                                                        ,user_t* user, client_t* client, char* html_index_file);
1.1       root     1059: 
                   1060:        /* js_msg_area.c */
                   1061:        DLLEXPORT JSObject* DLLCALL js_CreateMsgAreaObject(JSContext* cx, JSObject* parent, scfg_t* cfg
1.1.1.2 ! root     1062:                                                                                                        ,user_t* user, client_t* client, subscan_t* subscan);
1.1       root     1063:        DLLEXPORT BOOL          DLLCALL js_CreateMsgAreaProperties(JSContext* cx, scfg_t* cfg
                   1064:                                                                                                        ,JSObject* subobj, uint subnum);
                   1065: 
                   1066:        /* js_xtrn_area.c */
                   1067:        DLLEXPORT JSObject* DLLCALL js_CreateXtrnAreaObject(JSContext* cx, JSObject* parent, scfg_t* cfg
1.1.1.2 ! root     1068:                                                                                                        ,user_t* user, client_t* client);
1.1       root     1069: 
                   1070:        /* js_msgbase.c */
                   1071:        DLLEXPORT JSObject* DLLCALL js_CreateMsgBaseClass(JSContext* cx, JSObject* parent, scfg_t* cfg);
                   1072:        DLLEXPORT BOOL          DLLCALL js_ParseMsgHeaderObject(JSContext* cx, JSObject* hdrobj, smbmsg_t*);
                   1073: 
                   1074:        /* js_socket.c */
                   1075:        DLLEXPORT JSObject* DLLCALL js_CreateSocketClass(JSContext* cx, JSObject* parent);
                   1076:        DLLEXPORT JSObject* DLLCALL js_CreateSocketObject(JSContext* cx, JSObject* parent
                   1077:                                                                                                        ,char *name, SOCKET sock);
                   1078:        DLLEXPORT void          DLLCALL js_timeval(JSContext* cx, jsval val, struct timeval* tv);
                   1079:        DLLEXPORT SOCKET        DLLCALL js_socket(JSContext *cx, jsval val);
                   1080: 
                   1081:        /* js_queue.c */
                   1082:        DLLEXPORT JSObject* DLLCALL js_CreateQueueClass(JSContext* cx, JSObject* parent);
                   1083:        DLLEXPORT JSObject* DLLCALL js_CreateQueueObject(JSContext* cx, JSObject* parent
                   1084:                                                                                                        ,char *name, msg_queue_t* q);
                   1085:        BOOL js_enqueue_value(JSContext *cx, msg_queue_t* q, jsval val, char* name);
                   1086: 
                   1087:        /* js_file.c */
                   1088:        DLLEXPORT JSObject* DLLCALL js_CreateFileClass(JSContext* cx, JSObject* parent);
                   1089: 
                   1090:        /* js_sprintf.c */
                   1091:        DLLEXPORT char*         DLLCALL js_sprintf(JSContext* cx, uint argn, uintN argc, jsval *argv);
                   1092:        DLLEXPORT void          DLLCALL js_sprintf_free(char *);
                   1093: 
                   1094:        /* js_console.cpp */
                   1095:        JSObject* js_CreateConsoleObject(JSContext* cx, JSObject* parent);
                   1096: 
                   1097:        /* js_bbs.cpp */
                   1098:        JSObject* js_CreateBbsObject(JSContext* cx, JSObject* parent);
                   1099: 
                   1100:        /* js_uifc.c */
                   1101:        JSObject* js_CreateUifcObject(JSContext* cx, JSObject* parent);
                   1102: 
1.1.1.2 ! root     1103:        /* js_conio.c */
        !          1104:        JSObject* js_CreateConioObject(JSContext* cx, JSObject* parent);
        !          1105: 
        !          1106:        /* js_com.c */
        !          1107:        DLLEXPORT JSObject* DLLCALL js_CreateCOMClass(JSContext* cx, JSObject* parent);
        !          1108:        DLLEXPORT JSObject* DLLCALL js_CreateCOMObject(JSContext* cx, JSObject* parent, const char *name, COM_HANDLE sock);
        !          1109: 
1.1       root     1110: #endif
                   1111: 
                   1112: /* str_util.c */
1.1.1.2 ! root     1113: size_t bstrlen(const char *str);
        !          1114: char*  backslashcolon(char *str);
        !          1115: ulong  ahtoul(const char *str);        /* Converts ASCII hex to ulong */
1.1       root     1116: char * hexplus(uint num, char *str);   /* Hex plus for 3 digits up to 9000 */
1.1.1.2 ! root     1117: uint   hptoi(const char *str);
        !          1118: int            pstrcmp(const char **str1, const char **str2);  /* Compares pointers to pointers */
        !          1119: int            strsame(const char *str1, const char *str2);    /* Compares number of same chars */
1.1       root     1120: 
                   1121: /* load_cfg.c */
                   1122: BOOL   md(char *path);
                   1123: 
                   1124: #ifdef SBBS /* These aren't exported */
                   1125: 
                   1126:        /* main.c */
1.1.1.2 ! root     1127:        int     lputs(int level, const char *);                 /* log output */
        !          1128:        int     lprintf(int level, const char *fmt, ...);       /* log output */
        !          1129:        int     eprintf(int level, const char *fmt, ...);       /* event log */
1.1       root     1130:        SOCKET  open_socket(int type, const char* protocol);
                   1131:        SOCKET  accept_socket(SOCKET s, SOCKADDR* addr, socklen_t* addrlen);
                   1132:        int             close_socket(SOCKET);
                   1133:        u_long  resolve_ip(char *addr);
                   1134: 
1.1.1.2 ! root     1135:        char *  readtext(long *line, FILE *stream, long dflt);
1.1       root     1136: 
                   1137:        /* ver.cpp */
                   1138:        char*   socklib_version(char* str, char* winsock_ver);
1.1.1.2 ! root     1139: 
1.1       root     1140:        /* sortdir.cpp */
                   1141:        int             fnamecmp_a(char **str1, char **str2);    /* for use with resort() */
                   1142:        int             fnamecmp_d(char **str1, char **str2);
                   1143:        int             fdatecmp_a(uchar **buf1, uchar **buf2);
                   1144:        int             fdatecmp_d(uchar **buf1, uchar **buf2);
                   1145: 
                   1146:        /* file.cpp */
1.1.1.2 ! root     1147:        BOOL    filematch(const char *filename, const char *filespec);
1.1       root     1148: 
                   1149:        /* sbbscon.c */
                   1150:        #if defined(__unix__) && defined(NEEDS_DAEMON)
                   1151:        int daemon(int nochdir, int noclose);
                   1152:        #endif
                   1153: 
                   1154: #endif /* SBBS */
                   1155: 
                   1156: extern const char* wday[];     /* abbreviated weekday names */
                   1157: extern const char* mon[];      /* abbreviated month names */
                   1158: extern char lastuseron[LEN_ALIAS+1];  /* Name of user last online */
                   1159: 
                   1160: #ifdef __cplusplus
                   1161: }
                   1162: #endif
                   1163: 
                   1164: extern
                   1165: #ifdef __cplusplus
                   1166:  "C"
                   1167: #endif
                   1168:        const char* beta_version;
                   1169: 
                   1170: /* Global data */
                   1171: 
                   1172: /* ToDo: These should be hunted down and killed */
                   1173: #define lread(f,b,l) read(f,b,l)
                   1174: #define lfread(b,l,f) fread(b,l,f)
                   1175: #define lwrite(f,b,l) write(f,b,l)
                   1176: #define lfwrite(b,l,f) fwrite(b,l,f)
                   1177: #define lkbrd(x)       0
                   1178: 
                   1179: #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.