' ########################################################################################
' Microsoft Windows
' File: alg.inc
' Library name: ALGLib
' Version: 1.0, Locale ID = 0
' Contents: MyICS 1.0 Type Library
' Library GUID: {B6D1D098-E235-4B99-BA98-7C624FD875DB}
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_alg_PBI)
#DEFINE PBX_alg_PBI
%EQUATE `ALG_INC = 1
'/* header files for imported files */
#INCLUDE ONCE "Legacy/COM/OAIdl.inc"
#INCLUDE ONCE "Legacy/COM/OCIdl.inc"
$LIBID_ALGLib = GUID$("{B6D1D098-E235-4B99-BA98-7C624FD875DB}")
' ========================================================================================
' ClsIDs (Class identifiers)
' ========================================================================================
$CLSID_AdapterInfo = GUID$("{6F9942C9-C1B1-4AB5-93DA-6058991DC8F3}")
$CLSID_ApplicationGatewayServices = GUID$("{F8ADE1D3-49DF-4B75-9005-EF9508E6A337}")
$CLSID_DataChannel = GUID$("{BBB36F15-408D-4056-8C27-920843D40BE5}")
$CLSID_EnumAdapterInfo = GUID$("{6F9942CA-C1B1-4AB5-93DA-6058991DC8F3}")
$CLSID_PendingProxyConnection = GUID$("{D8A68E5E-2B37-426C-A329-C117C14C429E}")
$CLSID_PersistentDataChannel = GUID$("{BC9B54AB-7883-4C13-909F-033D03267990}")
$CLSID_PrimaryControlChannel = GUID$("{3CEB5509-C1CD-432F-9D8F-65D1E286AA80}")
$CLSID_SecondaryControlChannel = GUID$("{7B3181A0-C92F-4567-B0FA-CD9A10ECD7D1}")
' ========================================================================================
' IIDs (Interface identifiers)
' ========================================================================================
$IID_IAdapterInfo = GUID$("{480BF94A-09FD-4F8A-A3E0-B0700282D84D}")
$IID_IAdapterNotificationSink = GUID$("{44AB2DC3-23B2-47DE-8228-2E1CCEEB9911}")
$IID_IApplicationGateway = GUID$("{5134842B-FDCE-485D-93CD-DE1640643BBE}")
$IID_IApplicationGatewayServices = GUID$("{5134842A-FDCE-485D-93CD-DE1640643BBE}")
$IID_IDataChannel = GUID$("{AD42D12A-4AD0-4856-919E-E854C91D1856}")
$IID_IEnumAdapterInfo = GUID$("{A23F9D11-714C-41FE-8471-FFB19BC28454}")
$IID_IPendingProxyConnection = GUID$("{B68E5043-3E3D-4CC2-B9C1-5F8F88FEE81C}")
$IID_IPersistentDataChannel = GUID$("{A180E934-D92A-415D-9144-759F8054E8F6}")
$IID_IPrimaryControlChannel = GUID$("{1A2E8B62-9012-4BE6-84AE-32BD66BA657A}")
$IID_ISecondaryControlChannel = GUID$("{A23F9D10-714C-41FE-8471-FFB19BC28454}")
' ========================================================================================
%EQUATE `ALG_MAXIMUM_PORT_RANGE_SIZE = 10
' ========================================================================================
' ALG_PROTOCOL enum
' ========================================================================================
MACRO ALG_PROTOCOL_ENUM = LONG
%EQUATE `eALG_TCP = &H1
%EQUATE `eALG_UDP = &H2
' ========================================================================================
' ALG_CAPTURE enum
' ========================================================================================
MACRO ALG_CAPTURE_ENUM = LONG
%EQUATE `eALG_SOURCE_CAPTURE = &H1
%EQUATE `eALG_DESTINATION_CAPTURE = &H2
' ========================================================================================
' ALG_DIRECTION enum
' ========================================================================================
MACRO ALG_DIRECTION_ENUM = LONG
%EQUATE `eALG_INBOUND = &H1
%EQUATE `eALG_OUTBOUND = &H2
%EQUATE `eALG_BOTH = &H3
' ========================================================================================
' ALG_ADAPTER_TYPE enum
' ========================================================================================
MACRO ALG_ADAPTER_TYPE_ENUM = LONG
%EQUATE `eALG_PRIVATE = &H1
%EQUATE `eALG_BOUNDARY = &H2
%EQUATE `eALG_FIREWALLED = &H4
' ========================================================================================
' ALG_NOTIFICATION enum
' ========================================================================================
MACRO ALG_NOTIFICATION_ENUM = LONG
%EQUATE `eALG_NONE = 0
%EQUATE `eALG_SESSION_CREATION = &H1
%EQUATE `eALG_SESSION_DELETION = &H2
%EQUATE `eALG_SESSION_BOTH = &H3
' ========================================================================================
' ALG_PRIMARY_CHANNEL_PROPERTIES record
' ========================================================================================
' // Size = 28 bytes
TYPE ALG_PRIMARY_CHANNEL_PROPERTIES DWORD
 eProtocol AS ALG_PROTOCOL_ENUM ' ALG_PROTOCOL
 usCapturePort AS WORD ' USHORT
 eCaptureType AS ALG_CAPTURE_ENUM ' ALG_CAPTURE
 fCaptureInbound AS LONG
 ulListeningAddress AS DWORD ' ULONG
 usListeningPort AS WORD ' USHORT
 ulAdapterIndex AS DWORD ' ULONG
END TYPE
' ========================================================================================
' ALG_SECONDARY_CHANNEL_PROPERTIES record
' ========================================================================================
' // Size = 44 bytes
TYPE ALG_SECONDARY_CHANNEL_PROPERTIES DWORD
 eProtocol AS ALG_PROTOCOL_ENUM ' ALG_PROTOCOL
 ulPrivateAddress AS DWORD ' ULONG
 usPrivatePort AS WORD ' USHORT
 ulPublicAddress AS DWORD ' ULONG
 usPublicPort AS WORD ' USHORT
 ulRemoteAddress AS DWORD ' ULONG
 usRemotePort AS WORD ' USHORT
 ulListenAddress AS DWORD ' ULONG
 usListenPort AS WORD ' USHORT
 eDirection AS ALG_DIRECTION_ENUM ' ALG_DIRECTION
 fPersistent AS LONG
END TYPE
' ========================================================================================
' ALG_DATA_CHANNEL_PROPERTIES record
' ========================================================================================
' // Size = 36 bytes
TYPE ALG_DATA_CHANNEL_PROPERTIES DWORD
 eProtocol AS ALG_PROTOCOL_ENUM ' ALG_PROTOCOL
 ulPrivateAddress AS DWORD ' ULONG
 usPrivatePort AS WORD ' USHORT
 ulPublicAddress AS DWORD ' ULONG
 usPublicPort AS WORD ' USHORT
 ulRemoteAddress AS DWORD ' ULONG
 usRemotePort AS WORD ' USHORT
 eDirection AS ALG_DIRECTION_ENUM ' ALG_DIRECTION
 eDesiredNotification AS ALG_NOTIFICATION_ENUM ' ALG_NOTIFICATION
END TYPE
' ========================================================================================
' ALG_PERSISTENT_DATA_CHANNEL_PROPERTIES record
' ========================================================================================
' // Size = 32 bytes
TYPE ALG_PERSISTENT_DATA_CHANNEL_PROPERTIES DWORD
 eProtocol AS ALG_PROTOCOL_ENUM ' ALG_PROTOCOL
 ulPrivateAddress AS DWORD ' ULONG
 usPrivatePort AS WORD ' USHORT
 ulPublicAddress AS DWORD ' ULONG
 usPublicPort AS WORD ' USHORT
 ulRemoteAddress AS DWORD ' ULONG
 usRemotePort AS WORD ' USHORT
 eDirection AS ALG_DIRECTION_ENUM ' ALG_DIRECTION
END TYPE
' ########################################################################################
' Interface name = IAdapterInfo
' IID = {480BF94A-09FD-4F8A-A3E0-B0700282D84D}
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IAdapterInfo_INTERFACE_DEFINED)
 %IAdapterInfo_INTERFACE_DEFINED = 1
INTERFACE IAdapterInfo $IID_IAdapterInfo
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetAdapterIndex ( ' VTable offset = 12
 BYREF pulIndex AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetAdapterType ( ' VTable offset = 16
 BYREF pAdapterType AS ALG_ADAPTER_TYPE_ENUM
 ) AS LONG
 ' =====================================================================================
 METHOD GetAdapterAddresses ( ' VTable offset = 20
 BYREF pulAddressCount AS DWORD
 , BYREF prgAddresses AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IAdapterInfo_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IPendingProxyConnection
' IID = {B68E5043-3E3D-4CC2-B9C1-5F8F88FEE81C}
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IPendingProxyConnection_INTERFACE_DEFINED)
 %IPendingProxyConnection_INTERFACE_DEFINED = 1
INTERFACE IPendingProxyConnection $IID_IPendingProxyConnection
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Cancel ( ' VTable offset = 12
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IPendingProxyConnection_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IDataChannel
' IID = {AD42D12A-4AD0-4856-919E-E854C91D1856}
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IDataChannel_INTERFACE_DEFINED)
 %IDataChannel_INTERFACE_DEFINED = 1
INTERFACE IDataChannel $IID_IDataChannel
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Cancel ( ' VTable offset = 12
 ) AS LONG
 ' =====================================================================================
 METHOD GetChannelProperties ( ' VTable offset = 16
 BYREF ppProperties AS ALG_DATA_CHANNEL_PROPERTIES
 ) AS LONG
 ' =====================================================================================
 METHOD GetSessionCreationEventHandle ( ' VTable offset = 20
 BYREF pHandle AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetSessionDeletionEventHandle ( ' VTable offset = 24
 BYREF pHandle AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IDataChannel_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IPersistentDataChannel
' IID = {A180E934-D92A-415D-9144-759F8054E8F6}
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IPersistentDataChannel_INTERFACE_DEFINED)
 %IPersistentDataChannel_INTERFACE_DEFINED = 1
INTERFACE IPersistentDataChannel $IID_IPersistentDataChannel
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Cancel ( ' VTable offset = 12
 ) AS LONG
 ' =====================================================================================
 METHOD GetChannelProperties ( ' VTable offset = 16
 BYREF ppProperties AS ALG_PERSISTENT_DATA_CHANNEL_PROPERTIES
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IPersistentDataChannel_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IPrimaryControlChannel
' IID = {1A2E8B62-9012-4BE6-84AE-32BD66BA657A}
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IPrimaryControlChannel_INTERFACE_DEFINED)
 %IPrimaryControlChannel_INTERFACE_DEFINED = 1
INTERFACE IPrimaryControlChannel $IID_IPrimaryControlChannel
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Cancel ( ' VTable offset = 12
 ) AS LONG
 ' =====================================================================================
 METHOD GetChannelProperties ( ' VTable offset = 16
 BYREF ppProperties AS ALG_PRIMARY_CHANNEL_PROPERTIES
 ) AS LONG
 ' =====================================================================================
 METHOD GetOriginalDestinationInformation ( ' VTable offset = 20
 BYVAL ulSourceAddress AS DWORD
 , BYVAL usSourcePort AS WORD
 , BYREF pulOriginalDestinationAddress AS DWORD
 , BYREF pusOriginalDestinationPort AS WORD
 , BYREF pulRemapDestinationAddress AS DWORD
 , BYREF pulRemapDestinationPort AS WORD
 , BYREF ppReceiveAdapter AS IAdapterInfo
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IPrimaryControlChannel_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = ISecondaryControlChannel
' IID = {A23F9D10-714C-41FE-8471-FFB19BC28454}
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%ISecondaryControlChannel_INTERFACE_DEFINED)
 %ISecondaryControlChannel_INTERFACE_DEFINED = 1
INTERFACE ISecondaryControlChannel $IID_ISecondaryControlChannel
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Cancel ( ' VTable offset = 12
 ) AS LONG
 ' =====================================================================================
 METHOD GetChannelProperties ( ' VTable offset = 16
 BYREF ppProperties AS ALG_SECONDARY_CHANNEL_PROPERTIES
 ) AS LONG
 ' =====================================================================================
 METHOD GetOriginalDestinationInformation ( ' VTable offset = 20
 BYVAL ulSourceAddress AS DWORD
 , BYVAL usSourcePort AS WORD
 , BYREF pulOriginalDestinationAddress AS DWORD
 , BYREF pusOriginalDestinationPort AS WORD
 , BYREF ppReceiveAdapter AS IAdapterInfo
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __ISecondaryControlChannel_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IEnumAdapterInfo
' IID = {A23F9D11-714C-41FE-8471-FFB19BC28454}
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IEnumAdapterInfo_INTERFACE_DEFINED)
 %IEnumAdapterInfo_INTERFACE_DEFINED = 1
INTERFACE IEnumAdapterInfo $IID_IEnumAdapterInfo
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Next ( ' VTable offset = 12
 BYVAL celt AS DWORD
 , BYREF rgAI AS IAdapterInfo
 , BYREF pCeltFetched AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Skip ( ' VTable offset = 16
 BYVAL celt AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Reset ( ' VTable offset = 20
 ) AS LONG
 ' =====================================================================================
 METHOD Clone ( ' VTable offset = 24
 BYREF ppEnum AS IEnumAdapterInfo
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IEnumAdapterInfo_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IAdapterNotificationSink
' IID = {44AB2DC3-23B2-47DE-8228-2E1CCEEB9911}
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IAdapterNotificationSink_INTERFACE_DEFINED)
 %IAdapterNotificationSink_INTERFACE_DEFINED = 1
INTERFACE IAdapterNotificationSink $IID_IAdapterNotificationSink
 INHERIT IUnknown
 ' =====================================================================================
 METHOD AdapterAdded ( ' VTable offset = 12
 BYVAL pAdapter AS IAdapterInfo
 ) AS LONG
 ' =====================================================================================
 METHOD AdapterRemoved ( ' VTable offset = 16
 BYVAL pAdapter AS IAdapterInfo
 ) AS LONG
 ' =====================================================================================
 METHOD AdapterModified ( ' VTable offset = 20
 BYVAL pAdapter AS IAdapterInfo
 ) AS LONG
 ' =====================================================================================
 METHOD AdapterUpdatePortMapping ( ' VTable offset = 24
 BYVAL pAdapter AS IAdapterInfo
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IAdapterNotificationSink_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IApplicationGatewayServices
' IID = {5134842A-FDCE-485D-93CD-DE1640643BBE}
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IApplicationGatewayServices_INTERFACE_DEFINED)
 %IApplicationGatewayServices_INTERFACE_DEFINED = 1
INTERFACE IApplicationGatewayServices $IID_IApplicationGatewayServices
 INHERIT IUnknown
 ' =====================================================================================
 METHOD CreatePrimaryControlChannel ( ' VTable offset = 12
 BYVAL uAdapterIndex AS DWORD
 , BYVAL eProtocol AS ALG_PROTOCOL_ENUM
 , BYVAL usPortToCapture AS WORD
 , BYVAL eCaptureType AS ALG_CAPTURE_ENUM
 , BYVAL fCaptureInbound AS LONG
 , BYVAL ulListenAddress AS DWORD
 , BYVAL usListenPort AS WORD
 , BYREF ppIControlChannel AS IPrimaryControlChannel
 ) AS LONG
 ' =====================================================================================
 METHOD CreateSecondaryControlChannel ( ' VTable offset = 16
 BYVAL eProtocol AS ALG_PROTOCOL_ENUM
 , BYVAL ulPrivateAddress AS DWORD
 , BYVAL usPrivatePort AS WORD
 , BYVAL ulPublicAddress AS DWORD
 , BYVAL usPublicPort AS WORD
 , BYVAL ulRemoteAddress AS DWORD
 , BYVAL usRemotePort AS WORD
 , BYVAL ulListenAddress AS DWORD
 , BYVAL usListenPort AS WORD
 , BYVAL eDirection AS ALG_DIRECTION_ENUM
 , BYVAL fPersistent AS LONG
 , BYREF ppControlChannel AS ISecondaryControlChannel
 ) AS LONG
 ' =====================================================================================
 METHOD GetBestSourceAddressForDestinationAddress ( ' VTable offset = 20
 BYVAL ulDstAddress AS DWORD
 , BYVAL fDemandDial AS LONG
 , BYREF pulBestSrcAddress AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD PrepareProxyConnection ( ' VTable offset = 24
 BYVAL eProtocol AS ALG_PROTOCOL_ENUM
 , BYVAL ulSrcAddress AS DWORD
 , BYVAL usSrcPort AS WORD
 , BYVAL ulDstAddress AS DWORD
 , BYVAL usDstPort AS WORD
 , BYVAL fNoTimeout AS LONG
 , BYREF ppPendingConnection AS IPendingProxyConnection
 ) AS LONG
 ' =====================================================================================
 METHOD PrepareSourceModifiedProxyConnection ( ' VTable offset = 28
 BYVAL eProtocol AS ALG_PROTOCOL_ENUM
 , BYVAL ulSrcAddress AS DWORD
 , BYVAL usSrcPort AS WORD
 , BYVAL ulDstAddress AS DWORD
 , BYVAL usDstPort AS WORD
 , BYVAL ulNewSrcAddress AS DWORD
 , BYVAL usNewSourcePort AS WORD
 , BYREF ppPendingConnection AS IPendingProxyConnection
 ) AS LONG
 ' =====================================================================================
 METHOD CreateDataChannel ( ' VTable offset = 32
 BYVAL eProtocol AS ALG_PROTOCOL_ENUM
 , BYVAL ulPrivateAddress AS DWORD
 , BYVAL usPrivatePort AS WORD
 , BYVAL ulPublicAddress AS DWORD
 , BYVAL usPublicPort AS WORD
 , BYVAL ulRemoteAddress AS DWORD
 , BYVAL usRemotePort AS WORD
 , BYVAL eDirection AS ALG_DIRECTION_ENUM
 , BYVAL eDesiredNotification AS ALG_NOTIFICATION_ENUM
 , BYVAL fNoTimeout AS LONG
 , BYREF ppDataChannel AS IDataChannel
 ) AS LONG
 ' =====================================================================================
 METHOD CreatePersistentDataChannel ( ' VTable offset = 36
 BYVAL eProtocol AS ALG_PROTOCOL_ENUM
 , BYVAL ulPrivateAddress AS DWORD
 , BYVAL usPrivatePort AS WORD
 , BYVAL ulPublicAddress AS DWORD
 , BYVAL usPublicPort AS WORD
 , BYVAL ulRemoteAddress AS DWORD
 , BYVAL usRemotePort AS WORD
 , BYVAL eDirection AS ALG_DIRECTION_ENUM
 , BYREF ppIPersistentDataChannel AS IPersistentDataChannel
 ) AS LONG
 ' =====================================================================================
 METHOD ReservePort ( ' VTable offset = 40
 BYVAL usPortCount AS WORD
 , BYREF pusReservedPort AS WORD
 ) AS LONG
 ' =====================================================================================
 METHOD ReleaseReservedPort ( ' VTable offset = 44
 BYVAL usReservedPortBase AS WORD
 , BYVAL usPortCount AS WORD
 ) AS LONG
 ' =====================================================================================
 METHOD EnumerateAdapters ( ' VTable offset = 48
 BYREF ppIEnumAdapterInfo AS IEnumAdapterInfo
 ) AS LONG
 ' =====================================================================================
 METHOD StartAdapterNotifications ( ' VTable offset = 52
 BYVAL pSink AS IAdapterNotificationSink
 , BYREF pdwCookie AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD StopAdapterNotifications ( ' VTable offset = 56
 BYVAL dwCookieOfSink AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD LookupAdapterPortMapping ( ' VTable offset = 60
 BYVAL ulAdapterIndex AS DWORD
 , BYVAL Protocol AS BYTE
 , BYVAL ulDestinationAddress AS DWORD
 , BYVAL usDestinationPort AS WORD
 , BYREF pulRemapAddress AS DWORD
 , BYREF pusRemapPort AS WORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IApplicationGatewayServices_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IApplicationGateway
' IID = 5134842B-FDCE-485D-93CD-DE1640643BBE
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IApplicationGateway_INTERFACE_DEFINED)
 %IApplicationGateway_INTERFACE_DEFINED = 1
INTERFACE IApplicationGateway $IID_IApplicationGateway
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Initialize ( ' VTable offset = 12
 BYVAL pAlgServices AS IApplicationGatewayServices
 ) AS LONG
 ' =====================================================================================
 METHOD Stop ( ' VTable offset = 16
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IApplicationGateway_INTERFACE_DEFINED__ */
#ENDIF
