jwawshisotp.pas 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. {******************************************************************************}
  2. { }
  3. { Winsock2 ISO TP4 API interface Unit for Object Pascal }
  4. { }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
  6. { Corporation. All Rights Reserved. }
  7. { }
  8. { The original file is: wshisotp.h, released June 2000. The original Pascal }
  9. { code is: WShisotp.pas, released December 2000. The initial developer of the }
  10. { Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
  11. { }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
  13. { Marcel van Brakel. All Rights Reserved. }
  14. { }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  16. { }
  17. { You may retrieve the latest version of this file at the Project JEDI }
  18. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  19. { }
  20. { The contents of this file are used with permission, subject to the Mozilla }
  21. { Public License Version 1.1 (the "License"); you may not use this file except }
  22. { in compliance with the License. You may obtain a copy of the License at }
  23. { http://www.mozilla.org/MPL/MPL-1.1.html }
  24. { }
  25. { Software distributed under the License is distributed on an "AS IS" basis, }
  26. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  27. { the specific language governing rights and limitations under the License. }
  28. { }
  29. { Alternatively, the contents of this file may be used under the terms of the }
  30. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  31. { provisions of the LGPL License are applicable instead of those above. }
  32. { If you wish to allow use of your version of this file only under the terms }
  33. { of the LGPL License and not to allow others to use your version of this file }
  34. { under the MPL, indicate your decision by deleting the provisions above and }
  35. { replace them with the notice and other provisions required by the LGPL }
  36. { License. If you do not delete the provisions above, a recipient may use }
  37. { your version of this file under either the MPL or the LGPL License. }
  38. { }
  39. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  40. { }
  41. {******************************************************************************}
  42. unit JwaWShisotp;
  43. {$WEAKPACKAGEUNIT}
  44. {$HPPEMIT ''}
  45. {$HPPEMIT '#include "wshisotp.h"'}
  46. {$HPPEMIT ''}
  47. {$I jediapilib.inc}
  48. interface
  49. uses
  50. JwaWinSock2;
  51. //
  52. // wshisotp.h
  53. // Copyright (c) 1994-1999, Microsoft Corp. All rights reserved.
  54. //
  55. // Windows Sockets include file for ISO TP4. This file contains all
  56. // standardized ISO TP4 information. Include this header file after
  57. // winsock.h.
  58. //
  59. // The information contained in this header file was originally
  60. // created by Alcatel TITN Inc.
  61. //
  62. //
  63. // Protocol values for ISO transport protocols.
  64. //
  65. const
  66. ISOPROTO_TP0 = 25; // connection orientated transport protocol
  67. {$EXTERNALSYM ISOPROTO_TP0}
  68. ISOPROTO_TP1 = 26; // not implemented
  69. {$EXTERNALSYM ISOPROTO_TP1}
  70. ISOPROTO_TP2 = 27; // not implemented
  71. {$EXTERNALSYM ISOPROTO_TP2}
  72. ISOPROTO_TP3 = 28; // not implemented
  73. {$EXTERNALSYM ISOPROTO_TP3}
  74. ISOPROTO_TP4 = 29; // connection orientated transport protocol
  75. {$EXTERNALSYM ISOPROTO_TP4}
  76. ISOPROTO_TP = ISOPROTO_TP4;
  77. {$EXTERNALSYM ISOPROTO_TP}
  78. ISOPROTO_CLTP = 30; // connectionless transport
  79. {$EXTERNALSYM ISOPROTO_CLTP}
  80. ISOPROTO_CLNP = 31; // connectionless internetworking protocol
  81. {$EXTERNALSYM ISOPROTO_CLNP}
  82. ISOPROTO_X25 = 32; // cons
  83. {$EXTERNALSYM ISOPROTO_X25}
  84. ISOPROTO_INACT_NL = 33; // inactive network layer
  85. {$EXTERNALSYM ISOPROTO_INACT_NL}
  86. ISOPROTO_ESIS = 34; // ES-IS protocol
  87. {$EXTERNALSYM ISOPROTO_ESIS}
  88. ISOPROTO_INTRAISIS = 35; // IS-IS protocol
  89. {$EXTERNALSYM ISOPROTO_INTRAISIS}
  90. IPPROTO_RAW = 255; // raw clnp
  91. {$EXTERNALSYM IPPROTO_RAW}
  92. IPPROTO_MAX = 256;
  93. {$EXTERNALSYM IPPROTO_MAX}
  94. //
  95. // The maximum size of the tranport address (tp_addr field of a
  96. // sockaddr_tp structure) is 64.
  97. //
  98. const
  99. ISO_MAX_ADDR_LENGTH = 64;
  100. {$EXTERNALSYM ISO_MAX_ADDR_LENGTH}
  101. //
  102. // There are two types of ISO addresses, hierarchical and
  103. // non-hierarchical. For hierarchical addresses, the tp_addr
  104. // field contains both the transport selector and the network
  105. // address. For non-hierarchical addresses, tp_addr contains only
  106. // the transport address, which must be translated by the ISO TP4
  107. // transport provider into the transport selector and network address.
  108. //
  109. const
  110. ISO_HIERARCHICAL = 0;
  111. {$EXTERNALSYM ISO_HIERARCHICAL}
  112. ISO_NON_HIERARCHICAL = 1;
  113. {$EXTERNALSYM ISO_NON_HIERARCHICAL}
  114. //
  115. // The format of the address structure (sockaddr) to pass to Windows
  116. // Sockets APIs.
  117. //
  118. type
  119. SOCKADDR_TP = record
  120. tp_family: u_short; // Always AF_ISO
  121. tp_addr_type: u_short; // ISO_HIERARCHICAL or ISO_NON_HIERARCHICAL
  122. tp_taddr_len: u_short; // Length of transport address, <= 52
  123. tp_tsel_len: u_short; // Length of transport selector, <= 32 0 if ISO_NON_HIERARCHICAL
  124. tp_addr: array [0..ISO_MAX_ADDR_LENGTH - 1] of u_char;
  125. end;
  126. {$EXTERNALSYM SOCKADDR_TP}
  127. PSOCKADDR_TP = ^SOCKADDR_TP;
  128. {$EXTERNALSYM PSOCKADDR_TP}
  129. LPSOCKADDR_TP = ^SOCKADDR_TP;
  130. {$EXTERNALSYM LPSOCKADDR_TP}
  131. TSockAddrTP = SOCKADDR_TP;
  132. PSockAddrTP = LPSOCKADDR_TP;
  133. //procedure ISO_SET_TP_ADDR(var sa_tp: TSockAddrTP; port: PChar; portlen: u_short; node: PChar; nodelen: u_short);
  134. //{$EXTERNALSYM ISO_SET_TP_ADDR}
  135. //
  136. // Expedited Data Usage Negotiation option.
  137. // Default when the option is not present is be EXP_DATA_USE
  138. // as per ISO 8073
  139. //
  140. const
  141. ISO_EXP_DATA_USE = 00; // Use of Expedited Data
  142. {$EXTERNALSYM ISO_EXP_DATA_USE}
  143. ISO_EXP_DATA_NUSE = 01; // Non-use of Expedited Data
  144. {$EXTERNALSYM ISO_EXP_DATA_NUSE}
  145. implementation
  146. // TODO
  147. //procedure ISO_SET_TP_ADDR(var sa_tp: TSockAddrTP; port: PChar; portlen: u_short; node: PChar; nodelen: u_short);
  148. //begin
  149. // sa_tp.tp_family := AF_ISO;
  150. // sa_tp.tp_addr_type := ISO_HIERARCHICAL;
  151. // sa_tp.tp_tsel_len := portlen;
  152. // sa_tp.tp_taddr_len := portlen + nodelen;
  153. // System.Move(port, @sa_tp.tp_addr[0], portlen);
  154. // System.Move(node, @sa_tp.tp_addr[portlen], nodelen);
  155. //end;
  156. end.