home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / usms1.exe / SIDF.H < prev    next >
Text File  |  1994-06-01  |  5KB  |  127 lines

  1. /*    
  2. ****************************************************************************
  3. *
  4. * Program Name:  Storage Management Services (NWSMS Lib)
  5. *
  6. * Filename:      SIDF.H
  7. *
  8. * Date Created:  15 SEPTEMBER 1993
  9. *
  10. * Version:       5.0
  11. *
  12. * Files used:    
  13. *
  14. * Date Modified: 
  15. *
  16. * Modifications: 
  17. *
  18. * Comments:      Header file defining types, macros and constants for
  19. *                manipulating SIDF-compliant data fields                   
  20. *
  21. * (C) Unpublished Copyright of Novell, Inc.  All Rights Reserved.
  22. *
  23. * No part of this file may be duplicated, revised, translated, localized or
  24. * modified in any manner or compiled, linked or uploaded or downloaded to or
  25. * from any computer system without the prior written consent of Novell, Inc.
  26. *
  27. ****************************************************************************
  28. */
  29.  
  30. #ifndef _SIDF_H_INCLUDED          /* sidf.h header Latch */
  31. #define _SIDF_H_INCLUDED
  32.  
  33.  
  34. #define SIDF_SYNC_DATA                 0x5AA5
  35. #define SIDF_FIELD_HEADER_SIZE         14
  36. #define SIDF_INVALID_OFFSET            0xFFFFFFFF
  37. #define SIDFSTREAM_CSTR_FAILURE(c)     {dstrSIDFStream(c); return(NULL);}
  38.  
  39. #define SIDF_MIN_BLANK_SECTION_SIZE    32
  40.  
  41. /*  ---------------------------------------------------------------------  */
  42. /* | (SIDFField) types and constants                                     | */
  43. /*  ---------------------------------------------------------------------  */
  44. typedef struct                         /* SIDFField type definition */
  45. {
  46.     UINT32      fid;
  47.     UINT32      size;
  48.     UINT32      control;
  49.     void       *data;
  50. } SIDFField;
  51.  
  52. #define FIELD_CTL_NULL_FID             0x00000000
  53. #define FIELD_CTL_FORMAT1              0x00000100
  54. #define FIELD_CTL_FORMAT2              0x00000200
  55. #define FIELD_CTL_FORMAT3              0x00000400
  56. #define FIELD_CTL_VARIABLE_SIZE        0x00000800
  57. #define FIELD_CTL_DATA_IS_HUGE         0x00001000
  58. #define FIELD_CTL_SECTION_BEGIN        0x00002000
  59. #define FIELD_CTL_SECTION_END          0x00004000
  60. #define FIELD_CTL_CALCULATE_CRC        0x00008000
  61. #define FIELD_CTL_WAS_FOUND            0x00010000
  62. #define FIELD_CTL_DATA_IS_UINT16       0x00000001
  63. #define FIELD_CTL_DATA_IS_UINT32       0x00000002
  64. #define FIELD_CTL_DATA_IS_UINT64       0x00000003
  65. #define FIELD_CTL_DATA_IS_STRING       0x00000004
  66. #define FIELD_CTL_DATA_IS_STREAM       0x00000005
  67. #define FIELD_CTL_DATA_IS_TIMESTAMP    0x00000006
  68.  
  69. #define FIELD_CTL_DATATYPE_MASK        0x000000FF
  70. #define FIELD_CTL_SIZE_FORMATS         0x00000F00
  71. #define FIELD_CTL_FORMAT_HEADER        (FIELD_CTL_FORMAT1 | \
  72.                                         FIELD_CTL_SECTION_BEGIN)
  73. #define FIELD_CTL_WRITE_UINT32         (FIELD_CTL_FORMAT1 | \
  74.                                         FIELD_CTL_DATA_IS_UINT32)
  75. #define FIELD_CTL_SMALL_STRING         (FIELD_CTL_FORMAT1 | \
  76.                                         FIELD_CTL_DATA_IS_STRING)
  77.  
  78. /*  ---------------------------------------------------------------------  */
  79. /* | (SIDFField) macros                                                  | */
  80. /*  ---------------------------------------------------------------------  */
  81. #define SIDF_FieldType(c)         ((c) & FIELD_CTL_DATATYPE_MASK)
  82. #define SIDF_ClearFieldType(c)    ((c) &= ~FIELD_CTL_DATATYPE_MASK)
  83. #define SIDF_ResetFieldType(c,t)  ((c)=((c) & ~FIELD_CTL_DATATYPE_MASK)|t)
  84.  
  85. #define UINT32SigBytes(n)         (((n) & 0xFF000000) ? 4 :\
  86.                                    ((n) & 0x00FF0000) ? 3 :\
  87.                                    ((n) & 0x0000FF00) ? 2 : 1)
  88.  
  89. #define SIDF_SizeOfFID(f)         UINT32SigBytes(f)
  90.  
  91. #define SIDF_SizeOfUINT32(n)      (((n) & 0xFFFF0000) ? 4 : \
  92.                                    ((n) & 0x0000FF00) ? 2 : 1)
  93.  
  94. #define IsFixedLong(f)            (((f) & 0xFFFF0000)        &&             \
  95.                                    (((f) & 0xF000) == 0xF000))
  96. #define IsFixedShort(f)           ((((f) & 0xFF000000) == 0) &&             \
  97.                                    (((f) & 0xC0) == 0x40))
  98. #define LongFixedSz(f)            (1 << (((f)&0x700) >> 8))
  99. #define ShortFixedSz(f)           (1 << ((f)&0x07))
  100.  
  101. #define SIDF_GetFixedSize(f)      (IsFixedLong(f) ? LongFixedSz(f) :        \
  102.                                    IsFixedShort(f) ? ShortFixedSz(f) : 0)
  103. /*
  104. #define SIDF_IsFixedSize(f)       ((f&0xFF000000) ? ((f&0xF000) == 0xF000) :\
  105.                                    (!(f&0xFF0000)) ? (f & 0x40)            :\
  106.                                    (f & 0x400000)  ? (f & 0x40)            :\
  107.                                    ((f & 0xF000) == 0xF000))
  108.  
  109. #define SIDF_GetFixedSize(f)      ((!(f&0xFFFF0000) || (!(f&0xFF000000) && \
  110.                                    (f&0x400000))) ? (1 << (f&0x07))      : \
  111.                                    (1 << ((f&0x700) >> 8)))
  112. */
  113.  
  114. #define SIDF_OffsetToEndSize(c)   ((c & FIELD_CTL_DATA_IS_UINT32)? 4 :\
  115.                                    (c & FIELD_CTL_DATA_IS_UINT64)? 8 : 2)
  116.  
  117. #define SIDF_SizeFormat1(s)       ((s) & 0x7F)
  118.  
  119. #define SIDF_SizeFormat2(s)       (((s) & 0xFFFF0000) ? 0x82 : \
  120.                                    ((s) & 0x0000FF00) ? 0x81 : 0x80)
  121.  
  122. #define SIDF_SizeFormat3(d)       ((*(BYTE *) (d) | 0xC0))
  123.  
  124.  
  125. #endif                                /* Header Latch */
  126. /***************************************************************************/
  127.