⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jwalpmapi.pas

📁 比较全面的win32api开发包
💻 PAS
📖 第 1 页 / 共 4 页
字号:
{******************************************************************************}
{                                                       	               }
{ Winsock2 RSVP/LPM API interface Unit for Object Pascal                       }
{                                                       	               }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
{ Corporation. All Rights Reserved.                                            }
{ 								               }
{ The original file is: lpmapi.h, released June 2000. The original Pascal      }
{ code is: LpmApi.pas, released December 2000. The initial developer of the    }
{ Pascal code is Marcel van Brakel (brakelm@chello.nl).                        }
{                                                                              }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
{ Marcel van Brakel. All Rights Reserved.                                      }
{ 								               }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
{								               }
{ You may retrieve the latest version of this file at the Project JEDI home    }
{ page, located at http://delphi-jedi.org or my personal homepage located at   }
{ http://members.chello.nl/m.vanbrakel2                                        }
{								               }
{ The contents of this file are used with permission, subject to the Mozilla   }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at      }
{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
{                                                                              }
{ Software distributed under the License is distributed on an "AS IS" basis,   }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License.    }
{                                                                              }
{ Alternatively, the contents of this file may be used under the terms of the  }
{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
{ provisions of the LGPL License are applicable instead of those above.        }
{ If you wish to allow use of your version of this file only under the terms   }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting  the provisions above and  }
{ replace  them with the notice and other provisions required by the LGPL      }
{ License.  If you do not delete the provisions above, a recipient may use     }
{ your version of this file under either the MPL or the LGPL License.          }
{ 								               }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ 								               }
{******************************************************************************}

unit JwaLpmApi;

{$WEAKPACKAGEUNIT}

{$HPPEMIT ''}
{$HPPEMIT '#include "lpmapi.h"'}
{$HPPEMIT ''}

{$I WINDEFINES.INC}

interface

uses
  JwaWinSock2, JwaWinType;

type
  FLOAT = Single;
  {$NODEFINE FLOAT}

(****************************************************************************

            RSVPD -- ReSerVation Protocol Daemon

                USC Information Sciences Institute
                Marina del Rey, California

        Original Version: Shai Herzog, Nov. 1993.
        Current Version:  Steven Berson & Bob Braden, may 1996.

  Copyright (c) 1996 by the University of Southern California
  All rights reserved.

  Permission to use, copy, modify, and distribute this software and its
  documentation in source and binary forms for any purpose and without
  fee is hereby granted, provided that both the above copyright notice
  and this permission notice appear in all copies, and that any
  documentation, advertising materials, and other materials related to
  such distribution and use acknowledge that the software was developed
  in part by the University of Southern California, Information
  Sciences Institute.  The name of the University may not be used to
  endorse or promote products derived from this software without
  specific prior written permission.

  THE UNIVERSITY OF SOUTHERN CALIFORNIA makes no representations about
  the suitability of this software for any purpose.  THIS SOFTWARE IS
  PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
  INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

  Other copyrights might apply to parts of this software and are so
  noted when applicable.

********************************************************************)

(*
 *  Standard format of an RSVP object header
 *)

type
  RsvpObjHdr = record
    obj_length: USHORT; (* Length in bytes *)
    obj_class: UCHAR;   (* Class (values defined below) *)
    obj_ctype: UCHAR;   (* C-Type (values defined below) *)
  end;
  {$EXTERNALSYM RsvpObjHdr}
  TRsvpObjHdr = RsvpObjHdr;
  PRsvpObjHdr = ^RsvpObjHdr;
  PPRsvpObjHdr = ^PRsvpObjHdr;


function ObjLength(const x: TRsvpObjHdr): USHORT;
{$EXTERNALSYM ObjLength}
function ObjCType(const x: TRsvpObjHdr): UCHAR;
{$EXTERNALSYM ObjCType}
function ObjClass(const x: TRsvpObjHdr): UCHAR;
{$EXTERNALSYM ObjClass}
function ObjData(const x: TRsvpObjHdr): Pointer;
{$EXTERNALSYM ObjData}

(*
 *  Define object classes: Class-Num values
 *)

const
  class_NULL            = 0;
  {$EXTERNALSYM class_NULL}
  class_SESSION         = 1;
  {$EXTERNALSYM class_SESSION}
  class_SESSION_GROUP   = 2;
  {$EXTERNALSYM class_SESSION_GROUP}
  class_RSVP_HOP        = 3;
  {$EXTERNALSYM class_RSVP_HOP}
  class_INTEGRITY       = 4;
  {$EXTERNALSYM class_INTEGRITY}
  class_TIME_VALUES     = 5;
  {$EXTERNALSYM class_TIME_VALUES}
  class_ERROR_SPEC      = 6;
  {$EXTERNALSYM class_ERROR_SPEC}
  class_SCOPE           = 7;
  {$EXTERNALSYM class_SCOPE}
  class_STYLE           = 8;
  {$EXTERNALSYM class_STYLE}
  class_FLOWSPEC        = 9; // these two are the same
  {$EXTERNALSYM class_FLOWSPEC}
  class_IS_FLOWSPEC     = 9; // since we added IS in front of the name
  {$EXTERNALSYM class_IS_FLOWSPEC}
  class_FILTER_SPEC     = 10;
  {$EXTERNALSYM class_FILTER_SPEC}
  class_SENDER_TEMPLATE = 11;
  {$EXTERNALSYM class_SENDER_TEMPLATE}
  class_SENDER_TSPEC    = 12;
  {$EXTERNALSYM class_SENDER_TSPEC}
  class_ADSPEC          = 13;
  {$EXTERNALSYM class_ADSPEC}
  class_POLICY_DATA     = 14;
  {$EXTERNALSYM class_POLICY_DATA}
  class_CONFIRM         = 15;
  {$EXTERNALSYM class_CONFIRM}
  class_MAX             = 15;
  {$EXTERNALSYM class_MAX}

(*
 *  RSVP SESSION object
 *)

  ctype_SESSION_ipv4    = 1;
  {$EXTERNALSYM ctype_SESSION_ipv4}
  ctype_SESSION_ipv4GPI = 3   (* IPSEC: Generalized Port Id *);
  {$EXTERNALSYM ctype_SESSION_ipv4GPI}

  SESSFLG_E_Police = $01    (* E_Police: Entry policing flag*);
  {$EXTERNALSYM SESSFLG_E_Police}

type
  Session_IPv4 = record
    sess_destaddr: IN_ADDR;  // DestAddress
    sess_protid: UCHAR;    // Protocol Id
    sess_flags: UCHAR;     // Use the flags defined above
    sess_destport: USHORT;  // DestPort
  end;
  {$EXTERNALSYM Session_IPv4}
  TSessionIPv4 = Session_IPv4;
  PSessionIPv4 = ^Session_IPv4;

(*    GPI versions have virtual dest port instead of dest port; this
 *    changes the interpretation but not the format, so we do not
 *    define new structs for GPI.
 *)

  RSVP_SESSION = record
    sess_header: RsvpObjHdr;
    case Integer of
      0: (sess_ipv4: Session_IPv4);
  end;
  {$EXTERNALSYM RSVP_SESSION}
  TRsvpSession = RSVP_SESSION;
  PRsvpSession = ^RSVP_SESSION;  

// Useful defines to access components of SESSION obect

//#define Sess4Addr       sess_u.sess_ipv4.sess_destaddr
//#define Sess4Port       sess_u.sess_ipv4.sess_destport
//#define Sess4Protocol   sess_u.sess_ipv4.sess_protid
//#define Sess4Flags      sess_u.sess_ipv4.sess_flags

(*
 *  RSVP HOP object
 *)

const
  ctype_RSVP_HOP_ipv4 = 1;
  {$EXTERNALSYM ctype_RSVP_HOP_ipv4}

type
  Rsvp_Hop_IPv4 = record
    hop_ipaddr: IN_ADDR;   // Next/Previous Hop Address
    hop_LIH: ULONG;        // Logical Interface Handle
  end;
  {$EXTERNALSYM Rsvp_Hop_IPv4}
  TRsvpHopIPv4 = Rsvp_Hop_IPv4;
  PRsvpHopIPv4 = ^Rsvp_Hop_IPv4;

  RSVP_HOP = record
    hop_header: RsvpObjHdr;
    case Integer of
      0: (hop_ipv4: Rsvp_Hop_IPv4);
  end;
  {$EXTERNALSYM RSVP_HOP}
  TRsvpHop = RSVP_HOP;
  PRsvpHop = ^RSVP_HOP;

//#define Hop4LIH    hop_u.hop_ipv4.hop_LIH
//#define Hop4Addr   hop_u.hop_ipv4.hop_ipaddr

(*
 *  RSVP STYLE object
 *)

//  Define values for option vector

const
  Opt_Share_mask = $00000018; // 2 bits: Sharing control
  {$EXTERNALSYM Opt_Share_mask}
  Opt_Distinct   = $00000008; // Distinct reservations
  {$EXTERNALSYM Opt_Distinct}
  Opt_Shared     = $00000010; // Shared reservations
  {$EXTERNALSYM Opt_Shared}

  Opt_SndSel_mask = $00000007; // 3 bits: Sender selection
  {$EXTERNALSYM Opt_SndSel_mask}
  Opt_Wildcard    = $00000001; // Wildcard scope
  {$EXTERNALSYM Opt_Wildcard}
  Opt_Explicit    = $00000002; // Explicit scope
  {$EXTERNALSYM Opt_Explicit}

function Style_is_Wildcard(p: DWORD): Boolean;
{$EXTERNALSYM Style_is_Wildcard}
function Style_is_Shared(p: DWORD): Boolean;
{$EXTERNALSYM Style_is_Shared}

//  Define style values

const
  STYLE_WF = Opt_Shared + Opt_Wildcard;
  {$EXTERNALSYM STYLE_WF}
  STYLE_FF = Opt_Distinct + Opt_Explicit;
  {$EXTERNALSYM STYLE_FF}
  STYLE_SE = Opt_Shared + Opt_Explicit;
  {$EXTERNALSYM STYLE_SE}

  ctype_STYLE = 1;
  {$EXTERNALSYM ctype_STYLE}

type
  RESV_STYLE = record
    style_header: RsvpObjHdr;
    style_word: ULONG;
  end;
  {$EXTERNALSYM RESV_STYLE}
  TResvStyle = RESV_STYLE;
  PResvStyle = ^RESV_STYLE;

(*
 *  RSVP FILTER SPEC object
 *)

const
  ctype_FILTER_SPEC_ipv4    = 1; // IPv4 FILTER_SPEC
  {$EXTERNALSYM ctype_FILTER_SPEC_ipv4}
  ctype_FILTER_SPEC_ipv4GPI = 4; // IPv4/GPI FILTER_SPEC
  {$EXTERNALSYM ctype_FILTER_SPEC_ipv4GPI}

type
  Filter_Spec_IPv4 = record
    filt_ipaddr: IN_ADDR;    // IPv4 SrcAddress
    filt_unused: USHORT;
    filt_port: USHORT;       // SrcPort
  end;
  {$EXTERNALSYM Filter_Spec_IPv4}
  TFilterSpecIPv4 = Filter_Spec_IPv4;
  PFilterSpecIPv4 = ^Filter_Spec_IPv4;

  Filter_Spec_IPv4GPI = record
    filt_ipaddr: IN_ADDR;    // IPv4 SrcAddress
    filt_gpi: ULONG;         // Generalized Port Id
  end;
  {$EXTERNALSYM Filter_Spec_IPv4GPI}
  TFilterSpecIPv4GPI = Filter_Spec_IPv4GPI;
  PFilterSpecIPv4GPI = ^Filter_Spec_IPv4GPI;

  FILTER_SPEC = record
    filt_header: RsvpObjHdr;
    case Integer of
      0: (filt_ipv4: Filter_Spec_IPv4);
      1: (filt_ipv4gpi: Filter_Spec_IPv4GPI);
  end;
  {$EXTERNALSYM FILTER_SPEC}
  TFilterSpec = FILTER_SPEC;
  PFilterSpec = ^FILTER_SPEC;  

//#define FilterSrcaddr   filt_u.filt_ipv4.filt_ipaddr
//#define FilterSrcport   filt_u.filt_ipv4.filt_port

(*
 *  RSVP SENDER_TEMPLATE object
 *)

const
  ctype_SENDER_TEMPLATE_ipv4    = 1; // IPv4 SENDER_TEMPLATE
  {$EXTERNALSYM ctype_SENDER_TEMPLATE_ipv4}
  ctype_SENDER_TEMPLATE_ipv4GPI = 4; // IPv4/GPI SENDER_TEMPLATE
  {$EXTERNALSYM ctype_SENDER_TEMPLATE_ipv4GPI}

type
  SENDER_TEMPLATE = FILTER_SPEC;       // Identical to FILTER_SPEC
  {$EXTERNALSYM SENDER_TEMPLATE}
  TSenderTemplate = SENDER_TEMPLATE;
  PSenderTemplate = ^SENDER_TEMPLATE;

(*
 *  RSVP SCOPE object class
 *)

const
  ctype_SCOPE_list_ipv4 = 1;
  {$EXTERNALSYM ctype_SCOPE_list_ipv4}

type
  Scope_list_ipv4 = record
    scopl_ipaddr: array [0..0] of IN_ADDR;        // var-len list of IP sender addrs
  end;
  {$EXTERNALSYM Scope_list_ipv4}
  TScopeListIPv4 = Scope_list_ipv4;
  PScopeListIPv4 = ^Scope_list_ipv4;

  RSVP_SCOPE = record
    scopl_header: RsvpObjHdr;
    case Integer of
      0: (scopl_ipv4: Scope_list_ipv4);
  end;
  {$EXTERNALSYM RSVP_SCOPE}
  TRsvpScope = RSVP_SCOPE;
  PRsvpScope = ^RSVP_SCOPE;

//#define Scope4Addr      scope_u.scopl_ipv4.scopl_ipaddr
//#define ScopeCnt(scp)   ((ObjLength(scp)-sizeof(RsvpObjHdr))/sizeof(struct in_addr))
//#define ScopeLen(cnt)   (cnt*sizeof(struct in_addr)+sizeof(RsvpObjHdr))

(*
 *  ERROR_SPEC object class
 *)

const
  ctype_ERROR_SPEC_ipv4 = 1;
  {$EXTERNALSYM ctype_ERROR_SPEC_ipv4}

  ERROR_SPECF_InPlace = $01;    (*   Left resv in place     *)
  {$EXTERNALSYM ERROR_SPECF_InPlace}
  ERROR_SPECF_NotGuilty = $02;    (*   This rcvr not guilty   *)
  {$EXTERNALSYM ERROR_SPECF_NotGuilty}
  ERR_FORWARD_OK  = $8000;      (* Flag: OK to forward state *)
  {$EXTERNALSYM ERR_FORWARD_OK}

function Error_Usage(x: DWORD): DWORD;
{$EXTERNALSYM Error_Usage}

const
  ERR_Usage_globl = $00;        (* Globally-defined sub-code *)
  {$EXTERNALSYM ERR_Usage_globl}
  ERR_Usage_local = $10;        (* Locally-defined sub-code *)
  {$EXTERNALSYM ERR_Usage_local}
  ERR_Usage_serv  = $11;        (* Service-defined sub-code *)
  {$EXTERNALSYM ERR_Usage_serv}
  ERR_global_mask = $0fff;      (* Sub-code bits in Error Val *)
  {$EXTERNALSYM ERR_global_mask}

type
  Error_Spec_IPv4 = record
    errs_errnode: in_addr;   (* Error Node Address       *)
    errs_flags: u_char;      (* Flags:           *)
    errs_code: UCHAR;        (* Error Code (def'd below) *)
    errs_value: USHORT;      (* Error Value      *)
  end;
  {$EXTERNALSYM Error_Spec_IPv4}
  TErrorSpecIPv4 = Error_Spec_IPv4;
  PErrorSpecIPv4 = ^Error_Spec_IPv4;

type
  ERROR_SPEC = record
    errs_header: RsvpObjHdr;
    case Integer of
      0: (errs_ipv4: Error_Spec_IPv4);
  end;
  {$EXTERNALSYM ERROR_SPEC}
  TErrorSpec = ERROR_SPEC;
  PErrorSpec = ^ERROR_SPEC;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -