home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / CPI-C.ZIP / JQCPIC.DOC < prev    next >
Text File  |  1992-07-22  |  13KB  |  322 lines

  1. JOHN Q'S CPI-C ABUSER PROGRAMS
  2.  
  3.  
  4. Dr. John Q. Walker II
  5. July 25, 1992
  6. version 1.04
  7.  
  8. IBM Corporation
  9. APPC Market Enablement
  10. Department E42, Building 673
  11. P.O. Box 12195
  12. 200 Silicon Drive
  13. Research Triangle Park, North Carolina USA  27709
  14. -------------------------------------------------
  15. Telephone: 919-254-4414
  16. Internet: johnq@vnet.ibm.com
  17.  
  18.  
  19.  
  20. JUST TWO SMALL PROGRAMS: JQCPIC and JQCPICD
  21.  
  22. Let's randomly issue all the CPI-C conversation calls in a loop!
  23. Application programmers: Can the CPI-C client and server programs
  24. you build successfully handle every conceivable input?  Platform
  25. vendors:  Can your CPI-C implementation withstand this onslaught?
  26.  
  27. JQCPIC (the client side) and JQCPICD (the server side) are a pair
  28. of distributed programs that issue the CPI-C conversation calls
  29. randomly.  Valid and invalid parameters are generated for each
  30. call.
  31.  
  32. The client side, JQCPIC, starts by issuing
  33. Initialize_Conversation and Allocate (CMINIT and CMALLC) calls.
  34. It loops forever, issuing calls, and returning the new
  35. conversation state.  One parameter is required: a symbolic
  36. destination name.  End the client side any time by pressing the
  37. letter Q (for "quit").
  38.  
  39. The server side, JQCPICD, is started remotely by incoming
  40. Attaches issued by the client side.  It first issues an
  41. Accept_Conversation (CMACCP) call.  It continues to loop on valid
  42. calls until it deallocates the conversation (or has the
  43. conversation deallocated out from under it by the client).  The
  44. server program then exits, but another will soon be started by
  45. the next incoming Attach from the client.  No parameters are
  46. required for the server side.
  47.  
  48. Once you find your CPI-C platform implementation to be robust,
  49. you'll find this pair of programs to be good at generating all
  50. types of traffic on a session.  There are lots of communications
  51. testing situations where you can find a use for a pair of
  52. programs that generate every type of reasonable SNA traffic.  For
  53. example, this can be used for testing of APPN network node
  54. implementations; lash together 10's or 100's of network nodes,
  55. and run this pair of programs between lots of different LEN
  56. nodes, end nodes, and network nodes.
  57.  
  58. Another good use for these programs: suppose you're writing a
  59. server application (for any platform), using CPI-C or a native
  60. APPC programming interface.  Remember: you ought to be able to
  61. lock a server in a closet; thus it should be able to run forever:
  62.  
  63. -    dealing amicably with ANY incoming traffic
  64. -    never entering a hang state
  65. -    servicing every incoming Attach or Deallocate
  66. -    always logging the right error condition no matter what it
  67.      gets.
  68.  
  69. JQCPIC (the client side) is just what the doctor ordered for
  70. testing your server application!  Conversely, can any client
  71. program you design withstand the garbage this server side can
  72. generate?
  73.  
  74.  
  75. CONFIGURATION
  76.  
  77. There are no names or other assumptions hard-coded into these
  78. programs.  You must set up the DLCs, links, LUs, modes, sessions,
  79. and TPs needed by each computer in the conversation.
  80.  
  81. Client Side requirements...
  82.  
  83. To start the client side, JQCPIC, you must specify a symbolic
  84. destination name, which contains the information necessary to get
  85. to the server.  To use a CPI-C symbolic destination name, you
  86. must first have configured it on your computer.  A symbolic
  87. destination name is actually a pointer to a record consisting
  88. of three parts.
  89.  
  90. Partner LU name:    Configure the name of the partner LU that the
  91.                     server will be using.
  92.  
  93. Mode name:          Configure the name of a mode known to both
  94.                     your computer and your partner.  If in doubt,
  95.                     use "#INTER".
  96.  
  97. TP name:            Configure the name that will flow to the
  98.                     partner in the Attach.  This name will have
  99.                     to be configured in the TP definition at the
  100.                     server side.  If in doubt, use "JQCPICD",
  101.                     which is the name of the executable program
  102.                     on the server; this can make things easier.
  103.  
  104. You can pick any 8-character name you want for the symbolic
  105. destination name, since this name is never communicated to the
  106. partner.  You use it only on the command line of the client side.
  107.  
  108. You'll need to assure there's a local LU in each client, of
  109. course.
  110.  
  111.  
  112. Server Side requirements...
  113.  
  114. To have the server side be remotely started, you must specify the
  115. handling necessary when a TP name arrives in an incoming Attach.
  116. This requires a TP definition at the server.
  117.  
  118. TP name:            Configure the TP definition necessary to get
  119.                     the server program started.  One key
  120.                     parameter is the name of the executable
  121.                     program; for example, in DOS or OS/2, this
  122.                     name is JQCPICD.EXE.  This program should be
  123.                     Attach Manager started, either queued or non-
  124.                     queued.
  125.  
  126. Of course, you'll need to configure a local LU and a mode in the
  127. server.  Let each client know the name of these.
  128.  
  129.  
  130. HANGS AND BEEPS
  131.  
  132. The server side should never hang.
  133.  
  134. The client side can hang in two conditions: 1) after a CMALLC,
  135. waiting to get a session with the server, or 2) after a later
  136. call that causes the send buffer to be flushed, and thus causes
  137. the Attach to flow to the partner.  The client side will wait
  138. until the Attach is accepted by the server.
  139.  
  140. These programs "beep" and continue when they encounter invalid
  141. values (that is, bugs in the CPI-C platform implementation).  As
  142. a tester, I chose to have the programs continue, assuming they'll
  143. get into unexpected error-handling code that's even worse than
  144. the real bug.  As a platform implementer, you'll probably want to
  145. fix your bugs--meaning you'll want to stop everything when one of
  146. these occurs and look at the trace.
  147.  
  148.  
  149. LET'S MAKE THIS NASTIER!
  150.  
  151. Let's assume you've got the pair running without problems for
  152. hours and days on end.  Then it's time to start abusing the
  153. environment, and see if recovery is complete and timely.  You
  154. ought to be able to kill the server side at any time after it has
  155. issued its CMACCP call (e.g., using Ctrl+Break).  The server side
  156. should clean up cleanly, the client side should be deallocated,
  157. and the client should loop back to another CMINIT and CMALLC.
  158. Try unplugging cables in the middle of the network--in fact, try
  159. any nasty thing you can think of.  The client side should plod
  160. away forever; the server side should awaken whenever it gets an
  161. Attach, and run until one side or the other deallocates.
  162.  
  163. For example, while the pair are running...
  164. -    deactivate the DLC at the server side, then reactivate it
  165. -    deactivate the DLC at the client side, then reactivate it
  166. -    deactivate the link between the pair, then reactivate it
  167. -    deactivate the TP on the client side as soon as it's running
  168. -    deactivate the session between the pair, then let it be
  169.      reactivated by the next CMALLC
  170. -    unplug the wiring between the pair, then reconnect it
  171. -    stop the attach manager on the server side, then start it
  172.      again
  173. -    kill the program on the server side, e.g., using Ctrl+Break
  174.      on DOS or OS/2
  175. -    start up 10, 100, or 1000 copies of the client program.
  176.      Start 'em until your operating system gives out.  Are the
  177.      symptoms that are reported the right ones?
  178.  
  179. JQCPIC and JQCPICD are designed to be small, simple, easily
  180. maintainable, and portable.  Are there some simple revisions to
  181. these programs that would make them 1) more portable, and 2) more
  182. nasty?  I don't want these to grow huge, and I don't want to
  183. reproduce the whole CPI-C state table.  Let's keep it simple, but
  184. ever more abusive!  I welcome your feedback and code revisions.
  185.  
  186.  
  187. COLIN WEST'S EXCELLENT SET OF CPI-C RANDOM TEST TOOLS
  188.  
  189. JQCPIC and JQCPICD are meant to compliment, not replace, Colin
  190. West's extensive CPI-C random test tools.  Here are some of the
  191. differences:
  192.  
  193. JQCPIC                          Colin's Random Tester
  194.  
  195. -    will generate bad          -    generates only good,
  196.      parameters                      valid parameters
  197.  
  198. -    no state machine; issues   -    extensive FSM: determines
  199.      Extract Conversation            the next state, based on
  200.      State after every call.         supplied and returned
  201.                                      parameters
  202.  
  203. -    no checking of the data    -    continuous checking of
  204.      stream contents on Send         data stream contents.  No
  205.      and Receive                     byte in the data goes
  206.                                      unaccounted for.
  207.  
  208. -    no recognition of          -    support for syncpoint
  209.      syncpoint (CPI-RR) return       calls, return codes, and
  210.      codes or states                 states
  211.  
  212. Colin's tools have been used for testing on many IBM CPI-C
  213. platforms.  He can be reached in IBM at his VNET ID:
  214. CW at ZURLVM1.
  215.  
  216.  
  217. WHO'S PASSED THE TEST?
  218.  
  219. OS/2:     I've tested this from OS/2 to OS/2 Extended Services,
  220.           in one computer and between a pair.  If you're using
  221.           Networking Services/2 (NS/2), make sure you have at
  222.           least CSD WR1003.
  223.  
  224. Let me know if your platform can pass this abuse.  I'll keep the
  225. list updated.  Send me your working makefiles.
  226.  
  227.  
  228. LIMITATIONS AND RESTRICTIONS
  229.  
  230. -    You'll want to have tracing active, in case you encounter
  231.      problems.  You'll need API traces to see the parameters and
  232.      the sequencing of the most recent CPI-C calls.
  233.  
  234. -    There are no product-specific CPI-C extensions supported.
  235.  
  236. -    There's no support for any of the X/Open CPI-C calls that
  237.      aren't in IBM SAA CPI-C.  I've based these programs on the
  238.      IBM SAA CPI-C Reference, SC26-4399-04.
  239.  
  240. -    These program rely on the Extract_Conversation_State call.
  241.      This call isn't supported on MVS, OS/400, and IMS, so don't
  242.      expect to port these programs to those platforms painlessly.
  243.  
  244.      (John Q's opinion: look, this is the "Common Programming
  245.      Interface for Communications."  It seems inexcusable that
  246.      this common call isn't supported on these (or any other)
  247.      CPI-C platforms.  Step up to the real world, team!)
  248.  
  249. -    With basic conversations, there is no specific support for
  250.      building LLs.  So, the send side is pretty brain-dead in
  251.      this area, with the potential for building lots of partial
  252.      or continued LLs.
  253.  
  254.  
  255. ASSEMBLY REQUIRED FOR YOUR PLATFORM?
  256.  
  257. If you are recompiling these programs for your platform, you'll
  258. need to make sure you have all the parts!  Here's a list of those
  259. parts:
  260.  
  261. BUILD    C     - contains one procedure for each CPI-C call
  262. CALLS    C     - miscellaneous procedures
  263. CMDLIN   C     - command line parsing
  264. CPICDEFS C     - use constants and arrays to generate strings
  265. JQCPIC   C     - contains main
  266.  
  267. PORT     C     - port these procedures
  268. SHOW     C     - write strings
  269. JQCPIC   EXE   - executable program (client side)
  270. JQCPICD  EXE   - executable program (server side)
  271. BUILD    H     - function prototypes for the BUILD.C functions
  272. CALLS    H     - contains the table of valid calls and states
  273. CPICDEFS H     - maps CPI-C constants to readable strings
  274. JQCPIC   H     - typedefs, enums, function prototypes, etc.
  275. PORT     H     - function prototypes for the PORT.C functions
  276. MAKEFILE       - makefile for MS C 6.00A, DOS and OS/2
  277.  
  278. There's only one set of source code.  To build the server side,
  279. define an external constant, SERVER_SIDE.  If you don't define
  280. that constant, you'll get the client side.  See the makefile for
  281. an example.
  282.  
  283. I've defined another external constant: NOCPIC.  If you
  284. externally define NOCPIC, then the two programs can run on their
  285. own--with no calls to CPI-C, randomly generating states and
  286. return codes.  This is good for testing your programs without
  287. requiring any communications setup.  (I'm a true believer in
  288. iterative refinement; take it a step at a time!)
  289.  
  290. There's a constant named VALID_PARM_PERCENTAGE that's used to
  291. determine the probability of generating a good parameter.  It's
  292. declared in JQCPIC.H, and used in function generate_valid_parm().
  293.  
  294. Life as a programmer is made much easier by the structure called
  295. CPIC_CONV_ATTRIB (see CPICDEFS.H).  It contains all the fields
  296. needed for one conversation.  By passing around a pointer to it,
  297. the procedures know all about the current status of the
  298. conversation, along with all its possible CPI-C attributes.
  299.  
  300.  
  301. PERFORMANCE EXPECTATIONS
  302.  
  303. I use the following configuration extensively to test these
  304. programs:
  305. -    IBM PS/2 Model P70, 386DX/16
  306. -    OS/2 2.0, OS/2 Extended Services 1.0
  307. -    one LU (I test in this one machine, with LU=OWN)
  308. -    JQCPICD's TP definition (for the Attach Manager) set to run
  309.      in the background (minimizing screen I/O).
  310.  
  311. Running both sides on this single computer, I see a rate of about
  312. 30 verbs per second on the client side (with tracing off), and 20
  313. verbs per second (with tracing on).
  314.  
  315.  
  316. ACKNOWLEDGEMENTS
  317.  
  318. -    Tim Huntley
  319. -    Dan Poirier
  320. -    Peter Schwaller
  321. -    Colin West
  322.