Annotation of sbbs/src/smblib/smbdefs.h, revision 1.1.1.2

1.1       root        1: /* smbdefs.h */
                      2: 
                      3: /* Synchronet message base constant and structure definitions */
                      4: 
1.1.1.2 ! root        5: /* $Id: smbdefs.h,v 1.78 2011/08/30 22:12:01 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 _SMBDEFS_H
                     39: #define _SMBDEFS_H
                     40: 
                     41: /* ANSI headers */
                     42: #include <stdio.h>
                     43: #include <time.h>
                     44: 
                     45: /* XPDEV headers */
                     46: #include "genwrap.h"   /* truncsp() and get_errno() */
                     47: #include "dirwrap.h"   /* MAX_PATH */
                     48: #include "filewrap.h"  /* SH_DENYRW */
                     49: 
                     50: /* SMBLIB Headers */
                     51: #include "md5.h"               /* MD5_DIGEST_SIZE */
                     52: 
                     53: /**********/
                     54: /* Macros */
                     55: /**********/
                     56: 
                     57: #define SMB_HEADER_ID  "SMB\x1a"               /* <S> <M> <B> <^Z> */
                     58: #define SHD_HEADER_ID  "SHD\x1a"               /* <S> <H> <D> <^Z> */
                     59: #define LEN_HEADER_ID  4
                     60: 
                     61: #ifndef uchar
                     62:        #if defined(TYPEDEF_UCHAR)
                     63:                typedef unsigned char uchar;
                     64:        #else
                     65:                #define uchar unsigned char
                     66:        #endif
                     67: #endif
                     68: #ifdef __GLIBC__
                     69:        #include <sys/types.h>
                     70: #else
                     71:        #ifndef ushort
                     72:        #define ushort                          unsigned short
                     73:        #define ulong                           unsigned long
                     74:        #define uint                            unsigned int
                     75:        #endif
                     76: #endif
                     77: 
                     78: #define HUGE16
                     79: #define FAR16
                     80: #define REALLOC realloc
                     81: #define LMALLOC malloc
                     82: #define MALLOC malloc
                     83: #define LFREE free
                     84: #define FREE free
                     85: 
                     86: 
                     87: #define SDT_BLOCK_LEN          256             /* Size of data blocks */
                     88: #define SHD_BLOCK_LEN          256             /* Size of header blocks */
                     89: 
                     90: #define SMB_MAX_HDR_LEN                0xffffU         /* Message header length is 16-bit */
                     91: 
                     92: #define SMB_SELFPACK           0                       /* Self-packing storage allocation */
                     93: #define SMB_FASTALLOC          1                       /* Fast allocation */
                     94: 
1.1.1.2 ! root       95:                                                                                /* status.attr bit flags: */
1.1       root       96: #define SMB_EMAIL                      1                       /* User numbers stored in Indexes */
1.1.1.2 ! root       97: #define SMB_HYPERALLOC         2                       /* No allocation (also storage value for smb_addmsghdr) */
        !            98: #define SMB_NOHASH                     4                       /* Do not calculate or store hashes */
1.1       root       99: 
                    100: #define SMB_SUCCESS                    0                       /* Successful result/return code */
                    101: #define SMB_FAILURE                    -1                      /* Generic error (discouraged) */
                    102: 
                    103:                                                                                /* Standard smblib errors values */
                    104: #define SMB_ERR_NOT_OPEN       -100            /* Message base not open */
                    105: #define SMB_ERR_HDR_LEN                -101            /* Invalid message header length (>64k) */
                    106: #define SMB_ERR_HDR_OFFSET     -102            /* Invalid message header offset */
                    107: #define SMB_ERR_HDR_ID         -103            /* Invalid header ID */
                    108: #define SMB_ERR_HDR_VER                -104            /* Unsupported version */
                    109: #define SMB_ERR_HDR_FIELD      -105            /* Missing header field */
                    110: #define SMB_ERR_NOT_FOUND      -110            /* Item not found */
                    111: #define SMB_ERR_DAT_OFFSET     -120            /* Invalid data offset (>2GB) */
                    112: #define SMB_ERR_DAT_LEN                -121            /* Invalid data length (>2GB) */
                    113: #define SMB_ERR_OPEN           -200            /* File open error */
                    114: #define SMB_ERR_SEEK           -201            /* File seek/setpos error */
                    115: #define SMB_ERR_LOCK           -202            /* File lock error */
                    116: #define SMB_ERR_READ           -203            /* File read error */
                    117: #define SMB_ERR_WRITE          -204            /* File write error */
                    118: #define SMB_ERR_TIMEOUT                -205            /* File operation timed-out */
                    119: #define SMB_ERR_FILE_LEN       -206            /* File length invalid */
                    120: #define SMB_ERR_DELETE         -207            /* File deletion error */
                    121: #define SMB_ERR_UNLOCK         -208            /* File unlock error */
                    122: #define SMB_ERR_MEM                    -300            /* Memory allocation error */
                    123: 
                    124: #define SMB_DUPE_MSG           1                       /* Duplicate message detected by smb_addcrc() */
                    125: 
                    126:                                                                                /* Time zone macros for when_t.zone */
                    127: #define DAYLIGHT                       0x8000          /* Daylight savings is active */
                    128: #define US_ZONE                        0x4000          /* U.S. time zone */
                    129: #define WESTERN_ZONE           0x2000          /* Non-standard zone west of UT */
                    130: #define EASTERN_ZONE           0x1000          /* Non-standard zone east of UT */
                    131: 
                    132:                                                                                /* US Time Zones (standard) */
                    133: #define AST                            0x40F0          /* Atlantic                     (-04:00) */
                    134: #define EST                            0x412C          /* Eastern                              (-05:00) */
                    135: #define CST                            0x4168          /* Central                              (-06:00) */
                    136: #define MST                            0x41A4          /* Mountain                     (-07:00) */
                    137: #define PST                            0x41E0          /* Pacific                              (-08:00) */
                    138: #define YST                            0x421C          /* Yukon                                (-09:00) */
                    139: #define HST                            0x4258          /* Hawaii/Alaska                (-10:00) */
                    140: #define BST                            0x4294          /* Bering                               (-11:00) */
                    141: 
                    142:                                                                                /* US Time Zones (daylight) */
                    143: #define ADT                            0xC0F0          /* Atlantic                     (-03:00) */
                    144: #define EDT                            0xC12C          /* Eastern                              (-04:00) */
                    145: #define CDT                            0xC168          /* Central                              (-05:00) */
                    146: #define MDT                            0xC1A4          /* Mountain                     (-06:00) */
                    147: #define PDT                            0xC1E0          /* Pacific                              (-07:00) */
                    148: #define YDT                            0xC21C          /* Yukon                                (-08:00) */
                    149: #define HDT                            0xC258          /* Hawaii/Alaska                (-09:00) */
                    150: #define BDT                            0xC294          /* Bering                               (-10:00) */
                    151: 
                    152:                                                                                /* Non-standard Time Zones */
                    153: #define MID                            0x2294          /* Midway                               (-11:00) */
                    154: #define VAN                            0x21E0          /* Vancouver                    (-08:00) */
                    155: #define EDM                            0x21A4          /* Edmonton                     (-07:00) */
                    156: #define WIN                            0x2168          /* Winnipeg                     (-06:00) */
                    157: #define BOG                            0x212C          /* Bogota                               (-05:00) */
                    158: #define CAR                            0x20F0          /* Caracas                              (-04:00) */
                    159: #define RIO                            0x20B4          /* Rio de Janeiro               (-03:00) */
                    160: #define FER                            0x2078          /* Fernando de Noronha  (-02:00) */
                    161: #define AZO                            0x203C          /* Azores                               (-01:00) */
                    162: #define LON                            0x1000          /* London                               (+00:00) */
                    163: #define BER                            0x103C          /* Berlin                               (+01:00) */
                    164: #define ATH                            0x1078          /* Athens                               (+02:00) */
                    165: #define MOS                            0x10B4          /* Moscow                               (+03:00) */
                    166: #define DUB                            0x10F0          /* Dubai                                (+04:00) */
                    167: #define KAB                            0x110E          /* Kabul                                (+04:30) */
                    168: #define KAR                            0x112C          /* Karachi                              (+05:00) */
                    169: #define BOM                            0x114A          /* Bombay                               (+05:30) */
                    170: #define KAT                            0x1159          /* Kathmandu                    (+05:45) */
                    171: #define DHA                            0x1168          /* Dhaka                                (+06:00) */
                    172: #define BAN                            0x11A4          /* Bangkok                              (+07:00) */
                    173: #define HON                            0x11E0          /* Hong Kong                    (+08:00) */
                    174: #define TOK                            0x121C          /* Tokyo                                (+09:00) */
                    175: #define SYD                            0x1258          /* Sydney                               (+10:00) */
                    176: #define NOU                            0x1294          /* Noumea                               (+11:00) */
                    177: #define WEL                            0x12D0          /* Wellington                   (+12:00) */
                    178: 
                    179: #define OTHER_ZONE(zone) (zone<=1000 && zone>=-1000)
                    180: 
                    181:                                                                                /* Valid hfield_t.types */
                    182: #define SENDER                         0x00
                    183: #define SENDERAGENT            0x01
                    184: #define SENDERNETTYPE          0x02
                    185: #define SENDERNETADDR          0x03
                    186: #define SENDEREXT                      0x04
                    187: #define SENDERPOS                      0x05
                    188: #define SENDERORG                      0x06
                    189: #define SENDERIPADDR           0x07            /* for tracing */
                    190: #define SENDERHOSTNAME         0x08            /* for tracing */
                    191: #define SENDERPROTOCOL         0x09            /* for tracing */
1.1.1.2 ! root      192: #define SENDERPORT_BIN         0x0a            /* deprecated */
        !           193: #define SENDERPORT                     0x0b            /* for tracing */
        !           194: 
        !           195:                                                                                /* Used for the SMTP Originator-Info header field: */
        !           196: #define SENDERUSERID           0x0c            /* user-id */
        !           197: #define SENDERTIME                     0x0d            /* authentication/connection time */
        !           198: #define SENDERSERVER           0x0e            /* server hostname that authenticed user */
1.1       root      199: 
                    200: #define AUTHOR                         0x10
                    201: #define AUTHORAGENT            0x11
                    202: #define AUTHORNETTYPE          0x12
                    203: #define AUTHORNETADDR          0x13
                    204: #define AUTHOREXT                      0x14
                    205: #define AUTHORPOS                      0x15
                    206: #define AUTHORORG                      0x16
                    207: 
                    208: #define REPLYTO                        0x20
                    209: #define REPLYTOAGENT           0x21
                    210: #define REPLYTONETTYPE         0x22
                    211: #define REPLYTONETADDR         0x23
                    212: #define REPLYTOEXT                     0x24
                    213: #define REPLYTOPOS                     0x25
                    214: #define REPLYTOORG                     0x26
                    215: 
                    216: #define RECIPIENT                      0x30
                    217: #define RECIPIENTAGENT         0x31
                    218: #define RECIPIENTNETTYPE       0x32
                    219: #define RECIPIENTNETADDR       0x33
                    220: #define RECIPIENTEXT           0x34
                    221: #define RECIPIENTPOS           0x35
                    222: #define RECIPIENTORG           0x36
                    223: 
                    224: #define FORWARDTO                      0x40
                    225: #define FORWARDTOAGENT         0x41
                    226: #define FORWARDTONETTYPE       0x42
                    227: #define FORWARDTONETADDR       0x43
                    228: #define FORWARDTOEXT           0x44
                    229: #define FORWARDTOPOS           0x45
                    230: #define FORWARDTOORG           0x46
                    231: 
                    232: #define FORWARDED                      0x48
                    233: 
1.1.1.2 ! root      234: #if 0  /* Deprecating the following fields: (Jan-2009) never used */
        !           235: 
1.1       root      236: #define RECEIVEDBY                     0x50
                    237: #define RECEIVEDBYAGENT        0x51
                    238: #define RECEIVEDBYNETTYPE      0x52
                    239: #define RECEIVEDBYNETADDR      0x53
                    240: #define RECEIVEDBYEXT          0x54
                    241: #define RECEIVEDBYPOS          0x55
                    242: #define RECEIVEDBYORG          0x56
                    243: 
                    244: #define RECEIVED                       0x58
                    245: 
1.1.1.2 ! root      246: #endif
        !           247: 
1.1       root      248: #define SUBJECT                        0x60    /* or filename */
                    249: #define SMB_SUMMARY            0x61    /* or file description */
                    250: #define SMB_COMMENT            0x62
                    251: #define SMB_CARBONCOPY         0x63
                    252: #define SMB_GROUP                      0x64
                    253: #define SMB_EXPIRATION         0x65
                    254: #define SMB_PRIORITY           0x66
                    255: #define SMB_COST                       0x67
1.1.1.2 ! root      256: #define        SMB_EDITOR                      0x68
1.1       root      257: 
                    258: #define FILEATTACH                     0x70
                    259: #define DESTFILE                       0x71
                    260: #define FILEATTACHLIST         0x72
                    261: #define DESTFILELIST           0x73
                    262: #define FILEREQUEST            0x74
                    263: #define FILEPASSWORD           0x75
                    264: #define FILEREQUESTLIST        0x76
                    265: #define FILEPASSWORDLIST       0x77
                    266: 
                    267: #define IMAGEATTACH            0x80
                    268: #define ANIMATTACH                     0x81
                    269: #define FONTATTACH                     0x82
                    270: #define SOUNDATTACH            0x83
                    271: #define PRESENTATTACH          0x84
                    272: #define VIDEOATTACH            0x85
                    273: #define APPDATAATTACH          0x86
                    274: 
                    275: #define IMAGETRIGGER           0x90
                    276: #define ANIMTRIGGER            0x91
                    277: #define FONTTRIGGER            0x92
                    278: #define SOUNDTRIGGER           0x93
                    279: #define PRESENTTRIGGER         0x94
                    280: #define VIDEOTRIGGER           0x95
                    281: #define APPDATATRIGGER         0x96
                    282: 
                    283: #define FIDOCTRL                       0xa0
                    284: #define FIDOAREA                       0xa1
                    285: #define FIDOSEENBY                     0xa2
                    286: #define FIDOPATH                       0xa3
                    287: #define FIDOMSGID                      0xa4
                    288: #define FIDOREPLYID            0xa5
                    289: #define FIDOPID                        0xa6
                    290: #define FIDOFLAGS                      0xa7
                    291: #define FIDOTID                        0xa8
                    292: 
                    293: #define RFC822HEADER           0xb0
                    294: #define RFC822MSGID            0xb1
                    295: #define RFC822REPLYID          0xb2
                    296: #define RFC822TO                       0xb3
                    297: #define RFC822FROM                     0xb4
                    298: #define RFC822REPLYTO          0xb5
                    299: 
                    300: #define USENETPATH                     0xc0
                    301: #define USENETNEWSGROUPS       0xc1
                    302: 
1.1.1.2 ! root      303: #define SMTPCOMMAND                    0xd0            /* Arbitrary SMTP command */
1.1       root      304: #define SMTPREVERSEPATH                0xd1            /* MAIL FROM: argument, "reverse path" */
                    305: #define SMTPFORWARDPATH                0xd2            /* RCPT TO: argument, "forward path" */
1.1.1.2 ! root      306: #define SMTPRECEIVED           0xd3            /* SMTP "Received" information */
1.1       root      307: 
                    308: #define SMTPSYSMSG                     0xd8            /* for delivery failure notification */
                    309: 
                    310: #define UNKNOWN                        0xf1
                    311: #define UNKNOWNASCII           0xf2
                    312: #define UNUSED                         0xff
                    313: 
                    314:                                                                                /* Valid dfield_t.types */
                    315: #define TEXT_BODY                      0x00
                    316: #define TEXT_SOUL                      0x01
                    317: #define TEXT_TAIL                      0x02
                    318: #define TEXT_WING                      0x03
                    319: #define IMAGEEMBED                     0x20
                    320: #define ANIMEMBED                      0x21
                    321: #define FONTEMBED                      0x22
                    322: #define SOUNDEMBED                     0x23
                    323: #define PRESENTEMBED           0x24
                    324: #define VIDEOEMBED                     0x25
                    325: #define APPDATAEMBED           0x26
                    326: #define UNUSED                         0xff
                    327: 
                    328: 
                    329:                                                                                /* Message attributes */
                    330: #define MSG_PRIVATE            (1<<0)
                    331: #define MSG_READ                       (1<<1)
                    332: #define MSG_PERMANENT          (1<<2)
                    333: #define MSG_LOCKED                     (1<<3)
                    334: #define MSG_DELETE                     (1<<4)
                    335: #define MSG_ANONYMOUS          (1<<5)
                    336: #define MSG_KILLREAD           (1<<6)
                    337: #define MSG_MODERATED          (1<<7)
                    338: #define MSG_VALIDATED          (1<<8)
                    339: #define MSG_REPLIED                    (1<<9)          /* User replied to this message */
1.1.1.2 ! root      340: #define MSG_NOREPLY                    (1<<10)         /* No replies (or bounces) should be sent to the sender */
1.1       root      341: 
                    342:                                                                                /* Auxillary header attributes */
                    343: #define MSG_FILEREQUEST        (1<<0)          /* File request */
                    344: #define MSG_FILEATTACH         (1<<1)          /* File(s) attached to Msg */
                    345: #define MSG_TRUNCFILE          (1<<2)          /* Truncate file(s) when sent */
                    346: #define MSG_KILLFILE           (1<<3)          /* Delete file(s) when sent */
                    347: #define MSG_RECEIPTREQ         (1<<4)          /* Return receipt requested */
                    348: #define MSG_CONFIRMREQ         (1<<5)          /* Confirmation receipt requested */
                    349: #define MSG_NODISP                     (1<<6)          /* Msg may not be displayed to user */
                    350: 
                    351:                                                                                /* Message network attributes */
                    352: #define MSG_LOCAL                      (1<<0)          /* Msg created locally */
                    353: #define MSG_INTRANSIT          (1<<1)          /* Msg is in-transit */
                    354: #define MSG_SENT                       (1<<2)          /* Sent to remote */
                    355: #define MSG_KILLSENT           (1<<3)          /* Kill when sent */
                    356: #define MSG_ARCHIVESENT        (1<<4)          /* Archive when sent */
                    357: #define MSG_HOLD                       (1<<5)          /* Hold for pick-up */
                    358: #define MSG_CRASH                      (1<<6)          /* Crash */
                    359: #define MSG_IMMEDIATE          (1<<7)          /* Send Msg now, ignore restrictions */
                    360: #define MSG_DIRECT                     (1<<8)          /* Send directly to destination */
                    361: #define MSG_GATE                       (1<<9)          /* Send via gateway */
                    362: #define MSG_ORPHAN                     (1<<10)         /* Unknown destination */
                    363: #define MSG_FPU                        (1<<11)         /* Force pickup */
                    364: #define MSG_TYPELOCAL          (1<<12)         /* Msg is for local use only */
                    365: #define MSG_TYPEECHO           (1<<13)         /* Msg is for conference distribution */
                    366: #define MSG_TYPENET            (1<<14)         /* Msg is direct network mail */
                    367: 
                    368: 
                    369: enum {
                    370:      NET_NONE                          /* Local message */
                    371:     ,NET_UNKNOWN                       /* Unknown network type */
                    372:     ,NET_FIDO                          /* FidoNet address, faddr_t format (4D) */
                    373:     ,NET_POSTLINK                      /* Imported with UTI driver */
                    374:     ,NET_QWK                           /* QWK networked messsage */
                    375:        ,NET_INTERNET                   /* Internet e-mail, netnews, etc. */
                    376:        ,NET_WWIV                               /* unused */
                    377:        ,NET_MHS                                /* unused */
                    378:        ,NET_FIDO_ASCII                 /* FidoNet address, ASCIIZ format (e.g. 5D) */
                    379: 
                    380: /* Add new ones here */
                    381: 
                    382:     ,NET_TYPES
                    383: };
                    384: 
                    385: enum {
                    386:      AGENT_PERSON
                    387:     ,AGENT_PROCESS                     /* unknown process type */
                    388:        ,AGENT_SMBUTIL                  /* imported via Synchronet SMBUTIL */
                    389:        ,AGENT_SMTPSYSMSG               /* Synchronet SMTP server system message */
                    390: 
                    391: /* Add new ones here */
                    392: 
                    393:     ,AGENT_TYPES
                    394: };
                    395: 
                    396: enum {
                    397:      XLAT_NONE              /* No translation/End of translation list */
                    398:     ,XLAT_ENCRYPT           /* Encrypted data */
                    399:     ,XLAT_ESCAPED           /* 7-bit ASCII escaping for ctrl and 8-bit data */
                    400:     ,XLAT_HUFFMAN           /* Static and adaptive Huffman coding compression */
                    401:     ,XLAT_LZW               /* Limpel/Ziv/Welch compression */
                    402:     ,XLAT_MLZ78             /* Modified LZ78 compression */
                    403:     ,XLAT_RLE               /* Run length encoding compression */
                    404:     ,XLAT_IMPLODE           /* Implode compression (PkZIP) */
                    405:     ,XLAT_SHRINK            /* Shrink compression (PkZIP) */
                    406:        ,XLAT_LZH                               /* LHarc (LHA) Dynamic Huffman coding */
                    407: 
                    408: /* Add new ones here */
                    409: 
                    410:     ,XLAT_TYPES
                    411: };
                    412: 
                    413: 
                    414: /************/
                    415: /* Typedefs */
                    416: /************/
                    417: 
                    418: #if defined(_WIN32) || defined(__BORLANDC__) 
                    419:        #define PRAGMA_PACK
                    420: #endif
                    421: 
                    422: #if defined(PRAGMA_PACK) || defined(__WATCOMC__)
                    423:        #define _PACK
                    424: #else
                    425:        #define _PACK __attribute__ ((packed))
                    426: #endif
                    427: 
                    428: #if defined(PRAGMA_PACK)
                    429:        #pragma pack(push,1)    /* Disk image structures must be packed */
                    430: #endif
                    431: 
                    432: typedef struct _PACK {         /* Time with time-zone */
                    433: 
1.1.1.2 ! root      434:        uint32_t        time;                   /* Local time (unix format) */
        !           435:        int16_t         zone;                   /* Time zone */
1.1       root      436: 
                    437: } when_t;
                    438: 
                    439: typedef struct _PACK {         /* Index record */
                    440: 
1.1.1.2 ! root      441:        uint16_t        to;                     /* 16-bit CRC of recipient name (lower case) */
        !           442:        uint16_t        from;                   /* 16-bit CRC of sender name (lower case) */
        !           443:        uint16_t        subj;                   /* 16-bit CRC of subject (lower case, w/o RE:) */
        !           444:        uint16_t        attr;                   /* attributes (read, permanent, etc.) */
        !           445:        uint32_t        offset;                 /* offset into header file */
        !           446:        uint32_t        number;                 /* number of message (1 based) */
        !           447:        uint32_t        time;                   /* time/date message was imported/posted */
1.1       root      448: 
                    449: } idxrec_t;
                    450: 
1.1.1.2 ! root      451:                                                                                /* valid bits in hash_t.flags           */
        !           452: #define SMB_HASH_CRC16                 (1<<0)  /* CRC-16 hash is valid                         */
        !           453: #define SMB_HASH_CRC32                 (1<<1)  /* CRC-32 hash is valid                         */
        !           454: #define SMB_HASH_MD5                   (1<<2)  /* MD5 digest is valid                          */
        !           455: #define SMB_HASH_MASK                  (SMB_HASH_CRC16|SMB_HASH_CRC32|SMB_HASH_MD5)
        !           456:                                                                
        !           457: #define SMB_HASH_MARKED                        (1<<4)  /* Used by smb_findhash()                       */
        !           458: 
        !           459: #define SMB_HASH_STRIP_CTRL_A  (1<<5)  /* Strip Ctrl-A codes first                     */
        !           460: #define SMB_HASH_STRIP_WSP             (1<<6)  /* Strip white-space chars first        */
        !           461: #define SMB_HASH_LOWERCASE             (1<<7)  /* Convert A-Z to a-z first                     */
        !           462: #define SMB_HASH_PROC_MASK             (SMB_HASH_STRIP_CTRL_A|SMB_HASH_STRIP_WSP|SMB_HASH_LOWERCASE)
        !           463: #define SMB_HASH_PROC_COMP_MASK        (SMB_HASH_STRIP_WSP|SMB_HASH_LOWERCASE)
1.1       root      464: 
                    465: enum {
                    466:         SMB_HASH_SOURCE_BODY
                    467:        ,SMB_HASH_SOURCE_MSG_ID
                    468:        ,SMB_HASH_SOURCE_FTN_ID
1.1.1.2 ! root      469:        ,SMB_HASH_SOURCE_SUBJECT
1.1       root      470: 
                    471: /* Add new ones here (max value of 31) */
                    472: 
                    473:     ,SMB_HASH_SOURCE_TYPES
                    474: };
                    475: 
                    476: #define SMB_HASH_SOURCE_MASK   0x1f
                    477: #define SMB_HASH_SOURCE_NONE   0
                    478: #define SMB_HASH_SOURCE_ALL            0xff
1.1.1.2 ! root      479:                                                                /* These are the hash sources stored/compared for duplicate message detection: */
        !           480: #define SMB_HASH_SOURCE_DUPE   ((1<<SMB_HASH_SOURCE_BODY)|(1<<SMB_HASH_SOURCE_MSG_ID)|(1<<SMB_HASH_SOURCE_FTN_ID))
        !           481:                                                                /* These are the hash sources stored/compared for SPAM message detection: */
        !           482: #define SMB_HASH_SOURCE_SPAM   ((1<<SMB_HASH_SOURCE_BODY)|(1<<SMB_HASH_SOURCE_SUBJECT))
1.1       root      483: 
                    484: typedef struct _PACK {
                    485: 
1.1.1.2 ! root      486:        uint32_t        number;                                 /* Message number */
        !           487:        uint32_t        time;                                   /* Local time of fingerprinting */
        !           488:        uint32_t        length;                                 /* Length (in bytes) of source */
        !           489:        uchar           source;                                 /* SMB_HASH_SOURCE* (in low 5-bits) */
        !           490:        uchar           flags;                                  /* indications of valid hashes and pre-processing */
        !           491:        uint16_t        crc16;                                  /* CRC-16 of source */
        !           492:        uint32_t        crc32;                                  /* CRC-32 of source */
        !           493:        uchar           md5[MD5_DIGEST_SIZE];   /* MD5 digest of source */
        !           494:        uchar           reserved[28];                   /* sizeof(hash_t) = 64 */
1.1       root      495: 
                    496: } hash_t;
                    497: 
                    498: typedef struct _PACK {         /* Message base header (fixed portion) */
                    499: 
1.1.1.2 ! root      500:     uchar              id[LEN_HEADER_ID];      /* SMB<^Z> */
        !           501:     uint16_t   version;        /* version number (initially 100h for 1.00) */
        !           502:     uint16_t   length;         /* length including this struct */
1.1       root      503: 
                    504: } smbhdr_t;
                    505: 
                    506: typedef struct _PACK {         /* Message base status header */
                    507: 
1.1.1.2 ! root      508:        uint32_t        last_msg;               /* last message number */
        !           509:        uint32_t        total_msgs;     /* total messages */
        !           510:        uint32_t        header_offset;  /* byte offset to first header record */
        !           511:        uint32_t        max_crcs;               /* Maximum number of CRCs to keep in history */
        !           512:     uint32_t   max_msgs;       /* Maximum number of message to keep in sub */
        !           513:     uint16_t   max_age;        /* Maximum age of message to keep in sub (in days) */
        !           514:        uint16_t        attr;                   /* Attributes for this message base (SMB_HYPER,etc) */
1.1       root      515: 
                    516: } smbstatus_t;
                    517: 
                    518: typedef struct _PACK {         /* Message header */
                    519: 
1.1.1.2 ! root      520:        /* 00 */ uchar          id[LEN_HEADER_ID];      /* SHD<^Z> */
        !           521:     /* 04 */ uint16_t  type;                           /* Message type (normally 0) */
        !           522:     /* 06 */ uint16_t  version;                        /* Version of type (initially 100h for 1.00) */
        !           523:     /* 08 */ uint16_t  length;                         /* Total length of fixed record + all fields */
        !           524:        /* 0a */ uint16_t       attr;                           /* Attributes (bit field) (duped in SID) */
        !           525:        /* 0c */ uint32_t       auxattr;                        /* Auxillary attributes (bit field) */
        !           526:     /* 10 */ uint32_t  netattr;                        /* Network attributes */
        !           527:        /* 14 */ when_t         when_written;           /* Date/time/zone message was written */
        !           528:        /* 1a */ when_t         when_imported;          /* Date/time/zone message was imported */
        !           529:     /* 20 */ uint32_t  number;                         /* Message number */
        !           530:     /* 24 */ uint32_t  thread_back;            /* Message number for backwards threading (aka thread_orig) */
        !           531:     /* 28 */ uint32_t  thread_next;            /* Next message in thread */
        !           532:     /* 2c */ uint32_t  thread_first;           /* First reply to this message */
        !           533:        /* 30 */ uint16_t       delivery_attempts;      /* Delivery attempt counter */
        !           534:        /* 32 */ uint32_t       times_downloaded;       /* Total number of times downloaded */
        !           535:        /* 36 */ uint32_t       last_downloaded;        /* Date/time of last download */
        !           536:        /* 3a */ uchar          reserved[6];            /* Reserved for future use */
        !           537:     /* 40 */ uint32_t  offset;                         /* Offset for buffer into data file (0 or mod 256) */
        !           538:        /* 44 */ uint16_t       total_dfields;          /* Total number of data fields */
1.1       root      539: 
                    540: } msghdr_t;
                    541: 
                    542: #define thread_orig    thread_back     /* for backwards compatibility with older code */
                    543: 
                    544: typedef struct _PACK {         /* Data field */
                    545: 
1.1.1.2 ! root      546:        uint16_t        type;                   /* Type of data field */
        !           547:     uint32_t   offset;         /* Offset into buffer */ 
        !           548:     uint32_t   length;         /* Length of data field */
1.1       root      549: 
                    550: } dfield_t;
                    551: 
                    552: typedef struct _PACK {         /* Header field */
                    553: 
1.1.1.2 ! root      554:        uint16_t        type;
        !           555:        uint16_t        length;                 /* Length of buffer */
1.1       root      556: 
                    557: } hfield_t;
                    558: 
                    559: typedef struct _PACK {         /* FidoNet address (zone:net/node.point) */
                    560: 
1.1.1.2 ! root      561:        uint16_t        zone;
        !           562:        uint16_t        net;
        !           563:        uint16_t        node;
        !           564:        uint16_t        point;
1.1       root      565: 
                    566: } fidoaddr_t;
                    567: 
                    568: #if defined(PRAGMA_PACK)
                    569: #pragma pack(pop)              /* original packing */
                    570: #endif
                    571: 
                    572: typedef struct {               /* Network (type and address) */
                    573: 
1.1.1.2 ! root      574:     uint16_t   type;
        !           575:        void*           addr;
1.1       root      576: 
                    577: } net_t;
                    578: 
                    579:                                                                /* Valid bits in smbmsg_t.flags                                 */
                    580: #define MSG_FLAG_HASHED        (1<<0)  /* Message has been hashed with smb_hashmsg()   */
                    581: 
                    582: typedef struct {                               /* Message */
                    583: 
                    584:        idxrec_t        idx;                    /* Index */
                    585:        msghdr_t        hdr;                    /* Header record (fixed portion) */
                    586:        char            *to,                    /* To name */
                    587:                                *to_ext,                /* To extension */
                    588:                                *from,                  /* From name */
                    589:                                *from_ext,              /* From extension */
                    590:                                *from_org,              /* From organization */
1.1.1.2 ! root      591:                                *from_ip,               /* From IP address (e.g. "192.168.1.2") */
        !           592:                                *from_host,             /* From host name */
        !           593:                                *from_prot,             /* From protocol (e.g. "Telnet", "NNTP", "HTTP", etc.) */
1.1       root      594:                                *replyto,               /* Reply-to name */
                    595:                                *replyto_ext,   /* Reply-to extension */
                    596:                                *id,                    /* RFC822 Message-ID */
                    597:                                *reply_id,              /* RFC822 Reply-ID */
                    598:                                *forward_path,  /* SMTP forward-path (RCPT TO: argument) */
                    599:                                *reverse_path,  /* SMTP reverse-path (MAIL FROM: argument) */
                    600:                                *path,                  /* USENET Path */
                    601:                                *newsgroups,    /* USENET Newsgroups */
                    602:                                *ftn_pid,               /* FTN PID */
                    603:                                *ftn_tid,               /* FTN TID */
                    604:                                *ftn_area,              /* FTN AREA */
                    605:                                *ftn_flags,             /* FTN FLAGS */
                    606:                                *ftn_msgid,             /* FTN MSGID */
                    607:                                *ftn_reply;             /* FTN REPLY */
                    608:        char*           summary;                /* Summary  */
                    609:        char*           subj;                   /* Subject  */
1.1.1.2 ! root      610:        uint16_t        to_agent,               /* Type of agent message is to */
1.1       root      611:                                from_agent,     /* Type of agent message is from */
                    612:                                replyto_agent;  /* Type of agent replies should be sent to */
                    613:        net_t           to_net,                 /* Destination network type and address */
                    614:                 from_net,       /* Origin network address */
                    615:                 replyto_net;    /* Network type and address for replies */
1.1.1.2 ! root      616:        uint16_t        total_hfields;  /* Total number of header fields */
1.1       root      617:        hfield_t        *hfield;                /* Header fields (fixed length portion) */
                    618:        void            **hfield_dat;   /* Header fields (variable length portion) */
                    619:        dfield_t        *dfield;                /* Data fields (fixed length portion) */
1.1.1.2 ! root      620:        int32_t         offset;                 /* Offset (number of records) into index */
        !           621:        BOOL            forwarded;              /* Forwarded from agent to another */
        !           622:        uint32_t        expiration;     /* Message will expire on this day (if >0) */
        !           623:        uint32_t        priority;               /* Message priority (0 is lowest) */
        !           624:        uint32_t        cost;                   /* Cost to download/read */
        !           625:        uint32_t        flags;                  /* Various smblib run-time flags (see MSG_FLAG_*) */
1.1       root      626: 
                    627: } smbmsg_t;
                    628: 
                    629: typedef struct {                       /* Message base */
                    630: 
1.1.1.2 ! root      631:     char               file[128];      /* Path and base filename (no extension) */
        !           632:     FILE*              sdt_fp;                 /* File pointer for data (.sdt) file */
        !           633:     FILE*              shd_fp;                 /* File pointer for header (.shd) file */
        !           634:     FILE*              sid_fp;                 /* File pointer for index (.sid) file */
        !           635:     FILE*              sda_fp;                 /* File pointer for data allocation (.sda) file */
        !           636:     FILE*              sha_fp;                 /* File pointer for header allocation (.sha) file */
        !           637:        FILE*           hash_fp;                /* File pointer for hash (.hash) file */
        !           638:        uint32_t        retry_time;     /* Maximum number of seconds to retry opens/locks */
        !           639:        uint32_t        retry_delay;    /* Time-slice yield (milliseconds) while retrying */
1.1       root      640:        smbstatus_t status;     /* Status header record */
1.1.1.2 ! root      641:        BOOL            locked;                 /* SMB header is locked */
        !           642:        char            last_error[MAX_PATH*2];         /* Last error message */
1.1       root      643: 
                    644:        /* Private member variables (not initialized by or used by smblib) */
1.1.1.2 ! root      645:        uint32_t        subnum;                 /* Sub-board number */
        !           646:        int32_t         msgs;                   /* Number of messages loaded (for user) */
        !           647:        int32_t         curmsg;                 /* Current message number (for user) */
1.1       root      648: 
                    649: } smb_t;
                    650: 
                    651: #endif /* Don't add anything after this #endif statement */

unix.superglobalmegacorp.com

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