TEXT_NEGOTIATION
----------------

A list of scenarios from the point of view of the target actions needed to reply
to a text request sent from the initiator.  Each scenario is described with one
line containing a text request from the initiator, and this is followed by one
or more lines each representing a possible reply from the target.

There are 18 enumerated scenarios.

Each scenario line has 9 columns.

Column headings:
---------------

no		number of this scenario

sndr		sending side -- init (text request sent by initiator),
				targ (reply sent by target)

in_prog		target's in_progress pointer
		(for init, at time text request arrives at target;
		 for targ, after target sends text reply) --
			NULL (nothing in progress at target),
			C=xxx (for init, pointer to target's in_progress struct
			       which must have this C value (0, 1);
			       for targ, illegal option),
			reply (for init, illegal option;
			       for targ, pointer to target's in_progress struct,
					 where:
					 ITT, TTT, C values equal those in
						     target's reply (indicated
						     in separate columns)
					 I value equals that in initiator's
					   request that provoked the reply)
			same (for init, illegal option;
			      for targ, unchanged)

ITT		Initiator Task Tag and I-bit in Request or Reply --
			-1 means ITT=0xffffffff and I=0 or I=1,
			new (for init, !=in_prog->ITT or I;
			     for targ, illegal option),
			same (for init, == in_prog->ITT and I;
			      for targ, == init->ITT and I)

TTT		Target Transfer Tag and LUN in Request or Reply --
			-1 means TTT=0xffffffff and LUN=0,
			new (for init, !=in_prog->TTT or LUN;
			     for targ, generate new TTT, LUN),
			same (for init, == in_prog->TTT and LUN;
			      for targ, == init->ITT and LUN)

DSL		Data Segment Length in Request or Reply -- any, 0, >0

C		C-bit in Request or Reply -- any, 0, 1

F		F-bit in Request or Reply -- any, 0, 1

Explanation	explains the request received from init or reply sent by targ

Scenarios:
---------

no sndr	in_prog	ITT	TTT	DSL	C	F	Explanation
-- ----	-------	---	---	---	-	-	-----------
 0 init any	-1	any	any	any	any	ERROR ITT = -1
   targ	same						Reject protocol error

 1 init	any	any	any	any	1	1	ERROR C = F = 1
   targ	same						Reject protocol error

 2 init	NULL	new	-1	any	0	0	1st pdu, more after
   targ	reply	same	new	any	0	0	1st or only reply
or targ reply	same	new	any	1	0	1st part of reply

 3 init	NULL	new	-1	any	0	1	only pdu
   targ	NULL	same	-1	any	0	1	only reply
or targ reply	same	new	any	0	0	1st reply, more after
or targ reply	same	new	any	1	0	1st part of reply

 4 init	NULL	new	-1	any	1	0	1st part of pdu
   targ	reply	same	new	0	0	0	empty reply

 5 init NULL	new	!=-1	any	any	any	ERROR TTT != -1
   targ	NULL						Reject protocol error

 6 init	C=0/1	new	any	any	any	any	ERROR ITT != in_prog
   targ	same						Reject protocol error

 7 init	C=0/1	same	-1	any	0	0	reset, more after
   targ	reply	same	new	any	0	0	1st or only reply
or targ reply	same	new	any	1	0	1st part of reply

 8 init	C=0/1	same	-1	any	0	1	reset, only pdu
   targ	NULL	same	-1	any	0	1	only reply
or targ reply	same	new	any	0	0	1st reply, more after
or targ reply	same	new	any	1	0	1st part of reply

 9 init C=0/1	same	-1	any	1	0	reset, 1st part
   targ	reply	same	new	0	0	0	empty reply

10 init C=0/1	same	new	any	any	any	ERROR TTT != expected
   targ	same						Reject protocol error

Scenarios continued:
-------------------
no sndr	in_prog	ITT	TTT	DSL	C	F	Explanation
-- ----	-------	---	---	---	-	-	-----------

11 init	C=0	same	same	any	0	0	next pdu, more after
   targ	reply	same	new??	any	0	0	next or only reply
or targ reply	same	new??	any	1	0	1st part of reply

12 init	C=0	same	same	any	0	1	last pdu
   targ	NULL	same	-1	any	0	1	last reply
or targ reply	same	new??	any	0	0	next reply, more after
or targ reply	same	new??	any	1	0	1st part of reply

13 init	C=0	same	same	any	1	0	1st part of pdu
   targ	reply	same	new??	0	0	0	empty reply

14 init	C=1	same	same	>0	0	any	ERROR DSL > 0
   targ	same						Reject protocol error

15 init	C=1	same	same	0	0	0	empty pdu, more after
   targ	reply	same	new??	any	0	0	last part of reply
or targ reply	same	new??	any	1	0	next part of reply

16 init	C=1	same	same	0	0	1	empty pdu, only pdu
   targ reply	same	new??	any	0	0	last part of reply, more
or targ	NULL	same	-1	any	0	1	last part of last reply
or targ reply	same	new??	any	1	0	next part of reply

17 init	C=1	same	same	any	1	0	ERROR C = 1
   targ	same						Reject protocol error
