Annotation of sbbs/sbbs2/fido/smbdefs.h, revision 1.1.1.1

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