Annotation of sbbs/sbbs2/smb/smbdefs.h, revision 1.1

1.1     ! root        1: /* SMBDEFS.H */
        !             2: 
        !             3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
        !             4: 
        !             5: #ifndef _SMBDEFS_H
        !             6: #define _SMBDEFS_H
        !             7: 
        !             8: #include <stdio.h>
        !             9: 
        !            10: /**********/
        !            11: /* Macros */
        !            12: /**********/
        !            13: 
        !            14: #define SMB_VERSION            0x0121          /* SMB format version */
        !            15:                                                                                /* High byte major, low byte minor */
        !            16: #define SMBLIB_VERSION         "2.01"      /* SMB library version */
        !            17: 
        !            18:                                                                                /* Control characters */
        !            19: #define TAB                            0x09            /* Horizontal tabulation        ^I */
        !            20: #define LF                                     0x0a            /* Line feed                            ^J */
        !            21: #define FF                                     0x0c            /* Form feed                            ^L */
        !            22: #define CR                                     0x0d            /* Carriage return                      ^M */
        !            23: #define ESC                            0x1b            /* Escape                                       ^[ */
        !            24: #define SP                                     0x20            /* Space                                           */
        !            25: 
        !            26: #define ulong                          unsigned long
        !            27: #define ushort                         unsigned short
        !            28: #define uchar                          unsigned char
        !            29: #define uint                           unsigned int
        !            30: 
        !            31: /****************************************************************************/
        !            32: /* Memory allocation macros for various compilers and environments                     */
        !            33: /* MALLOC is used for allocations of 64k or less                                                       */
        !            34: /* FREE is used to free buffers allocated with MALLOC                                          */
        !            35: /* LMALLOC is used for allocations of possibly larger than 64k                         */
        !            36: /* LFREE is used to free buffers allocated with LMALLOC                                        */
        !            37: /* REALLOC is used to re-size a previously MALLOCed or LMALLOCed buffer        */
        !            38: /****************************************************************************/
        !            39: #if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
        !            40: #      define HUGE16 huge
        !            41: #      define FAR16 far
        !            42: #      if defined(__TURBOC__)
        !            43: #              define REALLOC(x,y) farrealloc(x,y)
        !            44: #              define LMALLOC(x) farmalloc(x)
        !            45: #              define MALLOC(x) farmalloc(x)
        !            46: #              define LFREE(x) farfree(x)
        !            47: #              define FREE(x) farfree(x)
        !            48: #      elif defined(__WATCOMC__)
        !            49: #              define REALLOC realloc
        !            50: #              define LMALLOC(x) halloc(x,1)  /* far heap, but slow */
        !            51: #              define MALLOC malloc               /* far heap, but 64k max */
        !            52: #              define LFREE hfree
        !            53: #              define FREE free
        !            54: #      else    /* Other 16-bit Compiler */
        !            55: #              define REALLOC realloc
        !            56: #              define LMALLOC malloc
        !            57: #              define MALLOC malloc
        !            58: #              define LFREE free
        !            59: #              define FREE free
        !            60: #      endif
        !            61: #else          /* 32-bit Compiler or Small Memory Model */
        !            62: #      define HUGE16
        !            63: #      define FAR16
        !            64: #      define REALLOC realloc
        !            65: #      define LMALLOC malloc
        !            66: #      define MALLOC malloc
        !            67: #      define LFREE free
        !            68: #      define FREE free
        !            69: #endif
        !            70: 
        !            71: 
        !            72: #define SDT_BLOCK_LEN          256             /* Size of data blocks */
        !            73: #define SHD_BLOCK_LEN          256             /* Size of header blocks */
        !            74: 
        !            75: #define SMB_SELFPACK           0                       /* Self-packing storage allocation */
        !            76: #define SMB_FASTALLOC          1                       /* Fast allocation */
        !            77: #define SMB_HYPERALLOC         2                       /* No allocation */
        !            78: 
        !            79: #define SMB_EMAIL                      1                       /* User numbers stored in Indexes */
        !            80: 
        !            81:                                                                                /* Time zone macros for when_t.zone */
        !            82: #define DAYLIGHT                       0x8000          /* Daylight savings is active */
        !            83: #define US_ZONE                        0x4000          /* U.S. time zone */
        !            84: #define WESTERN_ZONE           0x2000          /* Non-standard zone west of UT */
        !            85: #define EASTERN_ZONE           0x1000          /* Non-standard zone east of UT */
        !            86: 
        !            87:                                                                                /* US Time Zones (standard) */
        !            88: #define AST                            0x40F0          // Atlantic                     (-04:00)
        !            89: #define EST                            0x412C          // Eastern                              (-05:00)
        !            90: #define CST                            0x4168          // Central                              (-06:00)
        !            91: #define MST                            0x41A4          // Mountain                     (-07:00)
        !            92: #define PST                            0x41E0          // Pacific                              (-08:00)
        !            93: #define YST                            0x421C          // Yukon                                (-09:00)
        !            94: #define HST                            0x4258          // Hawaii/Alaska                (-10:00)
        !            95: #define BST                            0x4294          // Bering                               (-11:00)
        !            96: 
        !            97:                                                                                /* US Time Zones (daylight) */
        !            98: #define ADT                            0xC0F0          // Atlantic                     (-03:00)
        !            99: #define EDT                            0xC12C          // Eastern                              (-04:00)
        !           100: #define CDT                            0xC168          // Central                              (-05:00)
        !           101: #define MDT                            0xC1A4          // Mountain                     (-06:00)
        !           102: #define PDT                            0xC1E0          // Pacific                              (-07:00)
        !           103: #define YDT                            0xC21C          // Yukon                                (-08:00)
        !           104: #define HDT                            0xC258          // Hawaii/Alaska                (-09:00)
        !           105: #define BDT                            0xC294          // Bering                               (-10:00)
        !           106: 
        !           107:                                                                                /* Non-standard Time Zones */
        !           108: #define MID                            0x2294          // Midway                               (-11:00)
        !           109: #define VAN                            0x21E0          // Vancouver                    (-08:00)
        !           110: #define EDM                            0x21A4          // Edmonton                     (-07:00)
        !           111: #define WIN                            0x2168          // Winnipeg                     (-06:00)
        !           112: #define BOG                            0x212C          // Bogota                               (-05:00)
        !           113: #define CAR                            0x20F0          // Caracas                              (-04:00)
        !           114: #define RIO                            0x20B4          // Rio de Janeiro               (-03:00)
        !           115: #define FER                            0x2078          // Fernando de Noronha  (-02:00)
        !           116: #define AZO                            0x203C          // Azores                               (-01:00)
        !           117: #define LON                            0x1000          // London                               (+00:00)
        !           118: #define BER                            0x103C          // Berlin                               (+01:00)
        !           119: #define ATH                            0x1078          // Athens                               (+02:00)
        !           120: #define MOS                            0x10B4          // Moscow                               (+03:00)
        !           121: #define DUB                            0x10F0          // Dubai                                (+04:00)
        !           122: #define KAB                            0x110E          // Kabul                                (+04:30)
        !           123: #define KAR                            0x112C          // Karachi                              (+05:00)
        !           124: #define BOM                            0x114A          // Bombay                               (+05:30)
        !           125: #define KAT                            0x1159          // Kathmandu                    (+05:45)
        !           126: #define DHA                            0x1168          // Dhaka                                (+06:00)
        !           127: #define BAN                            0x11A4          // Bangkok                              (+07:00)
        !           128: #define HON                            0x11E0          // Hong Kong                    (+08:00)
        !           129: #define TOK                            0x121C          // Tokyo                                (+09:00)
        !           130: #define SYD                            0x1258          // Sydney                               (+10:00)
        !           131: #define NOU                            0x1294          // Noumea                               (+11:00)
        !           132: #define WEL                            0x12D0          // Wellington                   (+12:00)
        !           133: 
        !           134:                                                                                /* Valid hfield_t.types */
        !           135: #define SENDER                         0x00
        !           136: #define SENDERAGENT            0x01
        !           137: #define SENDERNETTYPE          0x02
        !           138: #define SENDERNETADDR          0x03
        !           139: #define SENDEREXT                      0x04
        !           140: #define SENDERPOS                      0x05
        !           141: #define SENDERORG                      0x06
        !           142: 
        !           143: #define AUTHOR                         0x10
        !           144: #define AUTHORAGENT            0x11
        !           145: #define AUTHORNETTYPE          0x12
        !           146: #define AUTHORNETADDR          0x13
        !           147: #define AUTHOREXT                      0x14
        !           148: #define AUTHORPOS                      0x15
        !           149: #define AUTHORORG                      0x16
        !           150: 
        !           151: #define REPLYTO                        0x20
        !           152: #define REPLYTOAGENT           0x21
        !           153: #define REPLYTONETTYPE         0x22
        !           154: #define REPLYTONETADDR         0x23
        !           155: #define REPLYTOEXT                     0x24
        !           156: #define REPLYTOPOS                     0x25
        !           157: #define REPLYTOORG                     0x26
        !           158: 
        !           159: #define RECIPIENT                      0x30
        !           160: #define RECIPIENTAGENT         0x31
        !           161: #define RECIPIENTNETTYPE       0x32
        !           162: #define RECIPIENTNETADDR       0x33
        !           163: #define RECIPIENTEXT           0x34
        !           164: #define RECIPIENTPOS           0x35
        !           165: #define RECIPIENTORG           0x36
        !           166: 
        !           167: #define FORWARDTO                      0x40
        !           168: #define FORWARDTOAGENT         0x41
        !           169: #define FORWARDTONETTYPE       0x42
        !           170: #define FORWARDTONETADDR       0x43
        !           171: #define FORWARDTOEXT           0x44
        !           172: #define FORWARDTOPOS           0x45
        !           173: #define FORWARDTOORG           0x46
        !           174: 
        !           175: #define FORWARDED                      0x48
        !           176: 
        !           177: #define RECEIVEDBY                     0x50
        !           178: #define RECEIVEDBYAGENT        0x51
        !           179: #define RECEIVEDBYNETTYPE      0x52
        !           180: #define RECEIVEDBYNETADDR      0x53
        !           181: #define RECEIVEDBYEXT          0x54
        !           182: #define RECEIVEDBYPOS          0x55
        !           183: #define RECEIVEDBYORG          0x56
        !           184: 
        !           185: #define RECEIVED                       0x58
        !           186: 
        !           187: #define SUBJECT                        0x60
        !           188: #define SUMMARY                        0x61
        !           189: #ifndef COMMENT
        !           190: #define COMMENT                        0x62
        !           191: #endif
        !           192: #define CARBONCOPY                     0x63
        !           193: #define GROUP                          0x64
        !           194: #define EXPIRATION                     0x65
        !           195: #define PRIORITY                       0x66
        !           196: 
        !           197: #define FILEATTACH                     0x70
        !           198: #define DESTFILE                       0x71
        !           199: #define FILEATTACHLIST         0x72
        !           200: #define DESTFILELIST           0x73
        !           201: #define FILEREQUEST            0x74
        !           202: #define FILEPASSWORD           0x75
        !           203: #define FILEREQUESTLIST        0x76
        !           204: #define FILEPASSWORDLIST       0x77
        !           205: 
        !           206: #define IMAGEATTACH            0x80
        !           207: #define ANIMATTACH                     0x81
        !           208: #define FONTATTACH                     0x82
        !           209: #define SOUNDATTACH            0x83
        !           210: #define PRESENTATTACH          0x84
        !           211: #define VIDEOATTACH            0x85
        !           212: #define APPDATAATTACH          0x86
        !           213: 
        !           214: #define IMAGETRIGGER           0x90
        !           215: #define ANIMTRIGGER            0x91
        !           216: #define FONTTRIGGER            0x92
        !           217: #define SOUNDTRIGGER           0x93
        !           218: #define PRESENTTRIGGER         0x94
        !           219: #define VIDEOTRIGGER           0x95
        !           220: #define APPDATATRIGGER         0x96
        !           221: 
        !           222: #define FIDOCTRL                       0xa0
        !           223: #define FIDOAREA                       0xa1
        !           224: #define FIDOSEENBY                     0xa2
        !           225: #define FIDOPATH                       0xa3
        !           226: #define FIDOMSGID                      0xa4
        !           227: #define FIDOREPLYID            0xa5
        !           228: #define FIDOPID                        0xa6
        !           229: #define FIDOFLAGS                      0xa7
        !           230: 
        !           231: #define RFC822HEADER           0xb0
        !           232: #define RFC822MSGID            0xb1
        !           233: #define RFC822REPLYID          0xb2
        !           234: 
        !           235: #define UNKNOWN                        0xf1
        !           236: #define UNKNOWNASCII           0xf2
        !           237: #define UNUSED                         0xff
        !           238: 
        !           239:                                                                                /* Valid dfield_t.types */
        !           240: #define TEXT_BODY                      0x00
        !           241: #define TEXT_SOUL                      0x01
        !           242: #define TEXT_TAIL                      0x02
        !           243: #define TEXT_WING                      0x03
        !           244: #define IMAGEEMBED                     0x20
        !           245: #define ANIMEMBED                      0x21
        !           246: #define FONTEMBED                      0x22
        !           247: #define SOUNDEMBED                     0x23
        !           248: #define PRESENTEMBED           0x24
        !           249: #define VIDEOEMBED                     0x25
        !           250: #define APPDATAEMBED           0x26
        !           251: #define UNUSED                         0xff
        !           252: 
        !           253: 
        !           254:                                                                                /* Message attributes */
        !           255: #define MSG_PRIVATE            (1<<0)
        !           256: #define MSG_READ                       (1<<1)
        !           257: #define MSG_PERMANENT          (1<<2)
        !           258: #define MSG_LOCKED                     (1<<3)
        !           259: #define MSG_DELETE                     (1<<4)
        !           260: #define MSG_ANONYMOUS          (1<<5)
        !           261: #define MSG_KILLREAD           (1<<6)
        !           262: #define MSG_MODERATED          (1<<7)
        !           263: #define MSG_VALIDATED          (1<<8)
        !           264: 
        !           265:                                                                                /* Auxillary header attributes */
        !           266: #define MSG_FILEREQUEST        (1<<0)          // File request
        !           267: #define MSG_FILEATTACH         (1<<1)          // File(s) attached to Msg
        !           268: #define MSG_TRUNCFILE          (1<<2)          // Truncate file(s) when sent
        !           269: #define MSG_KILLFILE           (1<<3)          // Delete file(s) when sent
        !           270: #define MSG_RECEIPTREQ         (1<<4)          // Return receipt requested
        !           271: #define MSG_CONFIRMREQ         (1<<5)          // Confirmation receipt requested
        !           272: #define MSG_NODISP                     (1<<6)          // Msg may not be displayed to user
        !           273: 
        !           274:                                                                                /* Message network attributes */
        !           275: #define MSG_LOCAL                      (1<<0)          // Msg created locally
        !           276: #define MSG_INTRANSIT          (1<<1)          // Msg is in-transit
        !           277: #define MSG_SENT                       (1<<2)          // Sent to remote
        !           278: #define MSG_KILLSENT           (1<<3)          // Kill when sent
        !           279: #define MSG_ARCHIVESENT        (1<<4)          // Archive when sent
        !           280: #define MSG_HOLD                       (1<<5)          // Hold for pick-up
        !           281: #define MSG_CRASH                      (1<<6)          // Crash
        !           282: #define MSG_IMMEDIATE          (1<<7)          // Send Msg now, ignore restrictions
        !           283: #define MSG_DIRECT                     (1<<8)          // Send directly to destination
        !           284: #define MSG_GATE                       (1<<9)          // Send via gateway
        !           285: #define MSG_ORPHAN                     (1<<10)         // Unknown destination
        !           286: #define MSG_FPU                        (1<<11)         // Force pickup
        !           287: #define MSG_TYPELOCAL          (1<<12)         // Msg is for local use only
        !           288: #define MSG_TYPEECHO           (1<<13)         // Msg is for conference distribution
        !           289: #define MSG_TYPENET            (1<<14)         // Msg is direct network mail
        !           290: 
        !           291: 
        !           292: enum {
        !           293:      NET_NONE
        !           294:     ,NET_UNKNOWN
        !           295:     ,NET_FIDO
        !           296:     ,NET_POSTLINK
        !           297:     ,NET_QWK
        !           298:        ,NET_INTERNET
        !           299:        ,NET_WWIV
        !           300:        ,NET_MHS
        !           301: 
        !           302: /* Add new ones here */
        !           303: 
        !           304:     ,NET_TYPES
        !           305:     };
        !           306: 
        !           307: enum {
        !           308:      AGENT_PERSON
        !           309:     ,AGENT_PROCESS
        !           310: 
        !           311: /* Add new ones here */
        !           312: 
        !           313:     ,AGENT_TYPES
        !           314:     };
        !           315: 
        !           316: enum {
        !           317:      XLAT_NONE              // No translation/End of translation list
        !           318:     ,XLAT_ENCRYPT           // Encrypted data
        !           319:     ,XLAT_ESCAPED           // 7-bit ASCII escaping for ctrl and 8-bit data
        !           320:     ,XLAT_HUFFMAN           // Static and adaptive Huffman coding compression
        !           321:     ,XLAT_LZW               // Limpel/Ziv/Welch compression
        !           322:     ,XLAT_MLZ78             // Modified LZ78 compression
        !           323:     ,XLAT_RLE               // Run length encoding compression
        !           324:     ,XLAT_IMPLODE           // Implode compression (PkZIP)
        !           325:     ,XLAT_SHRINK            // Shrink compression (PkZIP)
        !           326:        ,XLAT_LZH                               // LHarc (LHA) Dynamic Huffman coding
        !           327: 
        !           328: /* Add new ones here */
        !           329: 
        !           330:     ,XLAT_TYPES
        !           331:     };
        !           332: 
        !           333: 
        !           334: /************/
        !           335: /* Typedefs */
        !           336: /************/
        !           337: 
        !           338: typedef struct {                       // Time with time-zone
        !           339: 
        !           340:        ulong   time;                   // Local time (unix format)
        !           341:        short   zone;                   // Time zone
        !           342: 
        !           343:        } when_t;
        !           344: 
        !           345: typedef struct {                       // Index record
        !           346: 
        !           347:        ushort  to;                     // 16-bit CRC of recipient name (lower case)
        !           348:        ushort  from;                   // 16-bit CRC of sender name (lower case)
        !           349:        ushort  subj;                   // 16-bit CRC of subject (lower case, w/o RE:)
        !           350:        ushort  attr;                   // attributes (read, permanent, etc.)
        !           351:        ulong   offset;                 // offset into header file
        !           352:        ulong   number;                 // number of message (1 based)
        !           353:        ulong   time;                   // time/date message was imported/posted
        !           354: 
        !           355:        } idxrec_t;
        !           356: 
        !           357: typedef struct {                       // Message base header (fixed portion)
        !           358: 
        !           359:     uchar   id[4];          // text or binary unique hdr ID
        !           360:     ushort  version;        // version number (initially 100h for 1.00)
        !           361:     ushort  length;         // length including this struct
        !           362: 
        !           363:        } smbhdr_t;
        !           364: 
        !           365: typedef struct {                       // Message base status header
        !           366: 
        !           367:        ulong   last_msg;               // last message number
        !           368:        ulong   total_msgs;     // total messages
        !           369:        ulong   header_offset;  // byte offset to first header record
        !           370:        ulong   max_crcs;               // Maximum number of CRCs to keep in history
        !           371:     ulong   max_msgs;       // Maximum number of message to keep in sub
        !           372:     ushort  max_age;        // Maximum age of message to keep in sub (in days)
        !           373:        ushort  attr;                   // Attributes for this message base (SMB_HYPER,etc)
        !           374: 
        !           375:        } smbstatus_t;
        !           376: 
        !           377: typedef struct {                       // Message header
        !           378: 
        !           379:        uchar   id[4];                  // SHD<^Z>
        !           380:     ushort  type;           // Message type (normally 0)
        !           381:     ushort  version;        // Version of type (initially 100h for 1.00)
        !           382:     ushort  length;         // Total length of fixed record + all fields
        !           383:        ushort  attr;                   // Attributes (bit field) (duped in SID)
        !           384:        ulong   auxattr;                // Auxillary attributes (bit field)
        !           385:     ulong   netattr;        // Network attributes
        !           386:        when_t  when_written;   // Time message was written (unix format)
        !           387:        when_t  when_imported;  // Time message was imported
        !           388:     ulong   number;         // Message number
        !           389:     ulong   thread_orig;    // Original message number in thread
        !           390:     ulong   thread_next;    // Next message in thread
        !           391:     ulong   thread_first;   // First reply to this message
        !           392:        uchar   reserved[16];   // Reserved for future use
        !           393:     ulong   offset;         // Offset for buffer into data file (0 or mod 256)
        !           394:        ushort  total_dfields;  // Total number of data fields
        !           395: 
        !           396:        } msghdr_t;
        !           397: 
        !           398: typedef struct {                       // Data field
        !           399: 
        !           400:        ushort  type;                   // Type of data field
        !           401:     ulong   offset;         // Offset into buffer 
        !           402:     ulong   length;         // Length of data field
        !           403: 
        !           404:     } dfield_t;
        !           405: 
        !           406: typedef struct {                       // Header field
        !           407: 
        !           408:        ushort  type;
        !           409:        ushort  length;                 // Length of buffer
        !           410: 
        !           411:        } hfield_t;
        !           412: 
        !           413: typedef struct {                       // FidoNet address (zone:net/node.point)
        !           414: 
        !           415:        ushort  zone;
        !           416:        ushort  net;
        !           417:        ushort  node;
        !           418:        ushort  point;
        !           419: 
        !           420:     } fidoaddr_t;
        !           421: 
        !           422: typedef struct {                       // Network (type and address)
        !           423: 
        !           424:     ushort  type;
        !           425:        void    *addr;
        !           426: 
        !           427:        } net_t;
        !           428: 
        !           429: typedef struct {                               // Message
        !           430: 
        !           431:        idxrec_t        idx;                    // Index
        !           432:        msghdr_t        hdr;                    // Header record (fixed portion)
        !           433:        uchar           *to,                    // To name
        !           434:                                *to_ext,                // To extension
        !           435:                                *from,                  // From name
        !           436:                                *from_ext,              // From extension
        !           437:                                *replyto,               // Reply-to name
        !           438:                                *replyto_ext,   // Reply-to extension */
        !           439:                                *subj;                  // Subject
        !           440:        ushort          to_agent,               // Type of agent message is to
        !           441:                                from_agent,     // Type of agent message is from
        !           442:                                replyto_agent;  // Type of agent replies should be sent to
        !           443:        net_t           to_net,                 // Destination network type and address
        !           444:                 from_net,       // Origin network address
        !           445:                 replyto_net;    // Network type and address for replies
        !           446:        ushort          total_hfields;  // Total number of header fields
        !           447:        hfield_t        *hfield;                // Header fields (fixed length portion)
        !           448:        void            **hfield_dat;   // Header fields (variable length portion)
        !           449:        dfield_t        *dfield;                // Data fields (fixed length portion)
        !           450:        ulong           offset;                 // Offset (number of records) into index
        !           451:        uchar           forwarded;              // Forwarded from agent to another
        !           452:        when_t          expiration;     // Message will exipre on this day (if >0)
        !           453: 
        !           454:        } smbmsg_t;
        !           455: 
        !           456: typedef struct {                       // Message base
        !           457: 
        !           458:     char    file[128];      // Path and base filename (no extension)
        !           459:     FILE    *sdt_fp;        // File pointer for data (.sdt) file
        !           460:     FILE    *shd_fp;        // File pointer for header (.shd) file
        !           461:     FILE    *sid_fp;        // File pointer for index (.sid) file
        !           462:     FILE    *sda_fp;        // File pointer for data allocation (.sda) file
        !           463:     FILE    *sha_fp;        // File pointer for header allocation (.sha) file
        !           464:        long    retry_time;     // Maximum number of seconds to retry opens/locks
        !           465:        smbstatus_t status;     // Status header record
        !           466:        char    shd_buf[SHD_BLOCK_LEN];         // File I/O buffer for header file
        !           467: 
        !           468:     } smb_t;
        !           469: 
        !           470: 
        !           471: #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.