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

📄 rtcinfo.pas

📁 Delphi快速开发Web Server
💻 PAS
📖 第 1 页 / 共 5 页
字号:
{
  @html(<b>)
  Information Objects
  @html(</b>)
  - Copyright (c) Danijel Tkalcec
  @html(<br><br>)

  This unit defines easy-to-use helper classes for handling user-defined
  data structures (native Values, Arrays, Records, DataSets, etc) with RTC components.
}
unit rtcInfo;

{$INCLUDE rtcDefs.inc}

interface

uses
  Windows,
  Classes,
  SysUtils,

  {$IFNDEF IDE_1}
  Variants,
  {$ELSE}
  FileCtrl,
  {$ENDIF}

  rtcFastStrings,
  memStrObjList;

var
  // Full Name of the application or extension in which RTC is running.
  AppFileName:string='';

  { Default memory cache size when accepting FormPost data (Param property).
    When cache memory is full, data will start being written to a temporary file,
    to reduce memory usage. This temporary file is created and deleted automaticaly by RTC,
    to keep the usage of the Param property simple. }
  RTC_FORMPOST_CACHESIZE:integer=16000;

{$IFDEF COMPRESS}
  { Minimum data size to be compressed when using automatic compression/decompression.
    Data smaller than this size will not be compressed, to reduce the CPU usage.
    Default value is 246, values smaller than 32 will only increase the CPU usage
    without having any other effect, since very small data chunks can not be compressed
    (there are at least 10 bytes of header information needed in compressed data). }
  RTC_MIN_COMPRESS_SIZE:integer=256;
{$ENDIF}

const
  // Member name used in XML-RPC <struct> to enumerate DataSet Fields
  RTC_XMLRPC_DataSetFieldsName='RTC.DATASET.FIELDS';
  // Member name used in XML-RPC <struct> to enumerate DataSet Rows
  RTC_XMLRPC_DataSetRowsName='RTC.DATASET.ROWS';
  // XML-RPC field name used when sending params to a function as an array rather than a record
  RTC_XMLRPC_ParamsAsArrayName='PARAMS';

type
{$IFDEF COMPRESS}
  TRtcCompressLevel = (// no compression
                       cNone,
                       // fastest compression (low compress rate)
                       cFast,
                       // default compression
                       cDefault,
                       // maximum compression (slow)
                       cMax);
{$ENDIF}

  TRtcCertStoreType = (// Accept any certificate (Ignore certificate errors)
                       certAny,
                       // Do not use any certificates
                       certNone,
                       // Certification Authority certificates
                       certCA,
                       // A certificate store that holds certificates with associated private keys
                       certMY,
                       // Root Certificates
                       certROOT,
                       // Software Publisher Certificates
                       certSPC);

  TRtcFileAccessMode= (// Allow other apps to read and write to the same file
                       rtc_ShareDenyNone,
                       // Allow other apps to read, but not to write to the file
                       rtc_ShareDenyWrite,
                       // Deny all access to the file - exclusive access mode!
                       rtc_ShareExclusive);

  TRtcValueTypes = (// No value assigned
                    rtc_Null,
                    // variable name: Check local or Session variables for a result
                    rtc_Variable,
                    // Function call (Function will be called to get a result)
                    rtc_Function,
                    // Exception message (returned as a Result from a function call which ended in an exception being raised)
                    rtc_Exception,
                    // Array (starting from index 0)
                    rtc_Array,
                    // Record
                    rtc_Record,
                    // DataSet
                    rtc_DataSet,
                    // Text value (String that has to be automaticaly coded and encoded using UTF-8)
                    rtc_Text,
                    // String value (strings up to 2GB)
                    rtc_String,
                    // Wide String value (wide strings up to 2GB)
                    rtc_WideString,
                    // Boolean value
                    rtc_Boolean,
                    // Integer value
                    rtc_Integer,
                    // Large Integer value (int64)
                    rtc_LargeInt,
                    // Floating-point value (double)
                    rtc_Float,
                    // Currency value
                    rtc_Currency,
                    // Date and Time value
                    rtc_DateTime,
                    // Byte Stream
                    rtc_ByteStream,
                    // Any Type
                    rtc_Variant);

  TRtcDataFormat = ( // The best format for communicating between RTC Clients and Servers
                     fmt_RTC,
                     // XML-RPC format: makes it possible to communicate with non-RTC Clients and Servers
                     fmt_XMLRPC);

  TRtcDataFormatSupport = set of TRtcDataFormat;

  TRtcFieldTypes = ( ft_Unknown, ft_String, ft_Smallint, ft_Integer, ft_Word,
                     ft_Boolean, ft_Float, ft_Currency, ft_BCD, ft_Date, ft_Time, ft_DateTime,
                     ft_Bytes, ft_VarBytes, ft_AutoInc, ft_Blob, ft_Memo, ft_Graphic, ft_FmtMemo,
                     ft_ParadoxOle, ft_DBaseOle, ft_TypedBinary, ft_Cursor, ft_FixedChar, ft_WideString,
                     ft_Largeint, ft_ADT, ft_Array, ft_Reference, ft_DataSet, ft_OraBlob, ft_OraClob,
                     ft_Variant, ft_Interface, ft_IDispatch, ft_Guid, ft_TimeStamp, ft_FMTBcd);

  { @abstract(Session lock type) }
  TRtcSessionLockType=({ Allow access to anyone. No client data will be used for identifying clients,
                         which means that any client knowing which Session IDs are open,
                         will have access to those sessions, regardless of its IP address or other header values.
                         @html(<br><br>)
                         This setting is not recommended for Servers available on the Internet. }
                       sesNoLock,
                       { Allow access to an opened Session only to Clients coming from
                         the same IP as the client which has created the session.
                         @html(<br><br>)
                         This setting is not recommended for Web Applications which need to be accessible
                         by anyone, since people behind proxy servers with changing IP addresses will not
                         be able to "stay logged in" (when their IP changes, they will lose access to their Session). }
                       sesIPLock,
                       { This is the default Session Lock setting, which should work for all clients.
                         It will provide maximum security for clients which are NOT behind a proxy server,
                         while still allowing access to clients behind proxy servers with changing IP addresses
                         (the "X-FORWARDED-FOR" header has to be set by the proxy forwarding client requests).
                         @html(<br><br>)
                         If the client opening the Session had the "X-FORWARDED-FOR" header set,
                         any client with the same "X-FORWARDED-FOR" header will be allowed access to his Session
                         (it just has to use the same Session ID as the client which has opened/created the session).
                         If "X-FORWARDER-FOR" header was not set by the client creating the session,
                         Peer IP address will be used for client identification. }
                       sesFwdLock,
                       { Session will always be locked to the Peer IP address,
                         *plus* to the "X-FORWARDED-FOR" request header,
                         if it was set for the client which has opened the session.
                         @html(<br><br>)
                         This setting is not recommended for Web Applications which need to be accessible
                         to a wide public audience, since people behind proxy servers with changing IP addresses
                         will NOT be able to "stay logged in". When their IP address changes,
                         they will lose access to their Session data and need to log in again. }
                       sesIPFwdLock);

const
  // @exclude
  RTC_FIELD2VALUE_TYPES: array[TRtcFieldTypes] of TRtcValueTypes =
                   ( rtc_NULL, // ft_Unknown
                     rtc_String, // ft_String
                     rtc_Integer, // ft_Smallint
                     rtc_Integer, // ft_Integer
                     rtc_Integer, // ft_Word
                     rtc_Boolean, // ft_Boolean
                     rtc_Float, // ft_Float
                     rtc_Currency, // ft_Currency
                     rtc_Currency, // ft_BCD
                     rtc_DateTime, // ft_Date
                     rtc_DateTime, // ft_Time
                     rtc_DateTime, // ft_DateTime
                     rtc_String, // ft_Bytes
                     rtc_String, // ft_VarBytes,
                     rtc_Integer, // ft_AutoInc
                     rtc_String, // ft_Blob
                     rtc_String, // ft_Memo
                     rtc_String, // ft_Graphic
                     rtc_String, // ft_FmtMemo
                     rtc_String, // ft_ParadoxOle
                     rtc_String, // ft_DBaseOle
                     rtc_String, // ft_TypedBinary
                     rtc_NULL, // ft_Cursor
                     rtc_String, // ft_FixedChar
                     rtc_WideString, // ft_WideString
                     rtc_LargeInt, // ft_Largeint
                     rtc_Record, // ft_ADT
                     rtc_Array, // ft_Array
                     rtc_Record, // ft_Reference
                     rtc_DataSet, // ft_DataSet
                     rtc_String, // ft_OraBlob,
                     rtc_String, // ft_OraClob,
                     rtc_String, // ft_Variant
                     rtc_String, // ft_Interface
                     rtc_String, // ft_IDispatch,
                     rtc_String, // ft_Guid,
                     rtc_DateTime, // ft_TimeStamp
                     rtc_Currency); // ft_FMTBcd

  // @exclude
  RTC_TYPE2STR_CONV: array[TRtcValueTypes] of string =
                  ( 'X', // rtc_Null,
                    'V', // rtc_Variable,
                    'FC', // rtc_Function,
                    'E', // rtc_Exception,
                    'AR', // rtc_Array,
                    'RE', // rtc_Record,
                    'DS', // rtc_DataSet,
                    'T', // rtc_Text,
                    'S', // rtc_String,
                    'W', // rtc_WideString,
                    'B', // rtc_Boolean,
                    'I', // rtc_Integer,
                    'L', // rtc_LargeInt,
                    'F', // rtc_Float,
                    'C', // rtc_Currency,
                    'D', // rtc_DateTime,
                    'BS', //rtc_ByteStream
                    '');

  RTC_TYPE2FULLNAME_CONV: array[TRtcValueTypes] of string =
                  ( 'Null', // rtc_Null,
                    'Variable', // rtc_Variable,
                    'FunctionCall', // rtc_Function,
                    'Exception', // rtc_Exception,
                    'Array', // rtc_Array,
                    'Record', // rtc_Record,
                    'DataSet', // rtc_DataSet,
                    'Text', // rtc_Text,
                    'String', // rtc_String,
                    'WideString', // rtc_WideString,
                    'Boolean', // rtc_Boolean,
                    'Integer', // rtc_Integer,
                    'LargeInt', // rtc_LargeInt,
                    'Float', // rtc_Float,
                    'Currency', // rtc_Currency,
                    'DateTime', // rtc_DateTime,
                    'ByteStream', //rtc_ByteStream
                    'Variant');

  // @exclude
  RTC_FIELD2STR_CONV: array[TRtcFieldTypes] of string =
                   ('U', // ft_Unknown: Result:='U';
                    'S', // ft_String: Result:='S';
                    'SI', // ft_Smallint: Result:='SI';
                    'I', // ft_Integer: Result:='I';
                    'WI', // ft_Word: Result:='WI';
                    'B', // ft_Boolean: Result:='B';
                    'F', // ft_Float: Result:='F';
                    'C', // ft_Currency: Result:='C';
                    'BC', // ft_BCD: Result:='BC';
                    'DD', // ft_Date: Result:='DD';
                    'T', // ft_Time: Result:='T';
                    'D', // ft_DateTime: Result:='D';
                    'BY', // ft_Bytes: Result:='BY';
                    'VB', // ft_VarBytes: Result:='VB';
                    'AI', // ft_AutoInc: Result:='AI';
                    'O', // ft_Blob: Result:='O';
                    'M', // ft_Memo: Result:='M';
                    'G', // ft_Graphic: Result:='G';
                    'FM', // ft_FmtMemo: Result:='FM';
                    'PO', // ft_ParadoxOle: Result:='PO';
                    'DO', // ft_DBaseOle: Result:='DO';
                    'TB', // ft_TypedBinary: Result:='TB';
                    'CU', // ft_Cursor: Result:='CU';
                    'FC', // ft_FixedChar: Result:='FC';
                    'W', // ft_WideString: Result:='W';
                    'L', // ft_Largeint: Result:='L';
                    'AD', // ft_ADT: Result:='AD';
                    'AR', // ft_Array: Result:='AR';
                    'RF', // ft_Reference: Result:='RF';
                    'DS', // ft_DataSet: Result:='DS';
                    'OB', // ft_OraBlob: Result:='OB';
                    'OC', // ft_OraClob: Result:='OC';
                    'V', // ft_Variant: Result:='V';
                    'IT', // ft_Interface: Result:='IT';
                    'ID', // ft_IDispatch: Result:='ID';
                    'GU', // ft_Guid: Result:='GU';
                    'DT', // ft_TimeStamp: Result:='DT';
                    'FB'); // ft_FMTBcd: Result:='FB';

  // @exclude
  RTC_VALUE2FIELD_TYPES: array[TRtcValueTypes] of TRtcFieldTypes  =
                   (ft_Unknown, // rtc_Null
                    ft_Unknown, // rtc_Variable
                    ft_Unknown, // rtc_Function
                    ft_String, // rtc_Exception

⌨️ 快捷键说明

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