home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / spxspc.exe / SPX.DOC next >
Text File  |  1994-11-22  |  85KB  |  2,215 lines

  1. NetWare SPX Services
  2.  
  3. Specification, Semantics and API
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10. Revision:  1.00
  11.  
  12. Date:  February 9, 1993
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31. Unpublished Copyright⌐,  Novell, Inc.  All Rights Reserved
  32.  
  33. No part of this document may be duplicated, revised, translated, localized 
  34. or modified in any manner or uploaded or downloaded to or from any 
  35. computer system without the prior written consent of Novell, Inc.
  36.  
  37.  
  38. This document is the property of Novell, Inc.  It is intended for the 
  39. internal use of Novell only.  This document is not to be construed as a 
  40. promise by Novell to develop a particular product.   Novell specifically 
  41. disclaims any promise to deliver a product conforming to the 
  42. specifications contained herein.
  43.  
  44.  
  45. Preface
  46.  
  47. This manual provides a complete protocol reference for the SPX 
  48. implementer.  It consists of the SPX reference manual plus annotations.
  49.  
  50. The SPX reference manual alone provides a complete definition of SPX, but 
  51. the terse reference manual style leaves many reasonable questions 
  52. unanswered.  Discussions of why certain features are defined the way they 
  53. are, and how one might implement some particular feature have no place in 
  54. a reference manual, but are of interest to most implementers.  Such 
  55. discussions are presented as annotations.
  56.  
  57. Organization
  58. The SPX reference manual consists of main sections which form the chapters 
  59. of this manual.  The reference manual proper is presented in 11 point 
  60. Times New Roman font.
  61.  
  62. _ Embedded annotations are presented in 9 point Arial, indented and 
  63. bracketed by a solid and an open square box, like this sentence. _
  64.  
  65. Acknowledgements
  66. SPX could not have been developed without the use, suggestions, and 
  67. constructive criticism of the many NetWare users and developers.  In 
  68. addition, SPX is the result of papers and manuals written by a variety of 
  69. researchers in the communications and networking fields; particularly the 
  70. works on Xerox PARC XNS.
  71.  
  72. Special thanks to Dale Neibaur and Mark Hurst for the original SPX 
  73. implementation that this document describes.  Also the many Novell 
  74. Engineers who have written and fixed problems in the various SPX 
  75. implementations since the original DOS based SPX.
  76.  
  77. Edit History
  78.     Revision          Date        Description
  79.     0.90       13 Dec 93        Original draft from SPX II 
  80. specification
  81.         1.00        9 Feb 94        Updated to include 
  82. server API descriptions and state tables.
  83.  
  84. Table of Contents
  85.  
  86. Preface      i
  87. Organization      i
  88. Acknowledgements      i
  89. Edit History      i
  90.  
  91. Introduction      1
  92. Definition of Key Terminology      1
  93. Windowing Protocol      1
  94. Large Packets      1
  95.  
  96. SPX Packet Format      3
  97. SPX Header Definition      3
  98. Checksum      3
  99. Length      4
  100. Transport Control      4
  101. Packet Type      4
  102. Destination Network      4
  103. Destination Node      4
  104. Destination Socket      4
  105. Source Network      5
  106. Source Node      5
  107. Source Socket      5
  108. Connection Control      7
  109. Datastream Type      7
  110. Source Connection ID      7
  111. Destination Connection ID      7
  112. Sequence Number      9
  113. Acknowledge Number      9
  114. Allocation Number      9
  115. SPX Acknowledgement Packets      9
  116. Normal SPX ACK      9
  117. SPX Connection Management Packets     10
  118. Connection Request     10
  119. Connection Request ACK     10
  120. Informed Disconnect     11
  121. Informed Disconnect ACK     11
  122.  
  123. Connection Management     13
  124. Packet Definitions for SPX Connections     13
  125. Session Termination     13
  126. Unilateral Abort     13
  127. Informed Disconnect     13
  128. SPX Watchdog Algorithm     14
  129. Session Watchdog During Connection Establishment     14
  130.  
  131. Connection ID Numbers     16
  132.  
  133. Windowing Algorithm     17
  134. Managing Sequence and Acknowledge numbers     17
  135. Acknowledgements     17
  136. Extensive Error Recovery Mechanisms     17
  137. Data Packet Timeout     17
  138. Window Size     18
  139. Additional Resource Requirements     19
  140.  
  141. Congestion Control Algorithm     20
  142.  
  143. Calculating Timeouts and Round Trip Time     21
  144. Calculating Round Trip Time     21
  145.  
  146. Appendix A - State Tables     22
  147. SPX Connection State Table     23
  148. SPX Transmit State Table     24
  149. SPX Receive State Table     25
  150. SPX Watchdog State Table     26
  151.  
  152. Appendix D - OS API and ECB     27
  153. SPX Connection Establishment Functions     27
  154. SPX Connection Termination Functions     27
  155. SPX Data Transfer Functions     27
  156. SPX Status and Control Functions     27
  157. SPX Structures and Control Constants     28
  158. Event Control Block definition     28
  159. ECB status field completion codes and function return codes     28
  160. SPX header definition     29
  161. SPX connection control flags     29
  162. SPX data stream type field codes     29
  163. SPX_ConnStruct and SPX_ConnStruct2 sStatus field codes     29
  164. Alphabetical SPX Function Descriptions     29
  165. CSPXCancelECB     31
  166. CSPXCancelSessionListen     32
  167. CSPXCheckInstallation     33
  168. CSPXEstablishConnection     34
  169. CSPXGetConnectionStatus     36
  170. CSPXGetConnectionStatus2     38
  171. CSPXGetTimersAndCounters     40
  172. CSPXListenForConnectedPacket     42
  173. CSPXListenForConnection     44
  174. CSPXListenForSequencedPacket     46
  175. CSPXSendSequencedPacket     48
  176. CSPXSetTimersAndCounters     50
  177. CSPXTerminateConnection     52
  178.  
  179. Appendix E - API Semantics and Characteristics     54
  180.  
  181. Appendix G - Default, Minimum and Maximum Values     55
  182. Documentation Constants     55
  183. Connection Termination Reason Codes     55
  184.  
  185. Appendix H - IPX Checksums     56
  186.  
  187.  
  188.  1    Introduction
  189.  
  190. With the introduction of Netware v2.0a in early 1986, NetWare supported a 
  191. guaranteed delivery protocol known as Sequenced Packet Exchange or SPX.  
  192. It was derived from the XEROX XNS protocol specification known as 
  193. Sequenced Packet Protocol or SPP.  This document specifies the SPX 
  194. protocol, the differences from the SPP and provides some implementation 
  195. details.
  196.  
  197. The characteristics of the SPX protocol are heavily influenced by the SPX 
  198. Application Programming Interface (API).  The API requires in most 
  199. instances that the application provide and initialize fields in the SPX 
  200. protocol header prior to calling the API function.  This header knowledge 
  201. has caused applications to be coded to the discovered implementation 
  202. characteristics of SPX rather than to a specification.  These 
  203. characteristics are referred to as the semantics of SPX and this document 
  204. attempts to identify and classify them.
  205.  
  206. SPX is considered a transport protocol in the ISO seven layer model.  It 
  207. is a guaranteed delivery protocol with packet oriented data transmission 
  208. and delivery and has the fundamental architecture necessary to identify 
  209. data unit boundaries and to support a transmission sliding window.
  210.  
  211. 1.1    Definition of Key Terminology
  212.  
  213. SPX is the designator for the protocol.  Host, passive endpoint, and 
  214. listener all refer to the network node that is waiting for or has received 
  215. a connection request.  Client, active endpoint and requester all refer to 
  216. the network node that is making or has made the connection request.  
  217. Connection partner refers to the other endpoint and connection endpoint 
  218. refers to either endpoint participating in the connection, without respect 
  219. to its active or passive status.
  220.  
  221. 1.2    Windowing Protocol
  222.  
  223. The SPX packet header has fields for managing sequencing, acknowledgments 
  224. and transmission window size.  SPX is very packet oriented and the numbers 
  225. in these fields are relative to packets rather than to bytes.  For 
  226. historical reasons, not completely understood, SPX always uses a 
  227. transmission window size of one packet, regardless of the window size 
  228. reported by the connection partner.  In later implementations the window 
  229. size of one may have been an attempt to not overrun the DOS SPX 
  230. implementation.  Under DOS the number of receive buffers posted to the IPX 
  231. socket dictated the window size. Having more than one SPX session 
  232. multiplexed over an IPX socket lead to the problem of determining the 
  233. proper window size for each session.  Since this could not be accurately 
  234. determined, the reported window size could not be trusted and other 
  235. implementations may have attempted to guard against this using a send 
  236. window size of one.
  237.  
  238. 1.3    Large Packets
  239. The original XNS specification defined a network packet size as 576 bytes 
  240. in length, allowing 512 bytes of data and 64 bytes header.  IPX does not 
  241. enforce this packet size, though it does require that all physical 
  242. networks that transmit IPX packets must be able to transmit packets of 
  243. this size.  IPX provides very little assistance in determining whether a 
  244. larger packet can be used, though all IPX routers will, if possible, route 
  245. larger packets.  However, if a network segment is incapable of 
  246. transmitting a larger packet, the packet is dropped with no notification 
  247. to the originating endpoint.
  248.  
  249. There are several IPX based services which use larger than 576 byte 
  250. packets by using a simple algorithm for determining the packet size.  If 
  251. both endpoints share the same physical wire and if the media supports 
  252. larger packets, then the largest media packet size is used.  Other IPX 
  253. services attempt to determine the end-to-end large packet size by sending 
  254. a large packet and having it echoed back.  If the large packet is echoed 
  255. back successfully then the application uses the larger packet size.  This 
  256. echo procedure requires a recovery mechanism, in case the network 
  257. dynamically reconfigures, and the larger packets are no longer viable over 
  258. the new route.
  259.  
  260. SPX is constrained by these features of IPX and as such does not support 
  261. larger packets without the application making some determination outside 
  262. of the SPX environment.
  263.  
  264.  2    SPX Packet Format
  265.  
  266. SPX packet structure consists of a packet header followed by optional 
  267. data.  The SPX header contains addressing, sequencing and acknowledgement 
  268. information.
  269.  
  270. 2.1    SPX Header Definition
  271.  
  272. Here is the field definition for the SPX header:
  273.  
  274.     Description        Length    Type            Value
  275.     Checksum*      2    High-Low Int    0xFFFF if no checksum
  276.     Length*    2    High-Low Uint    42 - 65535
  277.     Transport Control*    1    Ubyte    0 - 16
  278.     Packet Type*    1    Ubyte    5, see detail
  279.  
  280.     Destination Network*    4    Ubyte 0 - 0xFFFFFFFF, see 
  281. detail
  282.     Destination Node*    6    Ubyte    1 - 0xFFFFFFFFFFFE, 
  283. "  "
  284.     Destination Socket*    2    High-Low Uint    0 - 
  285. 0xFFFF, see detail
  286.  
  287.     Source Network*    4    Ubyte    0 - 0xFFFFFFFF, see 
  288. detail
  289.     Source Node*    6    Ubyte    1 - 0xFFFFFFFFFFFE, "  "
  290.     Source Socket*    2    High-Low Uint    0 - 0xFFFF, 
  291. see detail
  292.  
  293.     Connection Control    1    Ubyte        see 
  294. explanation
  295.     Datastream Type    1    Ubyte    see explanation
  296.     Source Connection ID    2    High-Low Uint    see 
  297. explanation
  298.     Destination Conn. ID    2    High-Low Uint    see 
  299. explanation
  300.  
  301.     Sequence Number    2    High-Low Uint    see 
  302. explanation
  303.     Acknowledge Number    2    High-Low Uint    see 
  304. explanation
  305.     Allocation Number    2    High-Low Uint    see 
  306. explanation
  307. Fields marked with '*' are IPX packet header fields
  308.  
  309. All numeric fields in an SPX header are in high-low format or "network 
  310. order", and the length designator is in number of 8 bit bytes or octets.
  311.  
  312. 2.1.1    Checksum
  313. This field is normally set to 0xFFFF indicating that no checksum was 
  314. performed. However, if this field is not 0xFFFF it holds a checksum of the 
  315. entire SPX packet, including the SPX header and data.  Checksum 
  316. verification is an IPX option that must be specified when the IPX socket 
  317. is opened and would therefore cover all SPX connections that are 
  318. multiplexed over the IPX socket.  There is no method for SPX to control 
  319. this option, and therefore it must be coordinated by the application.
  320.  
  321. 2.1.2    Length
  322. This field contains the length of the complete SPX packet, which is the 
  323. length of the header plus the length of the data.  The minimum length of 
  324. an SPX packet is 42 bytes, and the maximum length is 65535.
  325.  
  326. 2.1.3    Transport Control
  327. This field is used by IPX routers.  SPX always set this field to zero 
  328. before sending any packets.
  329.  
  330. 2.1.4    Packet Type
  331. This field indicates the type of service offered or required by the 
  332. packet.  The following values are defined:
  333.     0    Unknown packet type (do not use)
  334.     1    Routing information packet
  335.     2    Echo packet (not currently supported)
  336.     3    Error packet (not currently supported)
  337.     4    Packet exchange packet (normal IPX packet, also used by 
  338. SAP)
  339.     5    Sequenced packet (SPX and SPX II)
  340.     17    NetWare Core Protocol standard packet
  341.     20    IPX NetBIOS broadcast
  342.  
  343. 2.1.5    Destination Network
  344. This field contains the network number of the network to which the 
  345. destination node belongs.  Networks within an internetwork are assigned 
  346. unique 4 byte network numbers by a network administrator.
  347.  
  348. When this field is 0, the destination node is assumed to reside on the 
  349. same network as the source node.  Such a packet is not processed by an IPX 
  350. router.
  351.  
  352. 2.1.6    Destination Node
  353. This field contains the physical address of the destination node.  Not all 
  354. LAN topologies use the same size address field.  A node on an ethernet 
  355. network requires all 6 bytes to specify its address, while a node on an 
  356. arcnet network requires only 1 byte. If a physical network needs less than 
  357. 6 bytes to specify a node address, the address occupies the least 
  358. significant portion of the field and the most significant bytes are set to 
  359. zero.
  360.  
  361. A broadcast node address (0xFFFFFFFFFFFF) is explicitly disallowed by 
  362. SPX.  All connection requests to this node address will be ignored.
  363.  
  364. 2.1.7    Destination Socket
  365. This field contains the socket address of the packet's destination 
  366. process.  Sockets route packets to different processes within a single 
  367. node.  The following socket numbers are reserved by the IPX protocol suite:
  368.  
  369.     2h        Echo protocol socket
  370.     3h        Error handler packet
  371.  
  372. In addition Novell has defined and reserved the following sockets for use 
  373. by NetWare:
  374.  
  375.     0x451        NetWare Core Protocol
  376.     0x452        NetWare Service Advertising Protocol
  377.     0x453        NetWare Routing Protocol
  378.     0x456        NetWare Diagnostics Protocol
  379.  
  380. NOTE:  Novell administers a list of sockets that are well-known in all IPX 
  381. environments. Software developers writing IPX, SPX or SPX II based 
  382. value-added packages that require well-known addresses, should obtain 
  383. socket assignments from Novell.  Dynamic sockets within the IPX suite 
  384. begin at 0x4000 and end at 0x7FFF and well-known sockets assigned by 
  385. Novell begin at 0x8000.
  386.  
  387. 2.1.8    Source Network
  388. This field contains the network number of the network to which the source 
  389. node belongs. Networks within an internetwork are assigned unique 4 byte 
  390. network numbers by a network administrator.
  391.  
  392. This field may contain a value of zero which means the physical network to 
  393. which the source node is connected is unknown.  All packets with a zero in 
  394. this field that pass through a IPX router will have this field set to 
  395. their source network number.  Thus, whenever a packet is received from a 
  396. node on a different network, the source network field is always set 
  397. properly.  Packets whose source and destination nodes are on the same 
  398. network may contain a zero in this field.
  399.  
  400. 2.1.9    Source Node
  401. This field contains the physical address of the source node.  Not all 
  402. physical LAN topologies use the same size address field.  A node on an 
  403. ethernet network requires all 6 bytes to specify its address, while a node 
  404. on an arcnet network requires only 1 byte. If a physical network needs 
  405. less than 6 bytes to specify a node address, the address should occupy the 
  406. least significant portion of the field and the most significant bytes 
  407. should be set to zero.
  408.  
  409. 2.1.10    Source Socket
  410. This field contains the socket address of the process that transmits the 
  411. packet.  In a client server dialogue, the server node usually listens on a 
  412. specific socket for connection requests.  In such a case, the source 
  413. socket is not necessarily the same or even significant.  All that matters 
  414. is that the server sends its replies to the source socket contained in the 
  415. connection request packet.
  416. As in the case of destination sockets, these numbers can be static or 
  417. dynamic.  Source socket numbers follow the same conventions as those for 
  418. destination sockets.
  419.  
  420. 2.1.11    Connection Control
  421. This field contains single-bit flags used by SPX and SPX II to control the 
  422. bidirectional flow of data across a connection.
  423.     Value    Symbol        Description
  424.     0x01    XHD        Reserved by SPX II for extended 
  425. header
  426.     0x02    RES1        Undefined, must be 0
  427.     0x04    NEG        SPX II negotiate size 
  428. request/response, must be 0 for SPX
  429.     0x08    SPX2        SPX II type packet, must be 0 for 
  430. SPX
  431.     0x10    EOM        Set by an SPX client to indicate 
  432. end of message.
  433.     0x20    ATN        Reserved for attention indication 
  434. (Not supported by SPX)
  435.     0x40    ACK        Set to request the receiving 
  436. partner acknowledge that this packet has been received.  Acknowledgement 
  437. requests and responses are handled by SPX.
  438.     0x80    SYS        Set to indicate a packet is a 
  439. system packet.  System packets are internal SPX packets, are not delivered 
  440. to the application, and do not consume sequence numbers.
  441.  
  442. 2.1.12    Datastream Type
  443. This field is a 1 byte flag that indicates the type of data found in the 
  444. packet.  For SPX the following types are defined:
  445.     0x00-0x7F        Defined by the client.
  446.     0x80-0xFD        Reserved
  447.     0xFE            End of connection notification
  448.     0xFF            End of connection acknowledge
  449.  
  450. NOTE:  Originally 0x00-0xFD were available for SPX application use, 
  451. however, to be consistent with the SPX II specification, these values are 
  452. now recommended.
  453.  
  454. 2.1.13    Source Connection ID
  455. This field contains a connection identification number assigned by SPX at 
  456. the packet's source and was generated during connection establishment.
  457.  
  458. 2.1.14    Destination Connection ID
  459. This field contains a connection identification number assigned by SPX at 
  460. the packet's destination and was generated during connection 
  461. establishment.  On a connection request this field is set to 0xffff.
  462.  
  463. Connection ID numbers are used to demultiplex incoming packets from 
  464. multiple connections arriving on the same socket.  All currently active 
  465. connections and all recent connections on a given machine are guaranteed 
  466. to have unique connection ID numbers.
  467.  
  468. See section on Connection ID Numbers for additional detail on how 
  469. connection ID numbers are generated and the bounds of uniqueness.  Also 
  470. see Connection Management for a description of how Connection ID numbers 
  471. are used during connection establishment.
  472.  
  473. 2.1.15    Sequence Number
  474. This field keeps a count of packets exchanged in one direction on the 
  475. connection.  Each side of the connection keeps its own count.  The number 
  476. wraps to zero after reaching 0xFFFF.   SPX acknowledgement packets have 
  477. this field set to the sequence number of the most recently sent data 
  478. packet.
  479.  
  480. See section on Windowing Algorithm for additional detail on how sequence 
  481. number, acknowledge number and allocation number work together.
  482.  
  483. 2.1.16    Acknowledge Number
  484. This field is used by SPX to indicate the sequence number of the next 
  485. packet expected from the connection partner.  Any packet with a sequence 
  486. number less than the specified acknowledge number has been correctly 
  487. received and need not be retransmitted.
  488.  
  489. 2.1.17    Allocation Number
  490. This field is used by SPX to identify to the connection partner the 
  491. largest sequence number that can be sent and is used to control the number 
  492. of unacknowledged packets outstanding in one direction on the connection.  
  493. SPX only sends packets until the sequence number equals the last 
  494. allocation number received from the connection partner.
  495.  
  496. 2.2    SPX Acknowledgement Packets
  497.  
  498. SPX is a guaranteed delivery service and requires that the connection 
  499. endpoints verify that each packet has been received.  The SPX ACK is an 
  500. SPX header with the SYS bit set in Connection Control and Acknowledge 
  501. Number set to acknowledge the packet(s) received (all packets up to but 
  502. not including the acknowledge number have been received) andocation 
  503. Number set to open/adjust the transmission window.
  504.  
  505.  
  506. 2.2.1    Normal SPX ACK
  507. The SPX ACK packet consists only of an SPX header with these fields set:
  508.  
  509.     Description            Value
  510.       Checksum            See SPX Header Definition
  511.       Length                42
  512.       Transport Control        0
  513.       Packet Type            5
  514.       Destination Address        See SPX Header Definition
  515.       Source Address            See SPX Header Definition
  516.       Connection Control        SYS bit set
  517.       Datastream Type        0
  518.       Source Connection ID        > 0 and != 0xFFFF
  519.      ::╩( Destination Conn. ID        > 0 and != 0xFFFF
  520.       Sequence Number        current #
  521.       Acknowledge Number        current #
  522.       Allocation Number        m
  523.  
  524. 2.3    SPX Connection Management Packets
  525.  
  526. In order for SPX to establish and maintain a connection between two 
  527. endpoints, a specific connection request packet exchange must take place.  
  528. SPX does not support an orderly connection termination, but supports two 
  529. different types of termination.  One type requires a packet exchange 
  530. between the endpoints while the second type does not. The primary 
  531. connection management packets are:
  532.    _    Connection Request
  533.    _    Connection Request ACK
  534.    _    Informed Disconnect
  535.    _    Informed Disconnect ACK
  536.  
  537. 2.3.1    Connection Request
  538. The SPX Connection Request packet has the following SPX header with these 
  539. fields set:
  540.  
  541.     Description            Value
  542.       Checksum            See SPX Header Definition
  543.       Length                42
  544.       Transport Control        0
  545.       Packet Type            5
  546.       Destination Address        See SPX Header Definition
  547.       Source Address            See SPX Header Definition
  548.       Connection Control        SYS, & ACK bits set
  549.       Datastream Type        0
  550.       Source Connection ID        > 0 and != 0xFFFF
  551.       Destination Conn. ID        0xFFFF
  552.       Sequence Number        0
  553.       Acknowledge Number        0
  554.       Allocation Number        m
  555.   "m" is indicative of the current window size, where the window size is 
  556. calculated as Alloc - Ack + 1.  Therefore, to indicate no available window 
  557. during connection establishment Alloc would need to be set to -1 
  558. (0xFFFF).  ECB based implementations of SPX determined this value based on 
  559. the number of ECBs posted to the IPX socket before the connection request 
  560. was made.
  561.  
  562. 2.3.2    Connection Request ACK
  563. The SPX Connection ACK is a standard ACK packet and has the following SPX 
  564. header with these fields set:
  565.  
  566.     Description            Value
  567.       Checksum            See SPX Header Definition
  568.       Length                42
  569.       Transport Control        0
  570.       Packet Type            5
  571.       Destination Address        See SPX Header Definition
  572.       Source Address            See SPX Header Definition
  573.       Connection Control        SYS bit set
  574.       Datastream Type        0
  575.       Source Connection ID        > 0 and != 0xFFFF
  576.       Destination Conn. ID        > 0 and != 0xFFFF
  577.       Sequence Number        0
  578.       Acknowledge Number        0
  579.       Allocation Number        m
  580.  
  581.  
  582. 2.3.3    Informed Disconnect
  583. The SPX Informed Disconnect or Terminate Request packet has the following 
  584. SPX header with these fields set:
  585.  
  586.     Description            Value
  587.       Checksum            See SPX Header Definition
  588.       Length                42
  589.       Transport Control        0
  590.       Packet Type            5
  591.       Destination Address        See SPX Header Definition
  592.       Source Address            See SPX Header Definition
  593.       Connection Control        ACK bits set
  594.       Datastream Type        0xFE
  595.       Source Connection ID        > 0 and != 0xFFFF
  596.       Destination Conn. ID        > 0 and != 0xFFFF
  597.       Sequence Number        current #
  598.       Acknowledge Number        current #
  599.       Allocation Number        m
  600.  
  601. 2.3.4    Informed Disconnect ACK
  602. The SPX Informed Disconnect ACK packet has the following SPX header with 
  603. these fields set:
  604.  
  605.     Description            Value
  606.       Checksum            See SPX Header Definition
  607.       Length                42
  608.       Transport Control        0
  609.       Packet Type            5
  610.       Destination Address        See SPX Header Definition
  611.       Source Address            See SPX Header Definition
  612.       Connection Control        None
  613.       Datastream Type        0xFF
  614.       Source Connection ID        > 0 and != 0xFFFF
  615.       Destination Conn. ID        > 0 and != 0xFFFF
  616.       Sequence Number        0
  617.       Acknowledge Number        (Informed Disconnect Seq # + 1)
  618.       Allocation Number        m
  619.  
  620.  3    Connection Management
  621.  
  622. SPX is a connection oriented guaranteed delivery service and tracks state 
  623. information about the endpoints utilizing the connection.  
  624.  
  625. 3.1    Packet Detions for SPX Connections
  626.  
  627. Assuming a normal SPX to SPX connection, the sequence of packets on the 
  628. wire is as follows:
  629.  
  630.     Packet originator        Packet Definition
  631.       Client            ∙î  SPX Connection Request
  632.       Host              SPX Connection ACK
  633.  
  634. The client issues an SPX Connection Request with the SYS bit set.  If the 
  635. host was waiting for a connection request the host returns a standard SPX 
  636. Connection ACK and then informs the application of the connection request.
  637.  
  638. 3.2    Session Termination
  639.  
  640. When one endpoint of an SPX session decides to terminate the connection 
  641. there are two ways of accomplishing it:  Unilateral Abort, or Informed 
  642. Disconnect.
  643.  
  644. 3.2.1    Unilateral Abort
  645. A Unilateral Abort should only be used when one endpoint has detected a 
  646. connection failure, through retry failure or watchdog failure.  In this 
  647. case there is no benefit in sending an Informed Disconnect, since the 
  648. connection partner is not responding there would be no way to confirm that 
  649. the Informed Disconnect had arrived.  A Unilateral Abort assumes that the 
  650. connection partner has failed or will be able to detect that the 
  651. connection is no longer valid.
  652.  
  653. 3.2.2    Informed Disconnect
  654. An Informed Disconnect terminates the session immediately without giving 
  655. the connection partner an opportunity to complete any transmissions.  The 
  656. Informed Disconnect differs from the Unilateral Abort by exchanging 
  657. disconnect packets between the endpoints.  An Informed Disconnect has the 
  658. following packet sequence:
  659.  
  660.     Packet originator        Packet Definition
  661.       Endpoint 1          SPX Informed Disconnect
  662.       Endpoint 2          SPX Informed Disconnect Ack
  663.  
  664. The Informed Disconnect packet is queued for transmission behind all other 
  665. data packets and given the SPX window of one, is not transmitted until all 
  666. data packets have been acknowledged.  It should be retried as a normal 
  667. data packet and if transmission failure is detected and all retries are 
  668. exhausted then the endpoint may perform a Unilateral Abort. An Informed 
  669. Disconnect packet is not subject to window closure (See Additional 
  670. Resource Requirements).
  671.  
  672. An Informed Disconnect may cause data to be lost.  This happens if data is 
  673. currently in the output queue for the endpoint that receives the Informed 
  674. Disconnect.  SPX sends the Informed Disconnect ACK immediately upon 
  675. receiving the Informed Disconnect and then cleans up the session.  Any 
  676. data packets that may be queued for transmission are returned to the 
  677. application.
  678.  
  679. NOTE:  An extended protocol environment such as STREAMS based TLI which 
  680. requires data queues to be flushed to ensure the Informed Disconnect  is 
  681. properly processed, may also cause both outbound and inbound data to be 
  682. lost.
  683.  
  684. 3.3    SPX Watchdog Algorithm
  685.  
  686. The watchdog routine is a passive element in SPX.  Watchdog packets are 
  687. sent only if there is a period of time with no traffic on the session.  
  688. There are two timeout values associated with the watchdog.  The first, 
  689. VERIFY_TIMEOUT (default is 3 seconds) is the time SPX will wait after a 
  690. data transmit before sending a watchdog packet.  Any packet that is sent 
  691. resets this timer to 0.  The second timeout value, ABORT_TIMEOUT (default 
  692. 30 seconds) is the time SPX will wait after receiving a packet from its 
  693. connection partner before the connection is aborted. Any packet that 
  694. arrives for a session will reset the watchdog timer for that session.  
  695. This includes system packets as well as user data packets (ie. incoming 
  696. data, an incoming ACK for transmitted data or an incoming ACK to a 
  697. watchdog packet would reset the timer).
  698.  
  699. A watchdog request packet consists of an SPX header with the SYS and the 
  700. ACK bits set. The receiver will respond to this packet with a watchdog 
  701. acknowledgement packet.  A watchdog acknowledgement packet consists of an 
  702. SPX header with the SYS bit set and is indistinguishable from an normal 
  703. SPX ACK.  The Sequence, ACK and Alloc fields contain the current values.
  704.  
  705. If the watchdog algorithm has sent repeated watchdog request packets 
  706. (default 10, every 3 seconds for 30 secondsd has not received a 
  707. response from the connection partner, then SPX assumes that the partner is 
  708. unreachable and performs a Unilateral Abort to terminate the connection.
  709.  
  710. See the annotation in the section Calculating Window Size for additional 
  711. information how the watchdog assists in window management.
  712.  
  713. 3.4    Session Watchdog During Connection Establishment
  714.  
  715. SPX considers a connection to exist once an endpoint has both connection 
  716. IDs.  This happens after the receipt of a Connection Request at the 
  717. passive endpoint, or the receipt of a Connection ACK at the active 
  718. endpoint.  Once this exchange has taken place the connection is 
  719. established and the watchdog timeÅm╩rs begin running.
  720.  
  721.  4    Connection ID Numbers
  722.  
  723. Connection ID numbers are assigned as follows.  Each endpoint determines a 
  724. random starting point for connection ID numbers when that endpoint first 
  725. becomes active.  When a new connection ID number needs to be generated, 
  726. SPX increments the current number and then checks to see if the new number 
  727. is in use.  If the new number is in use, SPX again increments the number 
  728. and checks to see if the new number is in use.  This process continues 
  729. until an ID number is found that is not in use.
  730.  
  731. _ As a performance improvement it is suggested that the implementation use 
  732. Connection ID as a direct index into the session table.  This can be 
  733. accomplished by incrementing the Connection ID and wrapping at the current 
  734. maximum table size.  Implementations where the configured table size can 
  735. be changed while running should ensure that table size reduction does not 
  736. move the end of the table below the last currently used slot.
  737.  
  738. In an attempt to prevent a reboot of the system from allocating the same 
  739. Connection ID numbers in the same order it is suggested that the 
  740. implementation initialize the Connection ID number with a random value.  
  741. This number might be taken from the system clock, if available. _
  742.  
  743.  
  744.  5    Windowing Algorithm
  745.  
  746. Though the SPX header has fields for managing the transmission window, SPX 
  747. does not currently utilize these fields fully.  SPX uses a transmission 
  748. window of one, requests an ACK for each data packet sent, and does not 
  749. send the next data packet until the ACK packet has arrived.
  750.  
  751. 5.1    Managing Sequence and Acknowledge numbers
  752.  
  753. The sequence number is an ever increasing (except when wrapping past zero) 
  754. number that identifies the order of the data being sent and received.  The 
  755. acknowledge number is also an ever increasing number identifying all the 
  756. data packets that have been successfully received. The acknowledge number 
  757. also indicates the sequence number of the next packet that is expected by 
  758. the receiving endpoint.  The first data packet sent has Sequence Number 
  759. zero and the ACK sent in response to that data packet has Acknowledge 
  760. Number set to one.
  761.  
  762. _ There is an easy way to manage these two values (there are actually two 
  763. sets of values, the numbers for sending and the numbers expected when 
  764. receiving).  When sending a data packet, increment Sequence Number after 
  765. placing the data packet on the "to be sent" queue or if no queueing 
  766. mechanism is used, upon return from the send function.  When generating an 
  767. ACK, set Acknowledge Number in the ACK packet to the received data 
  768. packet's Sequence Number plus one. _
  769.  
  770.  
  771. 5.2    Acknowledgements
  772.  
  773. A normal SPX acknowledgement is defined as an SPX header with the SYS bit 
  774. set in Connection Control, the Sequence Number set to the current 
  775. transmission sequence number and Acknowledge Number set to the next packet 
  776. expected by the receiver.
  777.  
  778. An acknowledgement can be "piggy-backed" on a data packet with Acknowledge 
  779. Number set to the next packet expected by the receiver (ACKs can be 
  780. "piggy-backed" on any packet, data, system or watchdog).
  781.  
  782. 5.3    Extensive Error Recovery Mechanisms
  783.  
  784. When standard SPX detects an error it does not know how to handle, it 
  785. aborts the session. However, SFT III has introduced the need for better 
  786. SPX error handling, to correctly handle an SFT III switch over.
  787.  
  788. 5.Data Packet Timeout
  789. During normal operation if the connection partner fails to acknowledge a 
  790. packet, the sender must retry the packet RETRY_COUNT/2 times, each time 
  791. increasing the round trip time value by 50%, up to MAX_RETRY_DELAY 
  792. (default is 5 seconds).  If the packet still has not been acknowledged, 
  793. the sender must attempt to locate a new route to the connection partner.  
  794. If a new route is located then reset the retry count and retransmit.  If 
  795. no new route was found, then continue to retransmit until all retries are 
  796. exhausted and if unsuccessful the connection is aborted with a Unilateral 
  797. Abort.
  798.  
  799. On route failure each endpoint must determine the failure independently 
  800. and this only happens during data send.
  801.  
  802. In short, the steps are:
  803.    _    Retry the data packet RETRY_COUNT/2 times, increasing the 
  804. timeout value before each retry
  805.   ¥aJ _    Attempt to locate a new route
  806.    _    If new route found resume sending data packet RETRY_COUNT times
  807.    _    If a new route is not found, retry the data packet the 
  808. remaining RETRY_COUNT/2 times and if unsuccessful perform a Unilateral 
  809. Abort.
  810.    _    After a successful retransmission on the new route, resume 
  811. normal operation.
  812.  
  813. _ The algorithm is using 1/2 the RETRY_COUNT in order to give preference 
  814. to the possibility of route failure over endpoint failure or network 
  815. congestion.  By retrying less before attempting to relocate a new route 
  816. the protocol will recover faster on very dynamic networks.  This is better 
  817. than just reducing the RETRY_COUNT to a smaller number, because it still 
  818. provides more retries and longer delays between retries on congested 
  819. networks. _
  820.  
  821.  
  822.  
  823. 5.4    Window Size
  824.  
  825. It is the responsibility of the receiver at each endpoint to calculate the 
  826. window size for packets
  827. received by that endpoint.  The receiver then communicates this number to 
  828. the transmitter via the allocation number field in the SPX II header by 
  829. adding the calculated window size to the current sequence number.  The 
  830. receiver is free to change the window size during the session with the 
  831. stipulation that the receiver can never reduce an already granted window.  
  832. The transmitter is allowed to send packets while the sequence number is 
  833. less than or equal to the allocation number.
  834.  
  835. SPX currently ignores the reported allocation window size and uses a 
  836. window of one.
  837.  
  838. _ The reason that the advertised window size cannot be reduced has to do 
  839. with the processing of the allocation and sequence numbers.  The 
  840. transmitter is allowed to send packets until the sequence number is equal 
  841. to the allocation number.  If the receiver tried to reduce the allocation 
  842. number after the transmitter had already sent a packet with that sequence 
  843. number, the transmitter would perceive that the window had grown to nearly 
  844. 64k packets.  The only way for the receiver to reduce the window size is 
  845. to allow the acknowledge number to grow without increasing the allocation 
  846. number.  
  847.  
  848. For example, the receiver could not send a packet indicating an allocation 
  849. number of 1210 and then send a subsequent packet indicating an allocation 
  850. number of 1208.  However the receiver could send a subsequent packet 
  851. indicating an allocation number of 1210 even though the acknowledge number 
  852. may have increased by 2, effectively reducing the window size by 2. _
  853.  
  854. During window management it is possible, because of resource limitation or 
  855. other reason, for the receiving side to close the data receive window 
  856. completely by sending a packet indicating that the next sequence number 
  857. expected is greater than the next allocation number.  When this happens 
  858. the receiver must be prepared to reopen the window after the flow control 
  859. condition has cleared, and must handle the possibility that the reopen 
  860. packet may be lost.
  861.  
  862. _ Once a window has been closed it is reopened with either a normal data 
  863. packet or a system packet indicating an allocation number greater than or 
  864. equal to the sequence number.  If this reopen information is attached to a 
  865. data packet the normal data retry mechaniill ensure delivery.  
  866. However, if the data flow over the connection is primarily one way or the 
  867. window also happens to be closed in the opposite direction, the reopen 
  868. information will be included in a system packet which is not retransmitted 
  869. and may be lost.
  870.  
  871. If the reopen packet is lost, the watchdog will eventually send a series 
  872. of system packets that will reopen the window, however there will be a 
  873. delay of up to VERIFY_TIMEOUT (default 3 seconds) before this occurs. When 
  874. window management is reopening a window with a system packet it could 
  875. request the watchdog system to increase the frequency of the watchdog 
  876. packets.  The watchdog system would remain in this increased frequency 
  877. state until a data packet arrives. _
  878.  
  879. There are several options for the receiver to select a window size.  The 
  880. implementor is free to select any algorithm as long as the protocol 
  881. specification is not violated by the algorithm.
  882.  
  883. _ Perhaps the simplest approach is to select a hard coded value and use 
  884. it.  A number between 4 and 16 is q¡╢∞probably appropriate under most 
  885. circumstances.  A slightly more complex approach would have specific 
  886. values for different conditions.  For example, a value of 4 for "local" 
  887. LANs (less than 4 hops away) and a value of 8 for all others.  One could 
  888. also select an algorithm based on the reported time to net.  One such 
  889. algorithm would be to use the reported time to net (in IBM PC "ticks") 
  890. shifted left 2, with a maximum of value of 16.  More complex algorithms, 
  891. such as a heuristic determination based on dropped packets, are certainly 
  892. possible, but are beyond the scope of this document. _
  893.  
  894. 5.5    Additional Resource Requirements
  895.  
  896. THIS IS NOT TRUE FOR SPX THOUGH IT PROBABLY SHOULD BE.
  897.  
  898. Only data packets are subjected to window size constraints, all system 
  899. packets and the Informed Disconnect packet can be sent even if the 
  900. receiving side has closed its receive window. This implies that there are 
  901. resources, considered system resources, which are not included in the size 
  902. of the window reported to the connection partner.
  903.  
  904.  6    Congestion Control Algorithm
  905.  
  906. SPX has a very simple congestion control algorithm.  Don't send until the 
  907. ACK for the previous packet has arrived.  Thus if the previous packet is 
  908. delayed or dropped due to congestion SPX will not flood the net with 
  909. packets.  However, delays that are greater than RETRY_TIMEOUT would cause 
  910. SPX to add to the congestion by retransmitting unnecessarily.
  911.  
  912.  7    Calculating Timeouts and Round Trip Time
  913.  
  914. 7.1    Calculating Round Trip Time
  915.  
  916. SPX does not attempt to track round trip time closely.  It calculates 
  917. round trip time RTT by using the "time to net" value returned from the 
  918. nearest router.  This value is doubled and then  3/4 of a second fudge 
  919. factor is added.  Each time a retry is necessary, the current RTT is 
  920. increased by 50% and bounded by MAX_ROUND_TRIP_TIMEOUT.  RTT is tracked 
  921. and modified on a per session basis.
  922.  
  923.  8    Appendix A - State Tables
  924.  
  925. The following state tables have unique state numbers for each state.  In 
  926. addition, each table is identified to assist in state transitions that 
  927. move from one table to another. These identifiers are:
  928.     C    SPX Connection State Table
  929.     T    SPX Transmit State Table
  930.     R    SPX Receive State Table
  931.     W    SPX Watchdog State Table
  932.  
  933. Each state table represents a different state machine.  There is one state 
  934. machine that handles the connection events, one for transmitting data, one 
  935. for receiving data and one which monitors the connection to detect 
  936. connection failure, during idle time.  Only the first state machine 
  937. operates until a connection is established, after which the other three 
  938. state machines process the connection.  These are independent state 
  939. machines, however by sharing information between them, certain 
  940. optimizations in packet utilization and minimization can occur.
  941.  
  942. SPX Connection State Table
  943.  
  944. States
  945. \
  946. Events    Uninit
  947.  
  948. state    C0    Socket
  949. Open
  950. state    C1    Socket
  951. w/ rcvbufs
  952. state    C2    Listening
  953.  
  954. state    C3    Listening
  955. w/ rcvbufs
  956. state    C4    Connecting
  957.  
  958. state    C5    Connecting
  959. w/ rcvbufs
  960. state    C6
  961. Socket Open Request    state    C1                        
  962. Listen for Connect Req        state    C3    state    C4    state    C3    state    C4        
  963. Post Rcvbufs        state    C2    state    C2    state    C4    state    C4    state    C6    state    C6
  964. Connect Request        state    C5    state    C6                
  965. Incoming Connect Pkt                state    C3'2    state    C4'2        
  966. Outgoing Connect Ack                state    T73
  967. state    R7
  968. state    W23    state    T7
  969. state    R7
  970. state    W23        
  971. Incoming Connect Ack                                                state    T7
  972. state    R7
  973. state    W23    state    T7
  974. state    R7
  975. state    W23
  976. Retry timer
  977. Fired                        state    C5    state    C6
  978. Retry count
  979. Exhausted                        state    C1    state    C2
  980. Request Canceled            state    C21    state    C1    state    C2        
  981. Socket
  982. Closed        state    C0    state    C0    state    C0    state    C0    state    C0    state    C0
  983.  
  984.         Note1:    If there are still receive buffers posted to SPX 
  985. after the cancellation, then stay in state 2, otherwise change to state 1.
  986.         Note2:    State 3' and state 4' indicate that a minor state 
  987. transition has occurred into a transmit ACK state.
  988.         Note3:    If multiple listen for connection buffers have been 
  989. posted to SPX, only one session transitions to Data xfr state, while all 
  990. others remain in state C3 or C4.  At this point the transmitting, 
  991. receiving and watchdog state machines begin handling the connection and 
  992. are thus represented by the transition to three separate states.
  993.  
  994. SPX Transmit State Table
  995.  
  996. States
  997. \
  998. Events    Data xfr1
  999.  
  1000.  
  1001. state    T7    Data xfr
  1002. Tx_win
  1003. closed
  1004. state    T8    Data xfr
  1005. Tx_win
  1006. open
  1007. state    T9    Data xfr
  1008. Send packet
  1009. state    T10    Data xfr
  1010. wait for ACK
  1011. state    T11    Data xfr
  1012. Call ESR
  1013.  
  1014. state    T12    Discn
  1015. Send
  1016.  
  1017. state    T13    Discn
  1018. wait for ACK
  1019. state    T14    Discn
  1020. Call ESR
  1021.  
  1022. state    T15
  1023. Win Closure    state    T8    state    T8    state    T8                        
  1024. Win Open    state    T9    state    T9    state    T9                        
  1025. Send data
  1026. Request        state    T8    state    T10                        
  1027. Transmit
  1028. Complete                state    T11            state    T14        
  1029. Incoming
  1030. Data ACK                    state    T12                
  1031. Return from ESR                        state    T7            state    T12
  1032. Send disconnect Request        state    T8    state    T13                        
  1033. Incoming
  1034. Discon ACK                                state    T15    
  1035. Retry timer
  1036. Fired                    state    T10            state    T13    
  1037. Retry count
  1038. Exhausted                state    C12            state    C12        
  1039. Request
  1040. Canceled                                    
  1041. Socket
  1042. Closed    state    C0    state    C0    state    C0    state    C0    state    C0    state    C0    state    C0    
  1043. state    C0    state    C0
  1044.  
  1045.         Note1:    Data xfr is a pseudo state that only serves as a 
  1046. place holder in the state table to ensure proper state transition based on 
  1047. already available information.
  1048.         Note2:    If there are receive buffers still posted to SPX 
  1049. then this state transition is actually to state 2, however, for table 
  1050. simplicity state 1 is specified.
  1051.  
  1052. SPX Receive State Table
  1053. States
  1054. \
  1055. Events    Data xfr1
  1056.  
  1057.  
  1058. state    R7    Data xfr
  1059. Rx_win
  1060. Closed
  1061. state    R16    Data xfr
  1062. Rx_open
  1063. Win
  1064. state    R17    Data xfr
  1065. Rx_win
  1066. Open
  1067. state    R18    Data xfr
  1068. Call ESR
  1069.  
  1070. state    R19    Data xfr
  1071. Send ACK
  1072.  
  1073. state    R20    Discn
  1074. Send ACK
  1075.  
  1076. state    R21    Discn
  1077. Call ESR
  1078.  
  1079. state    R22
  1080. Post RcvBufs    state    R17    state    R17                        
  1081. Incoming
  1082. Data                state    R19                
  1083. Return from ESR                    state    R20            state    12
  1084. Transmit ACK
  1085. Complete            state    R18            state    R7        
  1086. Incoming
  1087. Disconnect                state    R21                
  1088. Transmit
  1089. Discn ACK Complete                            state    R22    
  1090. Request
  1091. Canceled                state    R183                
  1092. Socket
  1093. Closed    state    C0    state    C0    state    C0    state    C0    state    C0    state    C0    state    C0    
  1094. state    C0
  1095.  
  1096.         Note1:    Data xfr is a pseudo state that only serves as a 
  1097. place holder in the state table to ensure proper state transition based on 
  1098. already available information.
  1099.         Note2:    If there are receive buffers still posted to SPX 
  1100. then this state transition is actually to state 2, however, for table 
  1101. simplicity state 1 is specified.
  1102.         Note3:    If there are still receive buffers posted to SPX 
  1103. after the cancellation, then stay in state 18, otherwise change to state 
  1104. 16.
  1105.  
  1106. SPX Watchdog State Table
  1107. States
  1108. \
  1109. Events    Data xfr
  1110. Idle1
  1111.  
  1112. state    W23    Data xfr
  1113. Send watchdog
  1114.  
  1115. state    W24    Data xfr
  1116. Send watchdog
  1117. ACK request
  1118. state    W25
  1119. Watchdog timer2    state    W24        
  1120. Verify timer3    state    W25        
  1121. Abort timer4    state    15        
  1122. Transmit complete        state    W23    state    W23
  1123.  
  1124.         Note1:    The Data xfr idle state is a non-event state, and is 
  1125. defined to be a state entered when a period of non-activity exists on the 
  1126. SPX session.  It essentially represents a combination of state 8 and 9, 
  1127. with no incoming or outgoing packets to process.
  1128.         Note2:    The watchdog timer is reset to it's starting value 
  1129. each time a packet is sent.
  1130.         Note3:    The verify timer is reset to it's starting value 
  1131. each time a packet is received.
  1132.         Note4:    The abort timer is reset to it's starting value each 
  1133. time a packet is received.
  1134.         Note5:    If there are receive buffers still posted to SPX 
  1135. then this state transition is actually to state 2, however, for table 
  1136. simplicity state 1 is specified.
  1137.  
  1138.  9    Appendix D - OS API and ECB
  1139.  
  1140. 9.1    SPX Connection Establishment Functions
  1141.  
  1142. The following functions are used when establishing SPX connections.
  1143.    _    CSPXEstablishConnection - Establish an SPX connection with a 
  1144. listening endpoint.
  1145.    _    CSPXListenForConnection - Inform SPX to allow and wait for an 
  1146. incoming connection request.
  1147.    _    CSPXListenForSequencedPacket - Provide a receive buffer to SPX 
  1148. for receiving data for any SPX connection on a specific IPX socket.
  1149.  
  1150. 9.2    SPX Connection Termination Functions
  1151.  
  1152. The following functions are used when terminating SPX connections.
  1153.    _    CSPXCancelSessionListen - Discontinue waiting for an incoming 
  1154. SPX connection request.
  1155.    _    CSPXAbortConnection - Terminate an existing SPX connection 
  1156. without informing the connection partner.
  1157.    _    CSPXTerminateConnection - Terminate an existing SPX connection 
  1158. and inform the connection partner.
  1159.  
  1160. 9.3    SPX Data Transfer Functions
  1161.  
  1162. The following functions are used for data transfer on established SPX 
  1163. connections.
  1164.    _    CSPXListenForConnectedPacket - Provide a receive buffer to a 
  1165. specific SPX connection.
  1166.    _    CSPXListenForSequencedPacket - Provide a receive buffer to SPX 
  1167. for receiving data for any SPX connection on a specific IPX socket.
  1168.    _    CSPXSendSequencedPacket - Send a data packet to the specified 
  1169. existing SPX connection partner.
  1170.  
  1171. 9.4    SPX Status and Control Functions
  1172.  
  1173.    _    CSPXCancelECB - Cancel the receive ECB previously submitted to 
  1174. SPX.
  1175.    _    CSPXCheckInstallation - Determine if SPX is available and 
  1176. retrieve configuration information.
  1177.    _    CSPXGetConnectionStatus - Obtain connection information from 
  1178. SPX.
  1179.    _    CSPXGetConnectionStatus2 - Obtain connection information from 
  1180. SPX.
  1181.    _    CSPXGetTimersAndCounters - Obtain default configuration 
  1182. information from SPX.
  1183.    _    CSPXSetTimersAndCounters - Set the default configuration 
  1184. information inside of SPX.
  1185.  
  1186. 9.5    SPX Structures and Control Constants
  1187.  
  1188. Event Control Block definition
  1189. The comment characters in the IPX_ECB structure have the following 
  1190. meanings:
  1191.            s - this field must be filled in prior to a send
  1192.     r - this field must be filled in prior to a receive
  1193.     R - this field is reserved
  1194.     A - this field may be used when the ECB is not in use by IPX/SPX
  1195.     q - the application may read this field
  1196.    
  1197. typedef struct
  1198. {
  1199.    void                *fragAddress;
  1200.    unsigned long        fragSize;
  1201. } ECBFrag;
  1202. typedef struct IPX_ECBStruct
  1203. {
  1204.    struct IPX_ECBStruct    *next;            /* A */
  1205.    struct IPX_ECBStruct    *prev;            /* A */
  1206.    unsigned short        status;            /* q */
  1207.    unsigned long        ESRAddress;        /* sr */
  1208.    unsigned short        lProtID;            /* R */
  1209.    unsigned char        protID [6];        /* R */
  1210.    unsigned long        boardNumber;        /* R */
  1211.    unsigned char        immediateAddress [6];    /* R */
  1212.    unsigned char        driverWS [4];        /* R */
  1213.    unsigned long        ESREBXValue;        /* R */
  1214.    unsigned short        socket;            /* sr */
  1215.    unsigned short        protocolWorkspace;    /* R */
  1216.    unsigned long        dataLen;            /* q */
  1217.    unsigned long        fragCount;        /* sr */
  1218.    ECBFrag        fragList [2];        /* sr */
  1219. } IPX_ECB;
  1220.  
  1221. ECB status field completion codes and function return codes
  1222. #define SPX_OK                    0x0000
  1223. #define SPX_CONNECTION_TERMINATED    0xFFEC
  1224. #define SPX_CONNECTION_FAILED        0xFFED
  1225. #define SPX_INVALID_CONNECTION        0xFFEE
  1226. #define SPX_CONNECTION_TABLE_FULL    0xFFEF
  1227. #define SPX_SOCKET_NOT_OPEN        0xFFF0
  1228. #define SPX_SOCKET_ALREADY_OPEN        0xFFF1
  1229. #define SPX_ECB_CANNOT_BE_CANCELEDFF9
  1230. #define SPX_EVENT_CANCELED        0xFFFC
  1231. #define SPX_PACKET_OVERFLOW        0xFFFD
  1232. #define SPX_MALFORMED_PACKET        0xFFFE
  1233. SPX header definition
  1234. typedef struct
  1235. {
  1236.    unsigned short        checksum;        /* hi-lo */
  1237.    unsigned short        packetLen;        /* hi-lo */
  1238.    unsigned char        transportCtl;
  1239.    unsigned char        packetType;
  1240.    unsigned long        destNet;            /* hi-lo */
  1241.    unsigned char        destNode[6];      
  1242.    unsigned short        destSocket;        /* hi-lo */
  1243.    unsigned long        sourceNet;        /* hi-lo */
  1244.    unsigned char        sourceNode[6];    
  1245.    unsigned short        sourceSocket;        /* hi-lo */
  1246.  
  1247.    unsigned char        connectionCtl;
  1248.    unsigned char        dataStreamType;
  1249.    unsigned short        sourceConnectID;    /* hi-lo */
  1250.    unsigned short        destConnectID;        /* hi-lo */
  1251.    unsigned short        sequenceNumber;    /* hi-lo */
  1252.    unsigned short        ackNumber;        /* hi-lo */
  1253.    unsigned short        allocNumber;        /* hi-lo */
  1254. } SPX_HEADER;
  1255.  
  1256. SPX connection control flags
  1257. #define SPX_CC_SYS                0x80
  1258. #define SPX_CC_ACK                0x40
  1259. #define SPX_CC_EOM                0x10
  1260.  
  1261. SPX data stream type field codes
  1262. /* 0 thru 127 (0 - 0x7f) are available for application use */
  1263. SPX_DS_TERMINATE                0xFE
  1264. SPX_DS_TERMINATE_ACK            0xFF
  1265.  
  1266. SPX_ConnStruct and SPX_ConnStruct2 sStatus field codes
  1267. #define SPX_SSTATUS_ABORTED        0x00
  1268. #define SPX_SSTATUS_WAITING        0x01
  1269. #define SPX_SSTZô<ATUS_STARTING        0x02
  1270. #define SPX_SSTATUS_ESTABLISHED        0x03
  1271. #define SPX_SSTATUS_TERMINATING        0x04
  1272.  
  1273. 9.6    Alphabetical SPX Function Descriptions
  1274.  
  1275. The following pages contain alphabetical function descriptions for the SPX 
  1276. functions.
  1277.  
  1278. CSPXAbortConnection
  1279.  
  1280. Name
  1281. CSPXAbortConnection - Terminate an existing SPX connection without 
  1282. informing the connection partner.
  1283.  
  1284. Synopsis
  1285.         LONG CSPXAbortConnection(
  1286.                 LONG sessionID);
  1287.  
  1288.  
  1289. Description
  1290. This function will terminate an existing SPX connection by aborting the 
  1291. session. The connection partner is not informed of the termination.  The 
  1292. sessionID was returned from a call to CSPXEstablishConnection or 
  1293. CSPXListenForConnection.
  1294.  
  1295. If a connection has not been fully established (ie. CSPXListenForConnection
  1296.  has been called and no connection request has been received), then this 
  1297. function acts the same as CSPXCancelSessionListen.  The status field of 
  1298. the event control block (ECB) that was handed to CSPXListenForConnection 
  1299. will be set to SPX_CONNECTION_FAILED and if the ESRAddress field is 
  1300. non-zero the Event Service Routine (ESR) will be called.
  1301.  
  1302. If CSPXListenForConnectedPacket was used to provide ECB receive buffers to 
  1303. SPX, then all the ECB receive buffers will be released by SPX and the 
  1304. status field in the ECB will be set to SPX_CONNECTION_FAILED and if the 
  1305. ESRAddress field is non-zero the ESR will be called, for each ECB.
  1306.  
  1307.  
  1308. Diagnostics
  1309. Returns SPX_OK on success or one of the following on failure:
  1310.         SPX_INVALID_CONNECTION
  1311.  
  1312. See Also
  1313.     CSPXTerminateConnection, CSPXCancelSessionListen
  1314.  
  1315. CSPXCancelECB
  1316.  
  1317. Name
  1318. CSPXCancelECB - Cancel the receive ECB previously submitted to SPX.
  1319.  
  1320. Synopsis
  1321.         LONG CSPXCancelECB(
  1322.                 IPX_ECB *ecb);
  1323.  
  1324. Description
  1325. If the event control block (ECB) pointed to by ecb was submitted to SPX 
  1326. through a call to CSPXListenForSequencedPacket or 
  1327. CSPXListenForConnectedPacket then control of the ECB will be returned to 
  1328. the application.  Also the status field of the ECB will be set to 
  1329. SPX_EVENT_CANCELED.
  1330.  
  1331. SPX stores information in the ECB that is necessary to successfully cancel 
  1332. the ECB.  If this information is invalid because the ECB has not been 
  1333. previously submitted to SPX or SPX does not currently control the ECB, or 
  1334. if the information has been changed by the application prior to the call 
  1335. to CSPXCancelECB then the function will fail.
  1336.  
  1337. Diagnostics
  1338. Returns SPX_OK on success and one of the following on failure:
  1339.         SPX_INVALID_CONNECTION
  1340.         SPX_ECB_CANNOT_BE_CANCELED
  1341.  
  1342. See Also
  1343.     CSPXCancelSessionListen
  1344.  
  1345. CSPXCancelSessionListen
  1346.  
  1347. Name
  1348. CSPXCancelSessionListen - Discontinue waiting for an incoming SPX 
  1349. connection request.
  1350.  
  1351. Synopsis
  1352.         LONG CSPXCancelSessionListen(
  1353.                 IPX_ECB *ecb);
  1354.  
  1355. Description
  1356. If the event control block ) pointed to by ecb was submitted to SPX 
  1357. through a call tßJ+ho CSPXListenForConnection then control of the ECB will be 
  1358. returned to the application.  Also the status field of the ECB will be set 
  1359. to SPX_EVENT_CANCELED.
  1360.  
  1361. SPX stores information in the ECB that is necessary to successfully cancel 
  1362. the ECB.  If this information is invalid because the ECB has not been 
  1363. previously submitted to SPX or SPX does not currently control the ECB, or 
  1364. if the information has been changed by the application prior to the call 
  1365. to CSPXCancelSessionListen then the function will fail.
  1366.  
  1367. Diagnostics
  1368. Returns SPX_OK on success and one of the following on failure:
  1369.         SPX_INVALID_CONNECTION
  1370.         SPX_ECB_CANNOT_BE_CANCELED
  1371.  
  1372. See Also
  1373.     CSPXCancelECB
  1374.  
  1375. CSPXCheckInstallation
  1376.  
  1377. Name
  1378. CSPXCheckInstallation - Determine if SPX is available and retrieve 
  1379. configuration information.
  1380.  
  1381. Synopsis
  1382.         LONG CSPXCheckInstallation(
  1383.                 WORD *version,
  1384.                 LONG *maxConnections);
  1385.  
  1386. Description
  1387. If SPX is available on this machine then CSPXCheckInstallation will return 
  1388. the major and minor SPX version number in the variable pointed to by 
  1389. version.  The high order byte, (version & 0xff00) >> 8, is the major SPX 
  1390. version number, and the low order byte, version & 0x00ff, is the minor SPX 
  1391. version number.  The maximum number of connections that SPX can support is 
  1392. returned in the variable pointed to by maxConnections and the return value 
  1393. from CSPXCheckInstallation is the current number of SPX connections in use.
  1394.  
  1395. Diagnostics
  1396. Returns the current number of SPX connections in use if SPX is loaded, 
  1397. otherwise, all three return values are 0.
  1398.  
  1399. See Also
  1400.     CSPXGetTimersAndCounter, CSPXSetTimersAndCounters
  1401.  
  1402. CSPXEstablishConnection
  1403.  
  1404. Name
  1405. CSPXEstablishConnection - Establish an SPX connection with a listening 
  1406. endpoint.
  1407.  
  1408. Synopsis
  1409.         LONG CSPXEstablishConnection(
  1410.                 BYTE retryCount,
  1411.                 BYTE watchDog,
  1412.                 LONG *sessionID,
  1413.                 IPX_ECB *ecb);
  1414.  
  1415. Description
  1416. This function will request an SPX connection with the endpoint specified 
  1417. in the destination address fields of the event control block (ECB) 
  1418. identified by ecb. If the endpoint is waiting for SPX connection requests, 
  1419. having called CSPXListenForConnection, then a bi-directional communication 
  1420. connection will be established between the two endpoints.
  1421.  
  1422. The application can override SPX defaults by specifying new values in the 
  1423. retryCount and watchDog parameters.  The range of values for retryCount is 
  1424. 0-255, where 0 indicates use SPX system configured default value, and any 
  1425. other number is used as the maximum number of times SPX will retry a 
  1426. transmission before considering the connection down.  Setting watchDog to 
  1427. zero, indicates do not monitor the SPX connection by sending keep-alive 
  1428. packets periodically, while setting watchDog to ENABLE_WATCHDOG, indicates 
  1429. that keep-alive packets and monitoring should be used.  Note:  There is no 
  1430. SPX system default value for watchDog.
  1431.  
  1432. Before calling this function, the following fields must contain valid 
  1433. information in ecb:
  1434.        _    ESRAddress - may contain a 0 or the address of a 
  1435. routine that will be called when the connection is established or aborted.
  1436.        _    socket - must contain the socket obtained from CIPXOpenSocketRTag.
  1437.        _    fragCount - must be set to 1
  1438.        _    fragList - fragment 0 points to a 42-byte buffer 
  1439. containing an SPX header.
  1440.  
  1441.     The SPX header must contain valid information in the following 
  1442. fields:
  1443.         destNet - 4 byte network address of the destination 
  1444. endpoint
  1445.         destNode - 6 byte node address of the destination endpoint
  1446.         destSocket - 2 byte socket number of the destination 
  1447. endpoint
  1448. All destination address fields are in high low byte order.  This means 
  1449. that the most significant byte is in the lowest memory address, while the 
  1450. least significant byte is in the highest memory address.
  1451.  
  1452. SPX allows applications to receive data packets in a fully asynchronous 
  1453. fashion, therefore this is a non-blocking call and execution control will 
  1454. return to the calling application before the connection is fully 
  1455. esished.  Once the connection has been established or the retry count 
  1456. has been exhausted, the status field of the ECB that was handed to 
  1457. CSPXEstablishConnection will be set to the appropriate value and if the 
  1458. ESRAddress field is non-zero the Es₧
  1459. │vent Service Routine (ESR) will be 
  1460. called.
  1461.  
  1462. On return the application must test the return code.  If an invalid ECB or 
  1463. invalid socket are passed, the call can fail.  In this case the status 
  1464. field of the ECB is set to the same value as the return code, however the 
  1465. ESR is not called.
  1466.  
  1467.     Valid values for the status field of ecb are:
  1468.         SPX_OK
  1469.         SPX_CONNECTION_FAILED
  1470.  
  1471. Diagnostics
  1472. Returns SPX_OK on success or one of the following on failure:
  1473.         SPX_MALFORMED_PACKET
  1474.         SPX_PACKET_OVERFLOW    (This is incorrectly returned)
  1475.         SPX_MALFORMED_PACKET    (This is the correct one)
  1476.         SPX_SOCKET_NOT_OPEN
  1477.         SPX_CONNECTION_TABLE_FULL
  1478.     Note:  The failure codes will also be placed in the status field of the 
  1479. ECB.
  1480.  
  1481. See Also
  1482.     CSPXListenForConnection
  1483.  
  1484. CSPXGetConnectionStatus
  1485.  
  1486. Name
  1487. CSPXGetConnectionStatus - Obtain connection information from SPX.
  1488.  
  1489. Synopsis
  1490.         LONG CSPXGetConnectionStatus(
  1491.                 LONG sessionID,
  1492.                 void *buffer);
  1493.  
  1494. Description
  1495. Return connection information to the application.  The following 40 byte 
  1496. buffer is returned in the location pointed to by buffer.  The sessionID 
  1497. was returned from a call to CSPXEstablishConnection or 
  1498. CSPXListenForConnection.
  1499.  
  1500.         typedef struct SPX_ConnStruct
  1501.         {
  1502.            unsigned char        sStatus;
  1503.            unsigned char        sFlags;
  1504.            unsigned 
  1505. short        sSourceConnectID;    /* hi-lo */
  1506.            unsigned short        sDestConnectID;    /* 
  1507. hi-lo */
  1508.            unsigned 
  1509. short        sSequenceNumber;    /* hi-lo */
  1510.            unsigned 
  1511. short        sAckNumber;        /* hi-lo */
  1512.            unsigned 
  1513. short        sAllocNumber;        /* hi-lo */
  1514.         
  1515.            unsigned 
  1516. short        sRemoteAckNumber;    /* hi-lo */
  1517.            unsigned 
  1518. short        sRemoteAllocNumber;    /* hi-lo */
  1519.         
  1520.            unsigned 
  1521. short        sLocalSocket;        /* Native */
  1522.            unsigned 
  1523. char        sImmediateAddress[6];    /* Net order */
  1524.         
  1525.            unsigned 
  1526. long        sRemoteNet;        /* Net order */
  1527.            unsigned 
  1528. char        sRemoteNode[6];        /* Net order */
  1529.            unsigned 
  1530. short        sRemoteSocket;        /* Net order */
  1531.         
  1532.            unsigned char        sRetransmitCount;
  1533.            unsigned char        sRetransmitMax;
  1534.            unsigned 
  1535. short        sRoundTripTimer;    /* hi-lo */
  1536.            unsigned 
  1537. short        sRetransmittedPackets;    /* hi-lo */
  1538.            unsigned 
  1539. short        sSuppressedPackets;    /* hi-lo */
  1540.         } SPX_SESSION1;
  1541.  
  1542.  
  1543. On return the following fields contain very useful information:
  1544.         sStatus            Contains one of the 
  1545. following status values:
  1546.                            
  1547. _    SPX_SSTATUS_WAITING - waiting for connection request
  1548.                            
  1549. _    SPX_SSTATUS_STARTING - waiting for response to 
  1550. CSPXEstablishConnection
  1551.                            
  1552. _    SPX_SSTATUS_ESTABLISHED - data transfer in full duplex mode
  1553.                            
  1554. _    SPX_SSTATUS_TERMINATING - waiting for acknowledgment to terminate 
  1555. request
  1556.         sRemoteNet            Network address of 
  1557. connection partner
  1558.         sRemoteNode[6];        Node address of connection 
  1559. partner
  1560.         sRemoteSocket        Socket address of connection 
  1561. partner
  1562.         sRetransmittedPackets    Number of retries that have 
  1563. occurred during the life of this session
  1564.         sSuppressedPackets    Number of duplicate packets that 
  1565. have been tossed during the life of this session
  1566.  
  1567.  
  1568.  
  1569. Diagnostics
  1570. Returns SPX_OK on success or one of the following on failure:
  1571.         SPX_INVALID_CONNECTION
  1572.  
  1573. See Also
  1574.     CSPXGetConnextionStatus2
  1575.  
  1576. CSPXGetConnectionStatus2
  1577.  
  1578. Name
  1579. CSPXGetConnectionStatus2 - Obtain connection information from SPX.
  1580.  
  1581. Synopsis
  1582.         LONG CSPXGetConnectionStatus2(
  1583.                 LONG sessionID,
  1584.                 void *buffer,
  1585.                 LONG bufferSize );
  1586.  
  1587.  
  1588. Description
  1589. Return connection information to the application.  The sessionID was 
  1590. returned from a call to CSPXEstablishConnection or CSPXListenForConnection
  1591. .  The following 60 byte buffer is returned in the location pointed to by 
  1592. buffer, however if bufferSize is less than 60 then only bufferSize bytes 
  1593. are returned in the location pointed to by buffer. For new applications 
  1594. this function should be used instead of CSPXGetConnectionStatus e it 
  1595. protects against buffer overflow and provides more information and more of 
  1596. it is in native machine order.
  1597.  
  1598.         typedef struct SPX_ConnStruct2
  1599.         {
  1600.            unsigned char           sStatus;
  1601.            unsigned char           sFlags;
  1602.            unsigned short          
  1603. sSourceConnectID;        /* hi-lo */
  1604.            unsigned short          
  1605. sDestConnectID;        /* hi-lo */
  1606.            unsigned short          
  1607. sSequenceNumber;        /* hi-lo */
  1608.            unsigne.9>d short          sAckNumber;        /* 
  1609. hi-lo */
  1610.            unsigned short          sAllocNumber;        /* 
  1611. hi-lo */
  1612.         
  1613.            unsigned short          
  1614. sRemoteAckNumber;        /* hi-lo */
  1615.            unsigned short          sRemoteAllocNumber;    /* 
  1616. hi-lo */
  1617.         
  1618.            unsigned short          sLocalSocket;        /* 
  1619. Native order */
  1620.            unsigned char           sImmediateAddrees[6];    /* 
  1621. Net order */
  1622.         
  1623.            unsigned long           
  1624. sRemoteNet;            /* Net order */
  1625.            unsigned char           
  1626. sRemoteNode[6];        /* Net order */
  1627.            unsigned short          
  1628. sRemoteSocket;        /* Net order */
  1629.         
  1630.            unsigned char           sRetransmitCount;
  1631.            unsigned char           sRetransmitMax;
  1632.            unsigned short          
  1633. sRoundTripTimer;        /* Native order */
  1634.            unsigned short          
  1635. sRetransmittedPackets;    /* Native order */
  1636.            unsigned short          
  1637. sSuppressedPackets;        /* Native order */
  1638.         
  1639.            unsigned short          
  1640. sLastReceiveTime;        /* Native order */
  1641.            unsigned short          
  1642. sLastSendTime;        /* Native order 
  1643. */                
  1644.            unsigned short          
  1645. sRoundTripMax;        /* Native order */
  1646.            unsigned short          
  1647. sWatchdogTimeout;        /* Native order */
  1648.            unsigned long           
  1649. sSessionXmitQHead;        /* Native pointer */
  1650.            unsigned long           
  1651. sSessionXmitECBp;        /* Native pointer */        
  1652.         } SPX_SESSION2;
  1653.  
  1654. On return the following fields contain very useful information:
  1655.         sStatus            Contains one of the 
  1656. following status values:
  1657.                            
  1658. _    SPX_SSTATUS_WAITING - waiting for connection request
  1659.                            
  1660. _    SPX_SSTATUS_STARTING - waiting for response to 
  1661. CSPXEstablishConnection
  1662.                            
  1663. _    SPX_SSTATUS_ESTABLISHED - data transfer in full duplex mode
  1664.                            
  1665. _    SPX_SSTATUS_TERMINATING - waiting for acknowledgment to terminate 
  1666. request
  1667.         sRemoteNet            Network address of 
  1668. connection partner
  1669.         sRemoteNode[6];        Node address of connection 
  1670. partner
  1671.         sRemoteSocket        Socket address of connection 
  1672. partner
  1673.         sRetransmittedPackets    Number of retries that have 
  1674. occurred during the life of this session
  1675.         sSuppressedPackets    Number of duplicate packets that 
  1676. have been tossed during the life of this session
  1677.  
  1678. Diagnostics
  1679. Returns SPX_OK on success or one of the following on failure:
  1680.         SPX_INVALID_CONNECTION
  1681.  
  1682. See Also
  1683.     CSPXGetConnectionStatus
  1684.  
  1685. CSPXGetTimersAndCounters
  1686.  
  1687. Name
  1688. CSPXGetTimersAndCounters - Obtain default configuration information from 
  1689. SPX.
  1690.  
  1691. Synopsis
  1692.         void CSPXGetTimersAndCounters(
  1693.                 int *abortTimeout,
  1694.                 int *listenTimeout,
  1695.                 int *verifyTimeout,
  1696.                 int *retryCount,
  1697.                 int *configuredSessions,
  1698.                 int *openSessions);
  1699.  
  1700. Description
  1701. Get several configuration timers and counters from SPX that are used as 
  1702. the beginning defaults for new sessions.  Each parameter points to a 
  1703. location that receives the following information.  If a NULL pointer is 
  1704. passed for any parameter then SPX will not return the current value for 
  1705. that variable.
  1706.  
  1707.         abortTimeout    Amount of time in PC tics that must 
  1708. elapse without receiving a packet from the connection partner before SPX 
  1709. will abort the connection.
  1710.         listenTimeout    Amount of time in PC tics that must 
  1711. elapse without receiving a packet from the connection partner before SPX 
  1712. will send an "are you there" packet.
  1713.         verifyTimeout    Amount of time in PC tics that must 
  1714. elapse without sending a packet to the connection partner before SPX will 
  1715. send a "keep alive packet".
  1716.         retryCount        Number of times SPX will retry a 
  1717. send without receiving an ACK from the connection partner before SPX will 
  1718. abort the connection.
  1719.         configuredSessions    Total number of SPX connections 
  1720. that can be established, waiting for connection completion or listening 
  1721. for connection requests at a given time.
  1722.         openSessions    Current number of SPX connections that are established, 
  1723. waiting for connection completion or listening for connection requests at 
  1724. the current time.
  1725.  
  1726. Diagnostics
  1727. No return value.
  1728.         
  1729.  
  1730. See Also
  1731.     CSPXSetTimersAndCounters
  1732.  
  1733. CSPXListenForConnectedPacket
  1734.  
  1735. Name
  1736. CSPXListenForConnectedPacket - Provide a receive buffer to a specific SPX 
  1737. connection.
  1738.  
  1739. Synopsis
  1740.         LONG CSPXListenForConnectedPacket(
  1741.                 IPX_ECB *ecb,
  1742.                 LONG sessionID);
  1743.  
  1744. Description
  1745. This function delivers an event control block (ECB) and the buffer space 
  1746. it identifies to SPX for the purpose of receiving a data packet and the 
  1747. function is identical to CSPXListenForSequencedPacket except that it 
  1748. allows you to post an ECB for the specific SPX session specified by 
  1749. sessionID, which was returned from a successful call to 
  1750. CSPXEstablishConnection or CSPXListenForConnection.  The function returns 
  1751. execution control to the calling application.
  1752.  
  1753.      Before calling this function, the following fields must contain 
  1754. valid information in ecb:
  1755.        _    ESRAddress - may contain a 0 or the address of a 
  1756. routine that will be called when data has been placed in the buffer 
  1757. defined by fragList.
  1758.        _    fragCount - must be at least 1
  1759.        _    fragList - must describe a buffer large enough to 
  1760. receive the data expected from the connection partner.  Fragment 0 must be 
  1761. at least 42 bytes long; the size of an SPX packet header.
  1762.  
  1763. SPX allows applications to receive data packets in a fully asynchronous 
  1764. fashion. Therefore, this function only identifies the given ECB for use in 
  1765. receiving data packets; the function does not wait for an actual packet to 
  1766. be received.
  1767.  
  1768. The ECB will remain in SPX control until an incoming data, connection 
  1769. termination or connection abort event occurs.  At the occurrence of one of 
  1770. these events, the status field of the ECB will be set to SPX_OK, 
  1771. SPX_CONNECTION_TERMINATED, or SPX_CONNECTION_FAILED respectively and if 
  1772. the ESRAddress field is non-zero the Event Service Routine (ESR) will be 
  1773. called.
  1774.  
  1775. When the application regains control of a valid ECB, there are two fields 
  1776. in the SPX header, connectionCtl and dataStreamType that may contain 
  1777. information set by the application at the other end of the connection.  
  1778. connectionCtl could have the end of message flag SPX_CC_EOM set, which 
  1779. implies that this data packet is the last packet of a larger transmission 
  1780. service data unit (TSDU) or large message.  Also dataStreamType can 
  1781. contain any application defined value between 0 and 127 inclusive.
  1782.     Although SPX provides the function CSPXTerminateConnection for 
  1783. terminating a connection, it is up to the application to detect that this 
  1784. has occurred by testing the dataStreamType field of each incoming data 
  1785. packet for the value SPX_DS_TERMINATE.
  1786.  
  1787. If status is set to SPX_PACKET_OVERFLOW then the ECB did not define 
  1788. sufficient buffer space to receive the incoming data, however, as much of 
  1789. the data as would fit into the ECB is valid, the ESR will be called if 
  1790. applicable and the connection is still active.
  1791.  
  1792. Diagnostics
  1793. Returns SPX_OK on success or one of the following on failure:
  1794.         SPX_INVALID_CONNECTION
  1795.         SPX_MALFORMED_PACKET
  1796.  
  1797. See Also
  1798.     CSPXListenForSequencedPacket
  1799.  
  1800. CSPXListenForConnection
  1801.  
  1802. Name
  1803. CSPXListenForConnection - Inform SPX to allow and wait for an incoming 
  1804. connection request.
  1805.  
  1806. Synopsis
  1807.         LONG CSPXListenForConnection(
  1808.                 BYTE retryCount,
  1809.                 BYTE watchDog,
  1810.                 LONG *sessionID,
  1811.                 IPX_ECB *ecb);
  1812.  
  1813. Description
  1814. This function is used to inform SPX that the application is willing to 
  1815. accept connection requests from other SPX endpoints.  The application can 
  1816. specify in retryCount the number of times SPX will resend a data packet or 
  1817. can use the system default by passing a zero.  A non-zero value for the 
  1818. watchDog flag will inform SPX to keep track of the connection once it is 
  1819. established by sending periodic "keep alive", and "are you there" system 
  1820. packets.  A connection identification number will be returned in the 
  1821. location pointed to by sessionID.  This value must be retained and is 
  1822. required by other SPX calls.
  1823.  
  1824. Before calling this function, the following fields must contain valid 
  1825. information in ecb:
  1826.        _    ESRAddress - may contain a 0 or the address of a 
  1827. routine that will be called when the connection is established or aborted.
  1828.        _    socket - must contain the socket obtained from CIPXOpenSocketRTag.
  1829.  
  1830. SPX allows applications to receive connection requests in a fully 
  1831. asynchronous fashion. Therefore, this function only identifies the given 
  1832. ECB for use in receiving the connection request; the function does not 
  1833. wait for an actual packet to be received.
  1834.  
  1835. The ECB will remain in SPX control until an incoming connection request, 
  1836. or connection abort event occurs.  At the occurrence of one of these 
  1837. events, the status field of the ECB will be set to SPX_OK, or 
  1838. SPX_CONNECTION_FAILED respectively and if the ESRAddress field is non-zero 
  1839. the Event Service Routine (ESR) will be called.
  1840.  
  1841. A call to CSPXAbortConnection or CSPXCancelSessionListen will cause SPX to 
  1842. release the ECB and no longer accept connection requests for the 
  1843. application.
  1844.  
  1845. Diagnostics
  1846. Returns SPX_OK on success or one of the following on failure:
  1847.         SPX_CONNECTION_TABLE_FULL
  1848.         SPX_SOCKET_NOT_OPEN
  1849.  
  1850. See Also
  1851.     CSPXAbortConnection, CSPXCancelSessionListen, CSPXEstablishConnection
  1852.  
  1853. CSPXListenForSequencedPacket
  1854.  
  1855. Name
  1856. CSPXListenForSequencedPacket - Provide a receive buffer to SPX for 
  1857. receiving data for any SPX connection on a specific IPX socket.
  1858.  
  1859. Synopsis
  1860.         LONG CSPXListenForSequencedPacket(
  1861.                 IPX_ECB *ecb);
  1862.  
  1863. Description
  1864. This function delivers an event control block (ECB) and the buffer space 
  1865. it identifies to SPX for the purpose of receiving a data packet and the 
  1866. function is identical to CSPXListenForConnectedPacket except that it 
  1867. allows you to post an ECB for all SPX sessions being multiplexed on a 
  1868. specific IPX socket.  Using this function ECBs can be given to SPX prior 
  1869. to any connections being established.  The function returns execution 
  1870. control to the calling application.
  1871.  
  1872. SPX allows applications to receive data packets in a fully asynchronous 
  1873. fashion. Therefore, this function only identifies the given ECB for use in 
  1874. receiving data packets; the function does not wait for an actual packet to 
  1875. be received.
  1876.  
  1877.      Before calling this function, the following fields must contain 
  1878. valid information in ecb:
  1879.        _    ESRAddress - may contain a 0 or the address of a 
  1880. routine that will be called when data has been placed in the buffer 
  1881. defined by fragList.
  1882.        _    socket - must contain the socket obtained from CIPXOpenSocketRTag.
  1883.        _    fragCount - must be at least 1
  1884.        _    fragList - must describe a buffer large enough to 
  1885. receive the data expected from the connection partner.  Fragment 0 must be 
  1886. at least 42 bytes long; the size of an SPX packet header.
  1887.  
  1888. The ECB will remain in SPX control until an incoming data, connection 
  1889. termination or connection abort event occurs.  At the occurrence of one of 
  1890. these events, the status field of the ECB will be set to SPX_OK, 
  1891. SPX_CONNECTION_TERMINATED, or SPX_CONNECTION_FAILED respectively and if 
  1892. the ESRAddress field is non-zero the Event Service Routine (ESR) will be 
  1893. called.
  1894.  
  1895. When the application regains control of a valid ECB, there are two fields 
  1896. in the SPX header, connectionCtl and dataStreamType that may contain 
  1897. information set by the application at the other end of the connection.  
  1898. connectionCtl could have the end of message flag SPX_CC_EOM set, which 
  1899. implies that this data packet is the last packet of a larger transmission 
  1900. service data unit (TSDU) or large message.  Also dataStreamType can 
  1901. contain any application defined value between 0 and 127 inclusive.
  1902.     Although SPX provides the function CSPXTerminateConnection for 
  1903. terminating a connection, it is up to the application to detect that this 
  1904. has occurred by testing the dataStreamType field of each incoming data 
  1905. packet for the value SPX_DS_TERMINATE.
  1906.  
  1907. If status is set to SPX_PACKET_OVERFLOW then the ECB did not define 
  1908. sufficient buffer space to receive the incoming data, however, as much of 
  1909. the data as would fit into the ECB is valid, the ESR will be called if 
  1910. applicable and the connection is still active.
  1911.  
  1912. Diagnostics
  1913. Returns SPX_OK on success or one of the following on failure:
  1914.         SPX_INVALID_CONNECTION
  1915.         SPX_MALFORMED_PACKET
  1916.         SPX_SOCKET_NOT_OPEN
  1917.  
  1918. See Also
  1919.     CSPXListenForConnectedPacket
  1920.  
  1921. CSPXSendSequencedPacket
  1922.  
  1923. Name
  1924. CSPXSendSequencedPacket - Send a data packet to the specified existing SPX 
  1925. connection partner.
  1926.  
  1927. Synopsis
  1928.         LONG CSPXSendSequencedPacket(
  1929.                 LONG sessionID,
  1930.                 IPX_ECB *ecb);
  1931.  
  1932. Description
  1933. This function will send the packet specified by ecb to the connection 
  1934. partner specified by sessionID.  The sessionID was returned from a call to 
  1935. CSPXEstablishConnection or CSPXListenForConnection.
  1936.  
  1937. SPX allows applications to send data in a fully asynchronous fashion. 
  1938. Therefore, this function provides the given event control block (ECB) for 
  1939. SPX to use until the packet has been acknowledged by the connection 
  1940. partner; the function does not wait for the send to complete.
  1941.  
  1942.      Before calling this function, the following fields must contain 
  1943. valid information in ecb:
  1944.        _    ESRAddress - may contain a 0 or the address of a 
  1945. routine that will be called when the data in the buffer defined by fragList
  1946.  has been transmitted and acknowledged.
  1947.        _    fragCount - must be at least 1
  1948.        _    fragList - must describe the buffer(s) that make up 
  1949. the intended data to send.  Fragment 0 must be at least 42 bytes long; the 
  1950. size of an SPX packet header.
  1951.  
  1952. There are two fields in the SPX header, connectionCtl and dataStreamType 
  1953. that can be set by the application.  connectionCtl should be initialized 
  1954. to 0 or if this data packet is the last packet of a larger transmission 
  1955. service data unit (TSDU) or large message, this field can be set to 
  1956. SPX_CC_EOM.  dataStreamType can be set to any value between 0 and 127 
  1957. inclusive.
  1958.  
  1959. The ECB will remain in SPX control until the data packet has been 
  1960. acknowledged by the connection partner or until the retry count has been 
  1961. exhausted.  When either of these events occurs, the status field of the 
  1962. ECB will be set to SPX_OK or SPX_CONNECTION_FAILED respectively and if the 
  1963. ESRAddress field is non-zero the Event Service Routine (ESR) will be 
  1964. called.
  1965.  
  1966. Diagnostics
  1967. Returns SPX_OK on success or one of the following on failure:
  1968.         SPX_INVALID_CONNECTION
  1969.         SPX_PACKET_OVERFLOW
  1970.  
  1971. See Also
  1972.     CSPXListenForSequencedPacket, CSPXListenForConnectedPacket
  1973.  
  1974. CSPXSetTimersAndCounters
  1975.  
  1976. Name
  1977. CSPXSetTimersAndCounters - Set the default configuration information 
  1978. inside of SPX.
  1979.  
  1980. Synopsis
  1981.         LONG CSPXSetTimersAndCounters(
  1982.                 int abortTimeout,
  1983.                 int listenTimeout,
  1984.                 int verifyTimeout,
  1985.                 int retryCount,
  1986.                 int configuredSessions);
  1987.  
  1988. Description
  1989. Set several configuration timers and counters inside SPX that are used as 
  1990. the beginning defaults for new sessions.  Each parameter identifies the 
  1991. new value for the respective control variable.  Passing a value of zero 
  1992. indicates, "leave previous value unchanged".
  1993.  
  1994.         abortTimeout        Amount of time in PC tics that 
  1995. must elapse without receiving a packet from the connection partner before 
  1996. SPX will abort the connection. Original system default value:  540 tics 
  1997. (30 seconds).
  1998.         listenTimeout        Amount of time in PC tics 
  1999. that must elapse without receiving a packet from the connection partner 
  2000. before SPX will send an "are you there" packet.  Original system default 
  2001. value:  108 tics (6 seconds).
  2002.         verifyTimeout        Amount of time in PC tics 
  2003. that must elapse without sending a packet to the connection partner before 
  2004. SPX will send a "keep alive packet".  Original system default value:  54 
  2005. tics (3 seconds).
  2006.         retryCount        Number of times SPX will retry a 
  2007. send without receiving an ACK from the connection partner before SPX will 
  2008. abort the connection.  Original system default value:  10 retries (total 
  2009. 11 send attempts).
  2010.         configuredSessions    Total number of SPX connections 
  2011. that can be established, waiting for connection completion or listening 
  2012. for connection requests at a given time.  Original system default value:  
  2013. 2000 connections (fixed value in 4.10).
  2014.  
  2015. Diagnostics
  2016. No return value.
  2017.  
  2018. See Also
  2019.     CSPXGetTimersAndCounters
  2020.  
  2021. CSPXTerminateConnection
  2022.  
  2023. Name
  2024. CSPXTerminateConnection - Terminate an existing SPX connection and inform 
  2025. the connection partner.
  2026.  
  2027. Synopsis
  2028.         LONG CSPXTerminateConnection(
  2029.                 LONG sessionID,
  2030.                 IPX_ECB *ecb);
  2031.  
  2032. Description
  2033. This function will terminate an existing SPX connection by sending a 
  2034. terminate connection request to the connection partner.  The sessionID was 
  2035. returned from a call to CSPXEstablishConnection or CSPXListenForConnection.
  2036.  
  2037. SPX allows applications to terminate connections in a fully asynchronous 
  2038. fashion. Therefore, this function only informs SPX and provides the given 
  2039. ECB for use in terminating the connection; the function does not wait for 
  2040. the termination to complete.
  2041.  
  2042. Before calling this function, the application must initialize the ECB's 
  2043. ESRAddress, fragCount, and fragList fields.  The first fragment in fragList
  2044.  must be at least 42 bytes long, which is the size of an SPX header.
  2045.  
  2046. The ECB will remain in SPX control until the termination packet has been 
  2047. acknowledged by the connection partner or until the retry count has been 
  2048. exhausted.  When either of these events occurs, the status field of the 
  2049. ECB will be set to SPX_OK or SPX_CONNECTION_FAILED respectively and if the 
  2050. ESRAddress field is non-zero the Event Service Routine (ESR) will be 
  2051. called.
  2052.  
  2053. If a connection has not been fully established (ie. CSPXListenForConnection
  2054.  has been called and no connection request has been received), then this 
  2055. function acts the same as CSPXCancelSessionListen.  The status field of 
  2056. the event control block (ECB) that was handed to CSPXListenForConnection 
  2057. will be set to SPX_CONNECTION_FAILED and if the ESRAddress field is 
  2058. non-zero the Event Service Routine (ESR) will be called.
  2059.  
  2060. If CSPXListenForConnectedPacket was used to provide ECB receive buffers to 
  2061. SPX, then all the ECB receive buffers will be released by SPX and the 
  2062. status field in the ECB will be set to SPX_CONNECTION_FAILED and if the 
  2063. ESRAddress field is non-zero the ESR will be called, for each ECB.
  2064.  
  2065.  
  2066.  
  2067. Diagnostics
  2068. Returns SPX_OK on success or one of the following on failure:
  2069.         SPX_INVALID_CONNECTION
  2070.         SPX_PACKET_OVERFLOW
  2071.  
  2072. See Also
  2073.     CSPXTerminateConnection, CSPXCancelSessionListen
  2074.  
  2075.  10    Appendix E - API Semantics and Characteristics
  2076.  
  2077.    _    The sending and receiving sides of an application assume that 
  2078. the exact packet sent is the same packet received.
  2079.    _    Length of packets and hardware capabilities are assumed.
  2080.    _    There is an implied state in the receipt of a particular 
  2081. packet.
  2082.    _    Very few applications use the end of message EOM bit
  2083.  
  2084.  11    Appendix G - Default, Minimum and Maximum Values
  2085.  
  2086. Documentation Constants
  2087. Throughout the document the following constants are used to indicate some 
  2088. value.  The table below provides the default, minimum and maximum values 
  2089. for each constant.
  2090.     Constant            Default        Min        Max
  2091.     RETRY_COUNT        10            3        50
  2092.     MIN_RETRY_DELAY    0  Zero means use standard algorithm.  See Calculating 
  2093. Timeouts and Van Jacobsen Average and Mean Deviation Calculations.
  2094.             1 ms        60 seconds
  2095.     MAX_RETRY_DELTA    5 seconds        1 second    60 
  2096. seconds
  2097.     MAX_RETRY_DELAY    (calculated from MIN_RETRY_DELAY and 
  2098. MAX_RETRY_DELTA)
  2099.     VERIFY_TIMEOUT        3 seconds        3 
  2100. seconds    5 minutes
  2101.     ABORT_TIMEOUT        30 seconds        30 
  2102. seconds    50 minutes
  2103.  
  2104.  
  2105. Connection Termination Reason Codes
  2106. A connection can be terminated for several reasons.  The following 
  2107. constants represent those reasons and provide the value that SPX II must 
  2108. generate.
  2109.  
  2110. SPX_CONNECTION_TERMINATED    0xec    A disconnect inform packet 
  2111. was received from the connection partner.
  2112. SPX_CONNECTION_FAILED    0xed    Watchdog timer detected failure, 
  2113. or retry count reached zero during a send operation
  2114. SPX_PACKET_OVERFLOW        0xfd    Internal consistency check 
  2115. failed, usually an indication that packet size negotiation failed to 
  2116. negotiate correctly.
  2117. SPX_MALFORMED_PACKET    0xfe    Secondary internal consistency 
  2118. check failed.  Usually used to report to application that an 
  2119. implementation bug has been detected.
  2120.  
  2121.  12    Appendix H - IPX Checksums
  2122.  
  2123. With the introduction of NetWare SFT III v3.11, it became necessary to 
  2124. provide checksum support for NetWare Core Protocol (NCP) packets.  IPX is 
  2125. a datagram service and there is no way of "negotiating" whether the two 
  2126. endpoints support checksums before the first packet is sent, so NCP 
  2127. negotiates this option and then if both endpoints support checksums NCP 
  2128. tells IPX to checksum the packets.  SPX II like NCP also has an option 
  2129. negotiation mechanism during connection establishment.  If the endpoints 
  2130. negotiate that checksums are to be used, the checksum algorithm is:
  2131.  
  2132.    _    Initialize the checksum field of the IPX header to zero
  2133.    _    Summation (add with carry) of all words (16 bits) in the 
  2134. packet, with the words being picked up as "little endian" (Intel order) 
  2135. unsigned values.
  2136.    _    If the number of bytes in the packet is odd, the high order 
  2137. byte necessary for the last word summation is set to zero.
  2138.    _    Add in final overflow indication (carry flag).
  2139.    _    Negate (1's complement)
  2140.    _    Store in IPX header checksum field
  2141.  
  2142. To verify the checksum the steps are similar:
  2143.  
  2144.    _    Summation (add with carry) of all words (16 bits) in the 
  2145. packet, with the words being picked up as "little endian" (Intel order) 
  2146. unsigned values.
  2147.    _    If the number of bytes in the packet is odd, the high order 
  2148. byte necessary for the last word summation is set to zero, then add in 
  2149. final overflow indication (carry flag).
  2150.    _    Add in final overflow indication (carry flag).
  2151.    _    The result should be -1, if not an error has occurred.
  2152.  
  2153. The default negotiation value for checksums is NO checksums.  If an 
  2154. application wants to negotiate checksums with its connection partner it 
  2155. can do so using the TLI t_optmgmt function and by setting the 
  2156. spxIISessionFlags field of the SPX2_OPTIONS structure to 
  2157. SPX_SF_IPX_CHECKSUM.
  2158.  
  2159. If the implementation of SPX II at both endpoints support IPX checksums 
  2160. and if both the host and client applications have requested IPX checksums, 
  2161. then SPX II will checksum every packet after the session is in data 
  2162. transfer state.  Once both endpoints agree that IPX checksums will be used 
  2163. a packet with 0xFFFF in Checksum must still be accepted.  This allows for 
  2164. a retransmitted Session Setup packet or for a delayed Session Setup ACK.
  2165.  
  2166. Index
  2167.  
  2168. Abort    13, 14, 18, 26, 40, 42, 44, 46, 50, 55
  2169. ACK    7, 9-11, 13-15, 17, 20, 23-26, 29, 40, 50, 56
  2170. Acknowledge Number    3, 9-12, 17, 18
  2171. Allocation Number    3, 9-12, 18, 19
  2172. Checksum    3, 9-11, 29, 56
  2173. Congestion    18, 20
  2174. Connection Ack    10, 13, 15
  2175. Connection Control    3, 7, 9-11, 17, 29
  2176. Connection ID    3, 7, 9-11, 16
  2177. Connection ID Numbers    7, 16
  2178. Connection Management    7, 10, 13
  2179. Connection Request    1, 5, 7, 10, 13, 14, 27, 30, 32, 37, 39, 44, 52
  2180. Daa Transfer State    56
  2181. Datastream Type    3, 7, 9-11
  2182. Default    14, 17, 19, 27, 34, 40, 44, 50, 55, 56
  2183. Destination Connection ID    7
  2184. Destination Network    3, 4
  2185. Destination Node    3, 4
  2186. Destination Socket    3, 4
  2187. Disconnect    10-14, 19, 24, 25, 55
  2188. Extended Acknowledge    7, 14
  2189. Header Definition    3, 9-11, 29
  2190. Informed Disconnect    10-14, 19, 30
  2191. Large Packets    1
  2192. Length    2-4, 9-11, 54
  2193. Maximum    4, 16, 19, 33, 34, 55
  2194. Minimum    4, 55
  2195. Negotiate Size Request    7
  2196. Negotiation    55, 56
  2197. Packet Definition    13
  2198. Packet Type    3, 4, 9-11
  2199. Retry    13, 17-21, 23, 24, 34, 35, 40, 48, 50, 52, 55
  2200. Round Trip Time    17, 21
  2201. Sequence Number    3, 7, 9-14, 17-19
  2202. Session Setup    56
  2203. Session Termination    13
  2204. Session Watchdog    14
  2205. Source Connection ID    3, 7, 9-11
  2206. Source Network    3, 5
  2207. Source Node    3-5
  2208. Source Socket    3, 5, 6
  2209. Timeout    14, 17-21, 55
  2210. TLI    14, 56
  2211. Transport Control    3, 4, 9-11
  2212. Unilateral Abort    13, 14, 18
  2213. Watchdog    13-15, 17, 19, 22, 23, 26, 34, 44, 55
  2214. Window    1, 9, 10, 13, 14, 17-19
  2215.