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