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

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