Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

307 lines
10 KiB

  1. /*++
  2. Copyright (c) 1993-1995, Microsoft Corp. All rights reserved.
  3. Module Name:
  4. nw\inc\ncmcomm.h
  5. Abstract:
  6. This module contains common constants and types for the NCP server.
  7. Author:
  8. Shawn Walker (vswalk) 06-17-1993
  9. Andy Herron (andyhe)
  10. Revision History:
  11. --*/
  12. #ifndef _NCPCOMM_
  13. #define _NCPCOMM_
  14. //
  15. // signature for pserver
  16. //
  17. #define NCP_PSERVER_SIGNATURE L"PS_"
  18. //
  19. // well known object IDs
  20. //
  21. #define NCP_WELL_KNOWN_SUPERVISOR_ID (ULONG) 0x00000001
  22. #define NCP_WELL_KNOWN_SUPERVISOR_ID_SWAPPED (ULONG) 0x01000000
  23. #define NCP_WELL_KNOWN_SUPERVISOR_ID_CHICAGO (ULONG) 0x00010000
  24. #define NCP_WELL_KNOWN_PSERVER_ID (ULONG) 0x00000002
  25. //
  26. // misc macros that are useful
  27. //
  28. #define SWAPWORD(w) ((WORD)((w & 0xFF) << 8)|(WORD)(w >> 8))
  29. #define SWAPLONG(l) MAKELONG(SWAPWORD(HIWORD(l)),SWAPWORD(LOWORD(l)))
  30. #define SWAP_OBJECT_ID(id) (id == NCP_WELL_KNOWN_SUPERVISOR_ID) ? \
  31. NCP_WELL_KNOWN_SUPERVISOR_ID_SWAPPED : \
  32. MAKELONG(LOWORD(id),SWAPWORD(HIWORD(id)))
  33. #define UNSWAP_OBJECT_ID(id) (id == NCP_WELL_KNOWN_SUPERVISOR_ID_SWAPPED || id == NCP_WELL_KNOWN_SUPERVISOR_ID_CHICAGO) ?\
  34. NCP_WELL_KNOWN_SUPERVISOR_ID : \
  35. MAKELONG(LOWORD(id),SWAPWORD(HIWORD(id)))
  36. //
  37. // misc masks/bits for Object ID munging
  38. //
  39. #define BINDLIB_ID_MASK 0xF0000000
  40. #define BINDLIB_NCP_SAM 0x00000000
  41. //
  42. // This bit is set when the server is running on a NTAS machine or
  43. // the object is from a trusted domain.
  44. //
  45. // !! Note that there are places where we check this bit to see if either
  46. // !! BINDLIB_REMOTE_DOMAIN_BIAS or BINDLIB_LOCAL_USER_BIAS is set.
  47. //
  48. #define BINDLIB_REMOTE_DOMAIN_BIAS 0x10000000
  49. //
  50. // If the client is from the builtin domain, this bit will be set. This
  51. // is opposed to the local domain, which is different.
  52. //
  53. #define BINDLIB_BUILTIN_BIAS 0x20000000
  54. //
  55. // If the client is from a trusted domain and the rid is from the
  56. // local domain and the client's rid is the same as the rid from the
  57. // sid, we will mark that the rid is the same as the local user's sid.
  58. //
  59. // !! Note... this is a value, not a flag. This will require special casing
  60. // !! everywhere but we can't spare any more bits.
  61. //
  62. #define BINDLIB_LOCAL_USER_BIAS 0x70000000
  63. //
  64. // User defined objects that is stored in the registry.
  65. //
  66. #define BINDLIB_NCP_USER_DEFINED 0x40000000
  67. //
  68. // Print Queues and Print Servers that is stored in the registry.
  69. // The bindery keeps a list of print queues in a link list so that
  70. // the bindery does not have to go look in the registry all the time.
  71. //
  72. #define BINDLIB_NCP_REGISTRY 0x80000000
  73. //
  74. // The SAP Agent uses these bits. The SAP Agent cannot go any higher
  75. // than the value below.
  76. //
  77. #define BINDLIB_NCP_SAP 0xC0000000
  78. #define BINDLIB_NCP_MAX_SAP 0xCFFFFFFF
  79. //
  80. // We have some reserved fields for unknown users that will go into the
  81. // following range....
  82. //
  83. #define NCP_UNKNOWN_USER 0xD0000000
  84. #define NCP_SAME_RID_AS_CLIENT_BUT_LOCAL 0xDFFFFFFF
  85. #define NCP_USER_IS_CONNECTED_BUT_REMOTE(connid) (0xD0000000 | (connid))
  86. #define NCP_WELL_KNOWN_RID(rid) (0xD1000000 | (rid))
  87. //
  88. // Chicago will use a range of object ids that start at the below value
  89. // and go to 0xFFFFFFFF. We should never see these on our server when
  90. // a chicago server is passing through to us.
  91. //
  92. #define BINDLIB_CHICAGO 0xE0000000
  93. //
  94. // This is used to remove the domain bias from a object id.
  95. //
  96. #define BINDLIB_MASK_OUT_DOMAIN_BIAS 0x70000000
  97. #define NCP_INITIAL_SEARCH (ULONG) 0xFFFFFFFF
  98. #define NCP_ANY_TARGET_SERVER (ULONG) 0xFFFFFFFF
  99. #define NCP_OBJECT_HAS_PROPERTIES (UCHAR) 0xFF
  100. #define NCP_OBJECT_HAS_NO_PROPERTIES (UCHAR) 0
  101. #define NCP_PROPERTY_HAS_VALUE (UCHAR) 0xFF
  102. #define NCP_PROPERTY_HAS_NO_VALUE (UCHAR) 0
  103. #define NCP_MORE_PROPERTY (UCHAR) 0xFF
  104. #define NCP_NO_MORE_PROPERTY (UCHAR) 0
  105. #define NCP_MORE_SEGMENTS (UCHAR) 0xFF
  106. #define NCP_NO_MORE_SEGMENTS (UCHAR) 0
  107. #define NCP_DO_REMOVE_REMAINING_SEGMENTS (UCHAR) 0
  108. #define NCP_DO_NOT_REMOVE_REMAINING_SEGMENTS (UCHAR) 0xFF
  109. /*++
  110. *******************************************************************
  111. Maximum length for the Bindery
  112. *******************************************************************
  113. --*/
  114. #define NETWARE_OBJECTNAMELENGTH 47
  115. #define NETWARE_PROPERTYNAMELENGTH 16
  116. #define NETWARE_PROPERTYVALUELENGTH 128
  117. #define NETWARE_TIME_RESTRICTION_LENGTH 42
  118. #define NETWARE_PASSWORDLENGTH 128
  119. #define NCP_MAX_ENCRYPTED_PASSWORD_LENGTH 16
  120. #define NETWARE_MAX_OBJECT_IDS_IN_SET 32
  121. #define NETWARE_SERVERNAMELENGTH 48
  122. #define NETWARE_VOLUMENAMELENGTH 16
  123. #define NETWARE_MAX_PATH_LENGTH 255
  124. /*++
  125. *******************************************************************
  126. Well known NetWare object types
  127. *******************************************************************
  128. --*/
  129. #define NCP_OT_WILD 0xFFFF
  130. #define NCP_OT_UNKNOWN 0x0000
  131. #define NCP_OT_USER 0x0001
  132. #define NCP_OT_USER_GROUP 0x0002
  133. #define NCP_OT_PRINT_QUEUE 0x0003
  134. #define NCP_OT_FILE_SERVER 0x0004
  135. #define NCP_OT_JOB_SERVER 0x0005
  136. #define NCP_OT_GATEWAY 0x0006
  137. #define NCP_OT_PRINT_SERVER 0x0007
  138. #define NCP_OT_ARCHIVE_QUEUE 0x0008
  139. #define NCP_OT_ARCHIVE_SEVER 0x0009
  140. #define NCP_OT_JOB_QUEUE 0x000A
  141. #define NCP_OT_ADMINISTRATION 0x000B
  142. #define NCP_OT_SNA_GATEWAY 0x0021
  143. #define NCP_OT_REMOTE_BRIDGE 0x0024
  144. #define NCP_OT_REMOTE_BRIDGE_SERVER 0x0026
  145. #define NCP_OT_ADVERTISING_PRINT_SERVER 0x0047
  146. /*++
  147. *******************************************************************
  148. Bindery flags
  149. *******************************************************************
  150. --*/
  151. /** NetWare Bindery Flags **/
  152. #define NCP_STATIC 0x00 /* Property or Object exists until it
  153. is deleted with Delete Property or
  154. Object */
  155. #define NCP_DYNAMIC 0x01 /* Property or Object is deleted from
  156. bindery when file server is started */
  157. #define NCP_ITEM 0x00 /* Values are defined and interpreted by
  158. applications or by APIs */
  159. #define NCP_SET 0x02 /* Series of Object ID numbers, each 4
  160. bytes long */
  161. /** NetWare Bindery Security Flags **/
  162. #define NCP_ANY_READ 0x00 /* Readable by anyone */
  163. #define NCP_LOGGED_READ 0x01 /* Must be logged in to read */
  164. #define NCP_OBJECT_READ 0x02 /* Readable by same object or super */
  165. #define NCP_BINDERY_READ 0x04 /* Readable only by the bindery */
  166. #define NCP_SUPER_READ NCP_LOGGED_READ | NCP_OBJECT_READ
  167. #define NCP_ALL_READ NCP_ANY_READ | NCP_LOGGED_READ | NCP_OBJECT_READ
  168. #define NCP_ANY_WRITE 0x00 /* Writeable by anyone */
  169. #define NCP_LOGGED_WRITE 0x10 /* Must be logged in to write */
  170. #define NCP_OBJECT_WRITE 0x20 /* Writeable by same object or super */
  171. #define NCP_BINDERY_WRITE 0x40 /* Writeable only by the bindery */
  172. #define NCP_SUPER_WRITE NCP_LOGGED_WRITE | NCP_OBJECT_WRITE
  173. #define NCP_ALL_WRITE NCP_ANY_WRITE | NCP_LOGGED_WRITE | NCP_OBJECT_WRITE
  174. // File Attributes
  175. #define NW_ATTRIBUTE_SHARABLE 0x80
  176. #define NW_ATTRIBUTE_ARCHIVE 0x20
  177. #define NW_ATTRIBUTE_DIRECTORY 0x10
  178. #define NW_ATTRIBUTE_EXECUTE_ONLY 0x08
  179. #define NW_ATTRIBUTE_SYSTEM 0x04
  180. #define NW_ATTRIBUTE_HIDDEN 0x02
  181. #define NW_ATTRIBUTE_READ_ONLY 0x01
  182. // Open Flags
  183. #define NW_OPEN_EXCLUSIVE 0x10
  184. #define NW_DENY_WRITE 0x08
  185. #define NW_DENY_READ 0x04
  186. #define NW_OPEN_FOR_WRITE 0x02
  187. #define NW_OPEN_FOR_READ 0x01
  188. //
  189. // Connection status flags
  190. //
  191. #define NCP_STATUS_BAD_CONNECTION 0x01
  192. #define NCP_STATUS_NO_CONNECTIONS 0x02
  193. #define NCP_STATUS_SERVER_DOWN 0x04
  194. #define NCP_STATUS_MSG_PENDING 0x08
  195. //
  196. // Special values for SmallWorld PDC object and property name
  197. //
  198. #define MS_WINNT_NAME "MS_WINNT"
  199. #define MS_SYNC_PDC_NAME "SYNCPDC"
  200. #define MS_WINNT_OBJ_TYPE 0x06BB
  201. //
  202. // User Property values (ie. User Parms stuff)
  203. //
  204. #define USER_PROPERTY_SIGNATURE L'P'
  205. #define NWPASSWORD L"NWPassword"
  206. #define OLDNWPASSWORD L"OldNWPassword"
  207. #define MAXCONNECTIONS L"MaxConnections"
  208. #define NWTIMEPASSWORDSET L"NWPasswordSet"
  209. #define SZTRUE L"TRUE"
  210. #define GRACELOGINALLOWED L"GraceLoginAllowed"
  211. #define GRACELOGINREMAINING L"GraceLoginRemaining"
  212. #define NWLOGONFROM L"NWLogonFrom"
  213. #define NWHOMEDIR L"NWHomeDir"
  214. #define NW_PRINT_SERVER_REF_COUNT L"PSRefCount"
  215. #define SUPERVISOR_USERID NCP_WELL_KNOWN_SUPERVISOR_ID
  216. #define SUPERVISOR_NAME_STRING L"Supervisor"
  217. #define SYSVOL_NAME_STRING L"SYS"
  218. #define NWENCRYPTEDPASSWORDLENGTH 8
  219. #define NO_LIMIT 0xffff
  220. #define DEFAULT_MAXCONNECTIONS NO_LIMIT
  221. #define DEFAULT_NWPASSWORDEXPIRED FALSE
  222. #define DEFAULT_GRACELOGINALLOWED 6
  223. #define DEFAULT_GRACELOGINREMAINING 6
  224. #define DEFAULT_NWLOGONFROM NULL
  225. #define DEFAULT_NWHOMEDIR NULL
  226. #define USER_PROPERTY_TYPE_ITEM 1
  227. #define USER_PROPERTY_TYPE_SET 2
  228. #endif /* _NCPCOMM_ */