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.

1280 lines
33 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. LPMAPI.H - Include file for Local Policy Module
  5. Abstract:
  6. This module defines the LPM structures and types.
  7. Revision History:
  8. There is no support for ACS in Windows XP or later versions of Windows.
  9. --*/
  10. /****************************************************************************
  11. RSVPD -- ReSerVation Protocol Daemon
  12. USC Information Sciences Institute
  13. Marina del Rey, California
  14. Original Version: Shai Herzog, Nov. 1993.
  15. Current Version: Steven Berson & Bob Braden, may 1996.
  16. Copyright (c) 1996 by the University of Southern California
  17. All rights reserved.
  18. Permission to use, copy, modify, and distribute this software and its
  19. documentation in source and binary forms for any purpose and without
  20. fee is hereby granted, provided that both the above copyright notice
  21. and this permission notice appear in all copies, and that any
  22. documentation, advertising materials, and other materials related to
  23. such distribution and use acknowledge that the software was developed
  24. in part by the University of Southern California, Information
  25. Sciences Institute. The name of the University may not be used to
  26. endorse or promote products derived from this software without
  27. specific prior written permission.
  28. THE UNIVERSITY OF SOUTHERN CALIFORNIA makes no representations about
  29. the suitability of this software for any purpose. THIS SOFTWARE IS
  30. PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
  31. INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  32. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  33. Other copyrights might apply to parts of this software and are so
  34. noted when applicable.
  35. ********************************************************************/
  36. #ifndef __LPMAPI_H_
  37. #define __LPMAPI_H_
  38. #if _MSC_VER > 1000
  39. #pragma once
  40. #endif
  41. #ifdef __cplusplus
  42. extern "C"
  43. {
  44. #endif
  45. #ifndef CALLBACK
  46. #define CALLBACK __stdcall
  47. #endif
  48. #ifndef APIENTRY
  49. #define APIENTRY FAR __stdcall
  50. #endif
  51. /*
  52. * Standard format of an RSVP object header
  53. */
  54. typedef struct {
  55. USHORT obj_length; /* Length in bytes */
  56. UCHAR obj_class; /* Class (values defined below) */
  57. UCHAR obj_ctype; /* C-Type (values defined below) */
  58. } RsvpObjHdr;
  59. #define ObjLength(x) ((RsvpObjHdr *)x)->obj_length
  60. #define ObjCType(x) ((RsvpObjHdr *)x)->obj_ctype
  61. #define ObjClass(x) ((RsvpObjHdr *)x)->obj_class
  62. #define ObjData(x) ((RsvpObjHdr *)(x)+1)
  63. /*
  64. * Define object classes: Class-Num values
  65. */
  66. #define class_NULL 0
  67. #define class_SESSION 1
  68. #define class_SESSION_GROUP 2
  69. #define class_RSVP_HOP 3
  70. #define class_INTEGRITY 4
  71. #define class_TIME_VALUES 5
  72. #define class_ERROR_SPEC 6
  73. #define class_SCOPE 7
  74. #define class_STYLE 8
  75. #define class_FLOWSPEC 9 // these two are the same
  76. #define class_IS_FLOWSPEC 9 // since we added IS in front of the name
  77. #define class_FILTER_SPEC 10
  78. #define class_SENDER_TEMPLATE 11
  79. #define class_SENDER_TSPEC 12
  80. #define class_ADSPEC 13
  81. #define class_POLICY_DATA 14
  82. #define class_CONFIRM 15
  83. #define class_MAX 15
  84. /*
  85. * RSVP SESSION object
  86. */
  87. #define ctype_SESSION_ipv4 1
  88. #define ctype_SESSION_ipv4GPI 3 /* IPSEC: Generalized Port Id */
  89. #define SESSFLG_E_Police 0x01 /* E_Police: Entry policing flag*/
  90. typedef struct {
  91. IN_ADDR sess_destaddr; // DestAddress
  92. UCHAR sess_protid; // Protocol Id
  93. UCHAR sess_flags; // Use the flags defined above
  94. USHORT sess_destport; // DestPort
  95. } Session_IPv4;
  96. /* GPI versions have virtual dest port instead of dest port; this
  97. * changes the interpretation but not the format, so we do not
  98. * define new structs for GPI.
  99. */
  100. typedef struct {
  101. RsvpObjHdr sess_header;
  102. union {
  103. Session_IPv4 sess_ipv4;
  104. } sess_u;
  105. } RSVP_SESSION;
  106. // Useful defines to access components of SESSION obect
  107. #define Sess4Addr sess_u.sess_ipv4.sess_destaddr
  108. #define Sess4Port sess_u.sess_ipv4.sess_destport
  109. #define Sess4Protocol sess_u.sess_ipv4.sess_protid
  110. #define Sess4Flags sess_u.sess_ipv4.sess_flags
  111. /*
  112. * RSVP HOP object
  113. */
  114. #define ctype_RSVP_HOP_ipv4 1
  115. typedef struct {
  116. IN_ADDR hop_ipaddr; // Next/Previous Hop Address
  117. ULONG hop_LIH; // Logical Interface Handle
  118. } Rsvp_Hop_IPv4;
  119. typedef struct {
  120. RsvpObjHdr hop_header;
  121. union {
  122. Rsvp_Hop_IPv4 hop_ipv4;
  123. } hop_u;
  124. } RSVP_HOP;
  125. #define Hop4LIH hop_u.hop_ipv4.hop_LIH
  126. #define Hop4Addr hop_u.hop_ipv4.hop_ipaddr
  127. /*
  128. * RSVP STYLE object
  129. */
  130. // Define values for option vector
  131. #define Opt_Share_mask 0x00000018 // 2 bits: Sharing control
  132. #define Opt_Distinct 0x00000008 // Distinct reservations
  133. #define Opt_Shared 0x00000010 // Shared reservations
  134. #define Opt_SndSel_mask 0x00000007 // 3 bits: Sender selection
  135. #define Opt_Wildcard 0x00000001 // Wildcard scope
  136. #define Opt_Explicit 0x00000002 // Explicit scope
  137. #define Style_is_Wildcard(p) (((p)&Opt_SndSel_mask) == Opt_Wildcard)
  138. #define Style_is_Shared(p) (((p)&Opt_Share_mask) == Opt_Shared)
  139. // Define style values
  140. #define STYLE_WF Opt_Shared + Opt_Wildcard
  141. #define STYLE_FF Opt_Distinct + Opt_Explicit
  142. #define STYLE_SE Opt_Shared + Opt_Explicit
  143. #define ctype_STYLE 1
  144. typedef struct {
  145. RsvpObjHdr style_header;
  146. ULONG style_word;
  147. } RESV_STYLE;
  148. /*
  149. * RSVP FILTER SPEC object
  150. */
  151. #define ctype_FILTER_SPEC_ipv4 1 // IPv4 FILTER_SPEC
  152. #define ctype_FILTER_SPEC_ipv4GPI 4 // IPv4/GPI FILTER_SPEC
  153. typedef struct {
  154. IN_ADDR filt_ipaddr; // IPv4 SrcAddress
  155. USHORT filt_unused;
  156. USHORT filt_port; // SrcPort
  157. } Filter_Spec_IPv4;
  158. typedef struct {
  159. IN_ADDR filt_ipaddr; // IPv4 SrcAddress
  160. ULONG filt_gpi; // Generalized Port Id
  161. } Filter_Spec_IPv4GPI;
  162. typedef struct {
  163. RsvpObjHdr filt_header;
  164. union {
  165. Filter_Spec_IPv4 filt_ipv4;
  166. Filter_Spec_IPv4GPI filt_ipv4gpi;
  167. } filt_u;
  168. } FILTER_SPEC;
  169. #define FilterSrcaddr filt_u.filt_ipv4.filt_ipaddr
  170. #define FilterSrcport filt_u.filt_ipv4.filt_port
  171. /*
  172. * RSVP SENDER_TEMPLATE object
  173. */
  174. #define ctype_SENDER_TEMPLATE_ipv4 1 // IPv4 SENDER_TEMPLATE
  175. #define ctype_SENDER_TEMPLATE_ipv4GPI 4 // IPv4/GPI SENDER_TEMPLATE
  176. typedef FILTER_SPEC SENDER_TEMPLATE; // Identical to FILTER_SPEC
  177. /*
  178. * RSVP SCOPE object class
  179. */
  180. #define ctype_SCOPE_list_ipv4 1
  181. typedef struct {
  182. IN_ADDR scopl_ipaddr[1]; // var-len list of IP sender addrs
  183. } Scope_list_ipv4;
  184. typedef struct {
  185. RsvpObjHdr scopl_header;
  186. union {
  187. Scope_list_ipv4 scopl_ipv4;
  188. } scope_u;
  189. } RSVP_SCOPE;
  190. #define Scope4Addr scope_u.scopl_ipv4.scopl_ipaddr
  191. #define ScopeCnt(scp) ((ObjLength(scp)-sizeof(RsvpObjHdr))/sizeof(struct in_addr))
  192. #define ScopeLen(cnt) (cnt*sizeof(struct in_addr)+sizeof(RsvpObjHdr))
  193. /*
  194. * ERROR_SPEC object class
  195. */
  196. #define ctype_ERROR_SPEC_ipv4 1
  197. typedef struct {
  198. struct in_addr errs_errnode; /* Error Node Address */
  199. u_char errs_flags; /* Flags: */
  200. #define ERROR_SPECF_InPlace 0x01 /* Left resv in place */
  201. #define ERROR_SPECF_NotGuilty 0x02 /* This rcvr not guilty */
  202. UCHAR errs_code; /* Error Code (def'd below) */
  203. USHORT errs_value; /* Error Value */
  204. #define ERR_FORWARD_OK 0x8000 /* Flag: OK to forward state */
  205. #define Error_Usage(x) (((x)>>12)&3)
  206. #define ERR_Usage_globl 0x00 /* Globally-defined sub-code */
  207. #define ERR_Usage_local 0x10 /* Locally-defined sub-code */
  208. #define ERR_Usage_serv 0x11 /* Service-defined sub-code */
  209. #define ERR_global_mask 0x0fff /* Sub-code bits in Error Val */
  210. } Error_Spec_IPv4;
  211. typedef struct {
  212. RsvpObjHdr errs_header;
  213. union {
  214. Error_Spec_IPv4 errs_ipv4;
  215. } errs_u;
  216. } ERROR_SPEC;
  217. #define errspec4_enode errs_u.errs_ipv4.errs_errnode
  218. #define errspec4_code errs_u.errs_ipv4.errs_code
  219. #define errspec4_value errs_u.errs_ipv4.errs_value
  220. #define errspec4_flags errs_u.errs_ipv4.errs_flags
  221. /*
  222. * POLICY_DATA object class
  223. *
  224. * Contents are Opaque RSVP/SBM
  225. */
  226. #define ctype_POLICY_DATA 1
  227. typedef struct {
  228. RsvpObjHdr PolicyObjHdr;
  229. USHORT usPeOffset; // Offset to the start of Policy Elements
  230. // from the begining of Policy Data
  231. USHORT usReserved;
  232. } POLICY_DATA;
  233. #define PD_HDR_LEN sizeof(POLICY_DATA)
  234. typedef struct {
  235. USHORT usPeLength; // Policy Element length
  236. USHORT usPeType; // Policy Element type
  237. UCHAR ucPeData[4]; // Just a place holder to the start of
  238. // Policy Element data
  239. } POLICY_ELEMENT;
  240. #define PE_HDR_LEN (2 * sizeof(USHORT))
  241. /**************************************************************************
  242. *
  243. * Int-Serv Data Structures
  244. *
  245. **************************************************************************/
  246. /*
  247. * Service numbers
  248. */
  249. #define GENERAL_INFO 1
  250. #define GUARANTEED_SERV 2
  251. #define PREDICTIVE_SERV 3
  252. #define CONTROLLED_DELAY_SERV 4
  253. #define CONTROLLED_LOAD_SERV 5
  254. #define QUALITATIVE_SERV 6
  255. /*
  256. * Well-known parameter IDs
  257. */
  258. enum int_serv_wkp {
  259. IS_WKP_HOP_CNT = 4,
  260. IS_WKP_PATH_BW = 6,
  261. IS_WKP_MIN_LATENCY = 8,
  262. IS_WKP_COMPOSED_MTU = 10,
  263. IS_WKP_TB_TSPEC = 127, /* Token-bucket TSPEC parm */
  264. IS_WKP_Q_TSPEC = 128
  265. };
  266. /*
  267. * Int-serv Main header
  268. */
  269. typedef struct {
  270. UCHAR ismh_version; // Version
  271. UCHAR ismh_unused;
  272. USHORT ismh_len32b; // # 32-bit words excluding this hdr
  273. } IntServMainHdr;
  274. #define INTSERV_VERS_MASK 0xf0
  275. #define INTSERV_VERSION0 0
  276. #define Intserv_Version(x) (((x)&INTSERV_VERS_MASK)>>4)
  277. #define Intserv_Version_OK(x) (((x)->ismh_version&INTSERV_VERS_MASK)== \
  278. INTSERV_VERSION0)
  279. // Convert ishm_length to equivalent RSVP object size, for checking
  280. #define Intserv_Obj_size(x) (((IntServMainHdr *)(x))->ismh_len32b * 4 + \
  281. sizeof(IntServMainHdr) + sizeof(RsvpObjHdr))
  282. /*
  283. * Int-serv Service Element Header
  284. */
  285. // Flag: Break bit
  286. #define ISSH_BREAK_BIT 0x80
  287. typedef struct {
  288. UCHAR issh_service; // Service number
  289. UCHAR issh_flags; // Flag byte
  290. USHORT issh_len32b; // #32-bit words excluding this hdr
  291. } IntServServiceHdr;
  292. #define Issh_len32b(p) ((p)->issh_len32b)
  293. /*
  294. * Int-serv Parameter Element Header
  295. */
  296. #define ISPH_FLG_INV 0x80 // Flag: Invalid
  297. typedef struct {
  298. UCHAR isph_parm_num; // Parameter number
  299. UCHAR isph_flags; // Flags
  300. USHORT isph_len32b; // #32-bit words excluding this hdr
  301. } IntServParmHdr;
  302. #define Next_Main_Hdr(p) (IntServMainHdr *)((ULONG *)(p)+1+(p)->ismh_len32b)
  303. #define Next_Serv_Hdr(p) (IntServServiceHdr *)((ULONG *)(p)+1+(p)->issh_len32b)
  304. #define Next_Parm_Hdr(p) (IntServParmHdr *)((ULONG *)(p)+1+(p)->isph_len32b)
  305. /*
  306. * Generic Tspec Parameters
  307. */
  308. typedef struct {
  309. FLOAT TB_Tspec_r; // Token bucket rate (B/sec)
  310. FLOAT TB_Tspec_b; // Token bucket depth (B)
  311. FLOAT TB_Tspec_p; // Peak data rate (B/sec)
  312. ULONG TB_Tspec_m; // Min Policed Unit (B)
  313. ULONG TB_Tspec_M; // Max pkt size (B)
  314. } GenTspecParms;
  315. /*
  316. * Generic Tspec
  317. */
  318. typedef struct {
  319. IntServServiceHdr gen_Tspec_serv_hdr; // (GENERAL_INFO, length)
  320. IntServParmHdr gen_Tspec_parm_hdr; // (IS_WKP_TB_TSPEC)
  321. GenTspecParms gen_Tspec_parms;
  322. } GenTspec;
  323. #define gtspec_r gen_Tspec_parms.TB_Tspec_r
  324. #define gtspec_b gen_Tspec_parms.TB_Tspec_b
  325. #define gtspec_m gen_Tspec_parms.TB_Tspec_m
  326. #define gtspec_M gen_Tspec_parms.TB_Tspec_M
  327. #define gtspec_p gen_Tspec_parms.TB_Tspec_p
  328. #define gtspec_parmno gen_Tspec_parm_hdr.isph_parm_num
  329. #define gtspec_flags gen_Tspec_parm_hdr.isph_flags
  330. #define gtspec_len (sizeof(GenTspec) - sizeof(IntServServiceHdr))
  331. /* contents of qualitative tspec */
  332. typedef struct {
  333. ULONG TB_Tspec_M; // Max pkt size (M)
  334. } QualTspecParms;
  335. typedef struct {
  336. IntServServiceHdr qual_Tspec_serv_hdr; // (QUALITATIVE_SERV, length)
  337. IntServParmHdr qual_Tspec_parm_hdr; // (IS_WKP_Q_TSPEC)
  338. QualTspecParms qual_Tspec_parms;
  339. } QualTspec;
  340. typedef struct {
  341. IntServServiceHdr Q_spec_serv_hdr; // (QUALITATIVE_SERV,0,len)
  342. IntServParmHdr Q_spec_parm_hdr; // (IS_WKP_Q_TSPEC)
  343. QualTspecParms Q_spec_parms; // QUALITATIVE Tspec parameters
  344. } QualAppFlowSpec;
  345. #define QAspec_M Q_spec_parms.TB_Tspec_M
  346. /*
  347. * Contents of int-serv Tspec
  348. */
  349. typedef struct {
  350. IntServMainHdr st_mh;
  351. union {
  352. GenTspec gen_stspec; // Generic Tspec
  353. QualTspec qual_stspec;
  354. } tspec_u;
  355. } IntServTspecBody;
  356. /*
  357. * SENDER_TSPEC class object
  358. */
  359. #define ctype_SENDER_TSPEC 2
  360. typedef struct {
  361. RsvpObjHdr stspec_header;
  362. IntServTspecBody stspec_body;
  363. } SENDER_TSPEC;
  364. /*
  365. * Controlled-Load Flowspec
  366. */
  367. typedef struct {
  368. IntServServiceHdr CL_spec_serv_hdr; // (CONTROLLED_LOAD_SERV,0,len)
  369. IntServParmHdr CL_spec_parm_hdr; // (IS_WKP_TB_TSPEC)
  370. GenTspecParms CL_spec_parms; // GENERIC Tspec parameters
  371. } CtrlLoadFlowspec;
  372. #define CLspec_r CL_spec_parms.TB_Tspec_r
  373. #define CLspec_b CL_spec_parms.TB_Tspec_b
  374. #define CLspec_p CL_spec_parms.TB_Tspec_p
  375. #define CLspec_m CL_spec_parms.TB_Tspec_m
  376. #define CLspec_M CL_spec_parms.TB_Tspec_M
  377. #define CLspec_parmno CL_spec_parm_hdr.isph_parm_num
  378. #define CLspec_flags CL_spec_parm_hdr.isph_flags
  379. #define CLspec_len32b CL_spec_parm_hdr.isph_len32b
  380. #define CLspec_len (sizeof(CtrlLoadFlowspec) - sizeof(IntServServiceHdr))
  381. /* Service-specific Parameter IDs
  382. */
  383. enum {
  384. IS_GUAR_RSPEC = 130,
  385. GUAR_ADSPARM_C = 131,
  386. GUAR_ADSPARM_D = 132,
  387. GUAR_ADSPARM_Ctot = 133,
  388. GUAR_ADSPARM_Dtot = 134,
  389. GUAR_ADSPARM_Csum = 135,
  390. GUAR_ADSPARM_Dsum = 136
  391. };
  392. /*
  393. * Guaranteed Rspec parameters
  394. */
  395. typedef struct {
  396. FLOAT Guar_R; // Guaranteed Rate B/s
  397. ULONG Guar_S; // Slack term secs
  398. } GuarRspec;
  399. /*
  400. * Guaranteed Flowspec
  401. */
  402. typedef struct {
  403. IntServServiceHdr Guar_serv_hdr; // (GUARANTEED, 0, length)
  404. IntServParmHdr Guar_Tspec_hdr; // (IS_WKP_TB_TSPEC,)
  405. GenTspecParms Guar_Tspec_parms; // GENERIC Tspec parms
  406. IntServParmHdr Guar_Rspec_hdr; // (IS_GUAR_RSPEC)
  407. GuarRspec Guar_Rspec; // Guaranteed rate (B/sec)
  408. } GuarFlowSpec;
  409. #define Gspec_r Guar_Tspec_parms.TB_Tspec_r
  410. #define Gspec_b Guar_Tspec_parms.TB_Tspec_b
  411. #define Gspec_p Guar_Tspec_parms.TB_Tspec_p
  412. #define Gspec_m Guar_Tspec_parms.TB_Tspec_m
  413. #define Gspec_M Guar_Tspec_parms.TB_Tspec_M
  414. #define Gspec_R Guar_Rspec.Guar_R
  415. #define Gspec_S Guar_Rspec.Guar_S
  416. #define Gspec_T_parmno Guar_Tspec_hdr.isph_parm_num
  417. #define Gspec_T_flags Guar_Tspec_hdr.isph_flags
  418. #define Gspec_R_parmno Guar_Rspec_hdr.isph_parm_num
  419. #define Gspec_R_flags Guar_Rspec_hdr.isph_flags
  420. #define Gspec_len (sizeof(GuarFlowSpec) - sizeof(IntServServiceHdr))
  421. /*
  422. * Contents of int-serv flowspec
  423. */
  424. typedef struct {
  425. IntServMainHdr spec_mh;
  426. union {
  427. CtrlLoadFlowspec CL_spec; // Controlled-Load service
  428. GuarFlowSpec G_spec; // Guaranteed service
  429. QualAppFlowSpec Q_spec;
  430. } spec_u;
  431. } IntServFlowSpec;
  432. #define ISmh_len32b spec_mh.ismh_len32b
  433. #define ISmh_version spec_mh.ismh_version
  434. #define ISmh_unused spec_mh.ismh_unused
  435. /*
  436. * Int-Serv FLOWSPEC object
  437. */
  438. #define ctype_FLOWSPEC_Intserv0 2 // The int-serv flowspec (v.0)
  439. typedef struct {
  440. RsvpObjHdr flow_header;
  441. IntServFlowSpec flow_body;
  442. }IS_FLOWSPEC;
  443. /*
  444. * FLOW DESCRIPTOR
  445. */
  446. typedef struct flow_desc {
  447. union {
  448. SENDER_TSPEC *stspec;
  449. IS_FLOWSPEC *isflow;
  450. } u1;
  451. union {
  452. SENDER_TEMPLATE *stemp;
  453. FILTER_SPEC *fspec;
  454. } u2;
  455. } FLOW_DESC;
  456. #define FdSenderTspec u1.stspec
  457. #define FdIsFlowSpec u1.isflow
  458. #define FdSenderTemplate u2.stemp
  459. #define FdFilterSpec u2.fspec
  460. /*
  461. * ADSPEC class object
  462. *
  463. * Opaque to RSVP -- Contents defined in rapi_lib.h
  464. */
  465. #define ctype_ADSPEC_INTSERV 2
  466. /*
  467. * Guaranteed service Adspec parameters -- fixed part
  468. */
  469. typedef struct {
  470. IntServServiceHdr Gads_serv_hdr; // GUARANTEED, x, len
  471. IntServParmHdr Gads_Ctot_hdr; // GUAR_ADSPARM_Ctot
  472. ULONG Gads_Ctot;
  473. IntServParmHdr Gads_Dtot_hdr; // (GUAR_ADSPARM_Dtot
  474. ULONG Gads_Dtot;
  475. IntServParmHdr Gads_Csum_hdr; // GUAR_ADSPARM_Csum
  476. ULONG Gads_Csum;
  477. IntServParmHdr Gads_Dsum_hdr; // GUAR_ADSPARM_Dsum
  478. ULONG Gads_Dsum;
  479. /*
  480. * May be followed by override general param values
  481. */
  482. } Gads_parms_t;
  483. /*
  484. * General Path Characterization Parameters
  485. */
  486. typedef struct {
  487. IntServServiceHdr gen_parm_hdr; // GENERAL_INFO, len
  488. IntServParmHdr gen_parm_hopcnt_hdr; // (IS_WKP_HOP_CNT
  489. ULONG gen_parm_hopcnt;
  490. IntServParmHdr gen_parm_pathbw_hdr; // IS_WKP_PATH_BW
  491. FLOAT gen_parm_path_bw;
  492. IntServParmHdr gen_parm_minlat_hdr; // IS_WKP_MIN_LATENCY
  493. ULONG gen_parm_min_latency;
  494. IntServParmHdr gen_parm_compmtu_hdr; // IS_WKP_COMPOSED_MTU
  495. ULONG gen_parm_composed_MTU;
  496. } GenAdspecParams;
  497. /*
  498. * Contents of (minimal) int-serv Adspec
  499. */
  500. typedef struct {
  501. IntServMainHdr adspec_mh; // Main header
  502. GenAdspecParams adspec_genparms;// General char parm fragment
  503. /*
  504. * Followed by variable-length fragments for some or all
  505. * services. These can be minimal length fragments.
  506. */
  507. } IS_ADSPEC_BODY;
  508. #define GEN_ADSPEC_LEN (sizeof(Object_header) + sizeof(IS_adsbody_t ) )
  509. typedef struct {
  510. RsvpObjHdr adspec_header;
  511. IS_ADSPEC_BODY adspec_body; /* Defined in rapi_lib.h */
  512. } ADSPEC;
  513. // RSVP message types
  514. #define RSVP_PATH 1
  515. #define RSVP_RESV 2
  516. #define RSVP_PATH_ERR 3
  517. #define RSVP_RESV_ERR 4
  518. #define RSVP_PATH_TEAR 5
  519. #define RSVP_RESV_TEAR 6
  520. /* RSVP error codes
  521. */
  522. #define RSVP_Err_NONE 0 /* No error (CONFIRM) */
  523. #define RSVP_Erv_Nonev 0 /* No-error Error Value */
  524. /* Admission Control failure */
  525. #define RSVP_Err_ADMISSION 1
  526. /* Globally-defined sub-codes for : Admission Control failure */
  527. #define RSVP_Erv_Other 0 /* Unspecified cause */
  528. #define RSVP_Erv_DelayBnd 1 /* Cannot meet delay bound req */
  529. #define RSVP_Erv_Bandwidth 2 /* Insufficient bandwidth */
  530. #define RSVP_Erv_MTU 3 /* MTU in flowspec too large */
  531. // Microsoft specific error values
  532. #define RSVP_Erv_Flow_Rate 0x8001
  533. #define RSVP_Erv_Bucket_szie 0x8002
  534. #define RSVP_Erv_Peak_Rate 0x8003
  535. #define RSVP_Erv_Min_Policied_size 0x8004
  536. /* Policy control failure */
  537. #define RSVP_Err_POLICY 2
  538. // Policy error values from Identity draft
  539. #define POLICY_ERRV_NO_MORE_INFO 1
  540. #define POLICY_ERRV_UNSUPPORTED_CREDENTIAL_TYPE 2
  541. #define POLICY_ERRV_INSUFFICIENT_PRIVILEGES 3
  542. #define POLICY_ERRV_EXPIRED_CREDENTIALS 4
  543. #define POLICY_ERRV_IDENTITY_CHANGED 5
  544. // Microsoft specific policy error values
  545. #define POLICY_ERRV_UNKNOWN 0
  546. #define POLICY_ERRV_GLOBAL_DEF_FLOW_COUNT 1
  547. #define POLICY_ERRV_GLOBAL_GRP_FLOW_COUNT 2
  548. #define POLICY_ERRV_GLOBAL_USER_FLOW_COUNT 3
  549. #define POLICY_ERRV_GLOBAL_UNAUTH_USER_FLOW_COUNT 4
  550. #define POLICY_ERRV_SUBNET_DEF_FLOW_COUNT 5
  551. #define POLICY_ERRV_SUBNET_GRP_FLOW_COUNT 6
  552. #define POLICY_ERRV_SUBNET_USER_FLOW_COUNT 7
  553. #define POLICY_ERRV_SUBNET_UNAUTH_USER_FLOW_COUNT 8
  554. #define POLICY_ERRV_GLOBAL_DEF_FLOW_DURATION 9
  555. #define POLICY_ERRV_GLOBAL_GRP_FLOW_DURATION 10
  556. #define POLICY_ERRV_GLOBAL_USER_FLOW_DURATION 11
  557. #define POLICY_ERRV_GLOBAL_UNAUTH_USER_FLOW_DURATION 12
  558. #define POLICY_ERRV_SUBNET_DEF_FLOW_DURATION 13
  559. #define POLICY_ERRV_SUBNET_GRP_FLOW_DURATION 14
  560. #define POLICY_ERRV_SUBNET_USER_FLOW_DURATION 15
  561. #define POLICY_ERRV_SUBNET_UNAUTH_USER_FLOW_DURATION 16
  562. #define POLICY_ERRV_GLOBAL_DEF_FLOW_RATE 17
  563. #define POLICY_ERRV_GLOBAL_GRP_FLOW_RATE 18
  564. #define POLICY_ERRV_GLOBAL_USER_FLOW_RATE 19
  565. #define POLICY_ERRV_GLOBAL_UNAUTH_USER_FLOW_RATE 20
  566. #define POLICY_ERRV_SUBNET_DEF_FLOW_RATE 21
  567. #define POLICY_ERRV_SUBNET_GRP_FLOW_RATE 22
  568. #define POLICY_ERRV_SUBNET_USER_FLOW_RATE 23
  569. #define POLICY_ERRV_SUBNET_UNAUTH_USER_FLOW_RATE 24
  570. #define POLICY_ERRV_GLOBAL_DEF_PEAK_RATE 25
  571. #define POLICY_ERRV_GLOBAL_GRP_PEAK_RATE 26
  572. #define POLICY_ERRV_GLOBAL_USER_PEAK_RATE 27
  573. #define POLICY_ERRV_GLOBAL_UNAUTH_USER_PEAK_RATE 28
  574. #define POLICY_ERRV_SUBNET_DEF_PEAK_RATE 29
  575. #define POLICY_ERRV_SUBNET_GRP_PEAK_RATE 30
  576. #define POLICY_ERRV_SUBNET_USER_PEAK_RATE 31
  577. #define POLICY_ERRV_SUBNET_UNAUTH_USER_PEAK_RATE 32
  578. #define POLICY_ERRV_GLOBAL_DEF_SUM_FLOW_RATE 33
  579. #define POLICY_ERRV_GLOBAL_GRP_SUM_FLOW_RATE 34
  580. #define POLICY_ERRV_GLOBAL_USER_SUM_FLOW_RATE 35
  581. #define POLICY_ERRV_GLOBAL_UNAUTH_USER_SUM_FLOW_RATE 36
  582. #define POLICY_ERRV_SUBNET_DEF_SUM_FLOW_RATE 37
  583. #define POLICY_ERRV_SUBNET_GRP_SUM_FLOW_RATE 38
  584. #define POLICY_ERRV_SUBNET_USER_SUM_FLOW_RATE 39
  585. #define POLICY_ERRV_SUBNET_UNAUTH_USER_SUM_FLOW_RATE 40
  586. #define POLICY_ERRV_GLOBAL_DEF_SUM_PEAK_RATE 41
  587. #define POLICY_ERRV_GLOBAL_GRP_SUM_PEAK_RATE 42
  588. #define POLICY_ERRV_GLOBAL_USER_SUM_PEAK_RATE 43
  589. #define POLICY_ERRV_GLOBAL_UNAUTH_USER_SUM_PEAK_RATE 44
  590. #define POLICY_ERRV_SUBNET_DEF_SUM_PEAK_RATE 45
  591. #define POLICY_ERRV_SUBNET_GRP_SUM_PEAK_RATE 46
  592. #define POLICY_ERRV_SUBNET_USER_SUM_PEAK_RATE 47
  593. #define POLICY_ERRV_SUBNET_UNAUTH_USER_SUM_PEAK_RATE 48
  594. #define POLICY_ERRV_UNKNOWN_USER 49
  595. #define POLICY_ERRV_NO_PRIVILEGES 50
  596. #define POLICY_ERRV_EXPIRED_USER_TOKEN 51
  597. #define POLICY_ERRV_NO_RESOURCES 52
  598. #define POLICY_ERRV_PRE_EMPTED 53
  599. #define POLICY_ERRV_USER_CHANGED 54
  600. #define POLICY_ERRV_NO_ACCEPTS 55
  601. #define POLICY_ERRV_NO_MEMORY 56
  602. #define POLICY_ERRV_CRAZY_FLOWSPEC 57
  603. // Other RSVP defined Error codes
  604. #define RSVP_Err_NO_PATH 3 /* No path state for Resv */
  605. #define RSVP_Err_NO_SENDER 4 /* No sender info for Resv */
  606. #define RSVP_Err_BAD_STYLE 5 /* Conflicting style */
  607. #define RSVP_Err_UNKNOWN_STYLE 6 /* Unknown reservation style */
  608. #define RSVP_Err_BAD_DSTPORT 7 /* Conflicting DstPort in Sess */
  609. #define RSVP_Err_BAD_SNDPORT 8 /* Conflicting Sender port */
  610. #define RSVP_Err_AMBIG_FILTER 9 /* Ambiguous Filter spec in Resv*/
  611. #define RSVP_Err_PREEMPTED 12 /* Service Preempted */
  612. /* Unknown object Class-Num */
  613. #define RSVP_Err_UNKN_OBJ_CLASS 13
  614. /* ErrVal = Class_num, CType */
  615. /* Unknown object C-Type */
  616. #define RSVP_Err_UNKNOWN_CTYPE 14
  617. /* ErrVal = Class_num, CType */
  618. #define RSVP_Err_API_ERROR 20 /* API client error */
  619. /* ErrVal = API error code */
  620. /* Traffic Control error */
  621. #define RSVP_Err_TC_ERROR 21
  622. /* Globally-defined sub-codes for : Traffic Control errors */
  623. #define RSVP_Erv_Conflict_Serv 01 /* Service Conflict */
  624. #define RSVP_Erv_No_Serv 02 /* Unknown Service */
  625. #define RSVP_Erv_Crazy_Flowspec 03 /* Unreasonable Flowspec */
  626. #define RSVP_Erv_Crazy_Tspec 04 /* Unreasonable Tspec */
  627. #define RSVP_Err_TC_SYS_ERROR 22 /* Traffic control system error */
  628. /* ErrVal = kernel error code */
  629. /* RSVP System error */
  630. #define RSVP_Err_RSVP_SYS_ERROR 23
  631. /* Globally-defined sub-codes for : RSVP system errors */
  632. #define RSVP_Erv_MEMORY 1 /* Out of memory */
  633. #define RSVP_Erv_API 2 /* API logic error */
  634. // Identity Policy elements related defines
  635. // Reseved Identity PE types
  636. #define LPM_PE_USER_IDENTITY 2
  637. #define LPM_PE_APP_IDENTITY 3
  638. // Defines for Identity error values
  639. #define ERROR_NO_MORE_INFO 1
  640. #define UNSUPPORTED_CREDENTIAL_TYPE 2
  641. #define INSUFFICIENT_PRIVILEGES 3
  642. #define EXPIRED_CREDENTIAL 4
  643. #define IDENTITY_CHANGED 5
  644. typedef struct {
  645. USHORT usIdErrLength;
  646. UCHAR ucAType;
  647. UCHAR ucSubType;
  648. USHORT usReserved;
  649. USHORT usIdErrorValue;
  650. UCHAR ucIdErrData[4];
  651. } ID_ERROR_OBJECT;
  652. #define ID_ERR_OBJ_HDR_LEN (sizeof(ID_ERROR_OBJECT) - 4 * sizeof(UCHAR) )
  653. /*
  654. LPM API specific definitions
  655. */
  656. /**************************************
  657. LPM_Initialize
  658. ***************************************/
  659. DECLARE_HANDLE(LPM_HANDLE);
  660. DECLARE_HANDLE(RHANDLE);
  661. typedef ULONG LPV;
  662. typedef USHORT PETYPE;
  663. #define LPM_OK 0
  664. typedef int MSG_TYPE;
  665. typedef struct rsvpmsgobjs {
  666. MSG_TYPE RsvpMsgType;
  667. RSVP_SESSION *pRsvpSession;
  668. RSVP_HOP *pRsvpFromHop;
  669. RSVP_HOP *pRsvpToHop;
  670. RESV_STYLE *pResvStyle;
  671. RSVP_SCOPE *pRsvpScope;
  672. int FlowDescCount;
  673. FLOW_DESC *pFlowDescs;
  674. int PdObjectCount;
  675. POLICY_DATA **ppPdObjects;
  676. ERROR_SPEC *pErrorSpec;
  677. ADSPEC *pAdspec;
  678. } RSVP_MSG_OBJS;
  679. #ifdef DBG
  680. typedef void *
  681. (APIENTRY * PALLOCMEM) ( DWORD Size, char *szFileName, DWORD nLine );
  682. #else
  683. typedef void *
  684. (APIENTRY * PALLOCMEM) ( DWORD Size );
  685. #endif
  686. #ifdef DBG
  687. typedef void
  688. (APIENTRY * PFREEMEM) ( void *pv, char *szFileName, DWORD nLine );
  689. #else
  690. typedef void
  691. (APIENTRY * PFREEMEM) ( void *pv );
  692. #endif
  693. typedef struct policy_decision
  694. {
  695. LPV lpvResult; // Use the LPV values from above
  696. WORD wPolicyErrCode; // RSVP defined error codes
  697. WORD wPolicyErrValue; // RSVP defined error values
  698. } POLICY_DECISION;
  699. typedef
  700. ULONG *
  701. (CALLBACK * CBADMITRESULT) (
  702. LPM_HANDLE LpmHandle,
  703. RHANDLE RequestHandle,
  704. ULONG ulPcmActionFlags,
  705. int LpmError,
  706. int PolicyDecisionsCount,
  707. POLICY_DECISION *pPolicyDecisions );
  708. typedef
  709. ULONG *
  710. (CALLBACK * CBGETRSVPOBJECTS) (
  711. LPM_HANDLE LpmHandle,
  712. RHANDLE RequestHandle,
  713. int LpmError,
  714. int RsvpObjectsCount,
  715. RsvpObjHdr **ppRsvpObjects );
  716. // The above 2 call backs can return the following errors
  717. #define INV_LPM_HANDLE 1 // Supplied LpmHandle is invalid
  718. #define LPM_TIME_OUT 2 // LPM has returned results after the time limit
  719. #define INV_REQ_HANDLE 3 // Supplied Request handle is invalid
  720. #define DUP_RESULTS 4 // LPM has already returned results for this request
  721. #define INV_RESULTS 5 // Results supplied are invalid
  722. typedef struct lpminitinfo {
  723. DWORD PcmVersionNumber;
  724. DWORD ResultTimeLimit;
  725. int ConfiguredLpmCount;
  726. PALLOCMEM AllocMemory;
  727. PFREEMEM FreeMemory;
  728. CBADMITRESULT PcmAdmitResultCallback;
  729. CBGETRSVPOBJECTS GetRsvpObjectsCallback;
  730. } LPM_INIT_INFO;
  731. // Valid PE types
  732. // XXX ISSUE - Is 0xFFFF a better choice?
  733. #define LPM_PE_ALL_TYPES 0
  734. // Current LPM API version number
  735. #define LPM_API_VERSION_1 1
  736. // Current PCM version number
  737. #define PCM_VERSION_1 1
  738. ULONG
  739. APIENTRY
  740. LPM_Initialize (
  741. IN LPM_HANDLE LpmHandle,
  742. IN LPM_INIT_INFO *pLpmInitInfo,
  743. OUT DWORD *pLpmVersionNumber,
  744. OUT PETYPE *pSupportedPeType,
  745. OUT VOID *Reserved );
  746. /**************************************
  747. LPM_Deiitialize
  748. ***************************************/
  749. ULONG
  750. APIENTRY
  751. LPM_Deinitialize (
  752. IN LPM_HANDLE LpmHandle );
  753. /**************************************
  754. LPM_AdmitRsvpMsg
  755. ***************************************/
  756. // Valid LPV - LPM Priority Values
  757. #define LPV_RESERVED 0
  758. #define LPV_MIN_PRIORITY 1
  759. #define LPV_MAX_PRIORITY 0xFF00
  760. #define LPV_DROP_MSG 0xFFFD
  761. #define LPV_DONT_CARE 0xFFFE
  762. #define LPV_REJECT 0xFFFF
  763. // Valid values for PcmActionFlags
  764. #define FORCE_IMMEDIATE_REFRESH 1
  765. // Function return values for LPM_AdmitResvMsg
  766. #define LPM_RESULT_READY 0
  767. #define LPM_RESULT_DEFER 1
  768. ULONG
  769. APIENTRY
  770. LPM_AdmitRsvpMsg (
  771. IN RHANDLE PcmReqHandle,
  772. IN RSVP_HOP *pRecvdIntf,
  773. IN RSVP_MSG_OBJS *pRsvpMsgObjs,
  774. IN int RcvdRsvpMsgLength,
  775. IN UCHAR *RcvdRsvpMsg,
  776. OUT ULONG *pulPcmActionFlags,
  777. OUT POLICY_DECISION *pPolicyDecisions,
  778. OUT void *Reserved );
  779. /**************************************
  780. LPM_GetRsvpObjects
  781. ***************************************/
  782. // Function return values are defined in LPM_AdmitResvMsg section
  783. ULONG
  784. APIENTRY
  785. LPM_GetRsvpObjects (
  786. IN RHANDLE PcmReqHandle,
  787. IN ULONG MaxPdSize,
  788. IN RSVP_HOP *SendingIntfAddr,
  789. IN RSVP_MSG_OBJS *pRsvpMsgObjs,
  790. OUT int *pRsvpObjectsCount,
  791. OUT RsvpObjHdr ***pppRsvpObjects,
  792. OUT void *Reserved );
  793. /**************************************
  794. LPM_DeleteState
  795. ***************************************/
  796. // TearDown reasons
  797. #define RCVD_PATH_TEAR 1
  798. #define RCVD_RESV_TEAR 2
  799. #define ADM_CTRL_FAILED 3
  800. #define STATE_TIMEOUT 4
  801. #define FLOW_DURATION 5
  802. VOID
  803. APIENTRY
  804. LPM_DeleteState(
  805. IN RSVP_HOP *pRcvdIfAddr,
  806. IN MSG_TYPE RsvpMsgType,
  807. IN RSVP_SESSION *pRsvpSession,
  808. IN RSVP_HOP *pRsvpFromHop,
  809. IN RESV_STYLE *pResvStyle,
  810. IN int FilterSpecCount,
  811. IN FILTER_SPEC **ppFilterSpecList,
  812. IN int TearDownReason );
  813. /**************************************
  814. LPM_IpAddrTable
  815. ***************************************/
  816. typedef struct lpmiptable {
  817. ULONG ulIfIndex; // SNMP index for this interface
  818. ULONG MediaType; // As defined in IPIFCONS.H
  819. IN_ADDR IfIpAddr; // Interface IP address
  820. IN_ADDR IfNetMask; // Interface subnet mask
  821. } LPMIPTABLE;
  822. BOOL
  823. APIENTRY
  824. LPM_IpAddressTable (
  825. IN ULONG cIpAddrTable,
  826. IN LPMIPTABLE *pIpAddrTable );
  827. /**************************************
  828. LPM_CommitResv
  829. ***************************************/
  830. // CommitDecision values
  831. #define RESOURCES_ALLOCATED 1
  832. #define RESOURCES_MODIFIED 2
  833. VOID
  834. APIENTRY
  835. LPM_CommitResv (
  836. IN RSVP_SESSION *RsvpSession,
  837. IN RSVP_HOP *FlowInstalledIntf,
  838. IN RESV_STYLE *RsvpStyle,
  839. IN int FilterSpecCount,
  840. IN FILTER_SPEC **ppFilterSpecList,
  841. IN IS_FLOWSPEC *pMergedFlowSpec,
  842. IN ULONG CommitDecision );
  843. #ifdef __cplusplus
  844. }
  845. #endif
  846. #endif // __LPMAPI_H_