sys/netccitt/llc_subr.c
/*
 * AWAIT_REJECT --- A data link connection exists between the local LLC service
 *                  access point and the remote LLC service access point. The
 *                  local connection component has requested that the remote
 *                  connection component re-transmit a specific I PDU that the
 *                  local connection component has detected as being out of
 *                  sequence. Before the local LLC entered this state it was
 *                  performing a timer recovery operation and had sent a
 *                  command PDU with the P bit set to ``1'', and is still
 *                  awaiting an acknowledgment from the remote LLC. I PDUs may
 *                  be received but not transmitted. Supervisory PDUs may be
 *                  both transmitted and received.
 */
A data link connection exists between the local LLC service
access point and the remote LLC service access point. The
local connection component has requested that the remote
connection component re-transmit a specific I PDU that the
local connection component has detected as being out of
sequence. Before the local LLC entered this state it was
performing a timer recovery operation and had sent a
command PDU with the P bit set to ``1'', and is still
awaiting an acknowledgment from the remote LLC. I PDUs may
be received but not transmitted. Supervisory PDUs may be
both transmitted and received.
A data link connection exists between the local LLC service access point and the remote LLC service access point . The local connection component has requested that the remote connection component re - transmit a specific I PDU that the local connection component has detected as being out of sequence . Before the local LLC entered this state it was performing a timer recovery operation and had sent a command PDU with the P bit set to ` ` 1 ' ' and is still awaiting an acknowledgment from the remote LLC . I PDUs may be received but not transmitted . Supervisory PDUs may be both transmitted and received .
int
llc_state_AWAIT_REJECT(struct llc_linkcb *linkp, struct llc *frame, int frame_kind,
		       int cmdrsp, int pollfinal)
{
	int action = LLC_PASSITON;
	switch(frame_kind + cmdrsp) {
	case LLC_LOCAL_BUSY_DETECTED:
		llc_send(linkp, LLCFT_RNR, LLC_CMD, 0);
		LLC_SETFLAG(linkp, DATA, 2);
		LLC_NEWSTATE(linkp, AWAIT_BUSY);
		action = 0;
		break;
	case LLC_INVALID_NS + LLC_CMD:
	case LLC_INVALID_NS + LLC_RSP: {
		register int nr = LLCGBITS(frame->llc_control_ext, s_nr);
		if (cmdrsp == LLC_CMD && pollfinal == 1) {
			llc_send(linkp, LLCFT_RR, LLC_RSP, 1);
			LLC_UPDATE_NR_RECEIVED(linkp, nr);
			action = 0;
		} else if (cmdrsp == LLC_RSP && pollfinal == 1) {
			LLC_UPDATE_NR_RECEIVED(linkp, nr);
			linkp->llcl_vs = nr;
			llc_resend(linkp, LLC_CMD, 1);
			LLC_START_P_TIMER(linkp);
			LLC_CLEAR_REMOTE_BUSY(linkp, action);
			LLC_NEWSTATE(linkp, REJECT);
		} else if (pollfinal == 0) {
			LLC_UPDATE_NR_RECEIVED(linkp, nr);
			action = 0;	
		}
		break;
	}
	case LLCFT_INFO + LLC_CMD:
	case LLCFT_INFO + LLC_RSP: {
		register int nr = LLCGBITS(frame->llc_control_ext, s_nr);
		if (cmdrsp == LLC_CMD && pollfinal == 1) {
			LLC_INC(linkp->llcl_vr);
			llc_send(linkp, LLCFT_RR, LLC_RSP, 1);
			LLC_STOP_REJ_TIMER(linkp);
			LLC_UPDATE_NR_RECEIVED(linkp, nr);
			LLC_NEWSTATE(linkp, AWAIT);
			action = LLC_DATA_INDICATION;
		} else if (cmdrsp == LLC_RSP && pollfinal == 1) {
			LLC_INC(linkp->llcl_vr);
			LLC_STOP_P_TIMER(linkp);
			LLC_STOP_REJ_TIMER(linkp);
			LLC_UPDATE_NR_RECEIVED(linkp, nr);
			linkp->llcl_vs = nr;
			llc_resend(linkp, LLC_CMD, 0);
			LLC_CLEAR_REMOTE_BUSY(linkp, action);
			LLC_NEWSTATE(linkp, NORMAL);
			action = LLC_DATA_INDICATION;
		} else if (pollfinal == 0) {
			LLC_INC(linkp->llcl_vr);
			llc_send(linkp, LLCFT_RR, LLC_CMD, 0);
			LLC_STOP_REJ_TIMER(linkp);
			LLC_UPDATE_NR_RECEIVED(linkp, nr);
			LLC_NEWSTATE(linkp, AWAIT);
			action = LLC_DATA_INDICATION;
		}
		break;
	}
	case LLCFT_RR + LLC_CMD:
	case LLCFT_REJ + LLC_CMD:
	case LLCFT_RR + LLC_RSP:
	case LLCFT_REJ + LLC_RSP: {
		register int nr = LLCGBITS(frame->llc_control_ext, s_nr);
		if (cmdrsp == LLC_CMD && pollfinal ==  1) {
			llc_send(linkp, LLCFT_RR, LLC_RSP, 1);
			LLC_UPDATE_NR_RECEIVED(linkp, nr);
			LLC_CLEAR_REMOTE_BUSY(linkp, action);
		} else if (cmdrsp == LLC_RSP && pollfinal == 1) {
			LLC_UPDATE_NR_RECEIVED(linkp, nr);
			linkp->llcl_vs = nr;
			llc_resend(linkp, LLC_CMD, 1);
			LLC_START_P_TIMER(linkp);
			LLC_CLEAR_REMOTE_BUSY(linkp, action);
			LLC_NEWSTATE(linkp, REJECT);
		} else if (pollfinal == 0) {
			LLC_UPDATE_NR_RECEIVED(linkp, nr);
			LLC_CLEAR_REMOTE_BUSY(linkp, action);
		}
		break;
	}
	case LLCFT_RNR + LLC_CMD:
	case LLCFT_RNR + LLC_RSP: {
		register int nr = LLCGBITS(frame->llc_control_ext, s_nr);
		if (cmdrsp == LLC_CMD && pollfinal == 1) {
			llc_send(linkp, LLCFT_RR, LLC_RSP, 1);
			LLC_UPDATE_NR_RECEIVED(linkp, nr);
			LLC_SET_REMOTE_BUSY(linkp, action);
		} else if (cmdrsp == LLC_RSP && pollfinal == 1) {
			LLC_UPDATE_NR_RECEIVED(linkp, nr);
			linkp->llcl_vs = nr;
			LLC_STOP_P_TIMER(linkp);
			LLC_SET_REMOTE_BUSY(linkp, action);
			LLC_NEWSTATE(linkp, REJECT);
		} else if (pollfinal == 0) {
			LLC_UPDATE_NR_RECEIVED(linkp, nr);
			LLC_SET_REMOTE_BUSY(linkp, action);
		}
		break;
	}
	case LLC_P_TIMER_EXPIRED:
		if (linkp->llcl_retry < llc_n2) {
			llc_send(linkp, LLCFT_REJ, LLC_CMD, 1);
			LLC_START_P_TIMER(linkp);
			linkp->llcl_retry++;
			action = 0;
		}
		break;
	}
	if (action == LLC_PASSITON)
		action = llc_state_NBRAcore(linkp, frame, frame_kind, 
					    cmdrsp, pollfinal);
	return action;
}
int llc_state_AWAIT_REJECT ( struct llc_linkcb * linkp , struct llc * frame , int frame_kind , int cmdrsp , int pollfinal ) { int action = LLC_PASSITON ; switch ( frame_kind + cmdrsp ) { case LLC_LOCAL_BUSY_DETECTED : llc_send ( linkp , LLCFT_RNR , LLC_CMD , 0 ) ; LLC_SETFLAG ( linkp , DATA , 2 ) ; LLC_NEWSTATE ( linkp , AWAIT_BUSY ) ; action = 0 ; break ; case LLC_INVALID_NS + LLC_CMD : case LLC_INVALID_NS + LLC_RSP : { register int nr = LLCGBITS ( frame -> llc_control_ext , s_nr ) ; if ( cmdrsp == LLC_CMD && pollfinal == 1 ) { llc_send ( linkp , LLCFT_RR , LLC_RSP , 1 ) ; LLC_UPDATE_NR_RECEIVED ( linkp , nr ) ; action = 0 ; } else if ( cmdrsp == LLC_RSP && pollfinal == 1 ) { LLC_UPDATE_NR_RECEIVED ( linkp , nr ) ; linkp -> llcl_vs = nr ; llc_resend ( linkp , LLC_CMD , 1 ) ; LLC_START_P_TIMER ( linkp ) ; LLC_CLEAR_REMOTE_BUSY ( linkp , action ) ; LLC_NEWSTATE ( linkp , REJECT ) ; } else if ( pollfinal == 0 ) { LLC_UPDATE_NR_RECEIVED ( linkp , nr ) ; action = 0 ; } break ; } case LLCFT_INFO + LLC_CMD : case LLCFT_INFO + LLC_RSP : { register int nr = LLCGBITS ( frame -> llc_control_ext , s_nr ) ; if ( cmdrsp == LLC_CMD && pollfinal == 1 ) { LLC_INC ( linkp -> llcl_vr ) ; llc_send ( linkp , LLCFT_RR , LLC_RSP , 1 ) ; LLC_STOP_REJ_TIMER ( linkp ) ; LLC_UPDATE_NR_RECEIVED ( linkp , nr ) ; LLC_NEWSTATE ( linkp , AWAIT ) ; action = LLC_DATA_INDICATION ; } else if ( cmdrsp == LLC_RSP && pollfinal == 1 ) { LLC_INC ( linkp -> llcl_vr ) ; LLC_STOP_P_TIMER ( linkp ) ; LLC_STOP_REJ_TIMER ( linkp ) ; LLC_UPDATE_NR_RECEIVED ( linkp , nr ) ; linkp -> llcl_vs = nr ; llc_resend ( linkp , LLC_CMD , 0 ) ; LLC_CLEAR_REMOTE_BUSY ( linkp , action ) ; LLC_NEWSTATE ( linkp , NORMAL ) ; action = LLC_DATA_INDICATION ; } else if ( pollfinal == 0 ) { LLC_INC ( linkp -> llcl_vr ) ; llc_send ( linkp , LLCFT_RR , LLC_CMD , 0 ) ; LLC_STOP_REJ_TIMER ( linkp ) ; LLC_UPDATE_NR_RECEIVED ( linkp , nr ) ; LLC_NEWSTATE ( linkp , AWAIT ) ; action = LLC_DATA_INDICATION ; } break ; } case LLCFT_RR + LLC_CMD : case LLCFT_REJ + LLC_CMD : case LLCFT_RR + LLC_RSP : case LLCFT_REJ + LLC_RSP : { register int nr = LLCGBITS ( frame -> llc_control_ext , s_nr ) ; if ( cmdrsp == LLC_CMD && pollfinal == 1 ) { llc_send ( linkp , LLCFT_RR , LLC_RSP , 1 ) ; LLC_UPDATE_NR_RECEIVED ( linkp , nr ) ; LLC_CLEAR_REMOTE_BUSY ( linkp , action ) ; } else if ( cmdrsp == LLC_RSP && pollfinal == 1 ) { LLC_UPDATE_NR_RECEIVED ( linkp , nr ) ; linkp -> llcl_vs = nr ; llc_resend ( linkp , LLC_CMD , 1 ) ; LLC_START_P_TIMER ( linkp ) ; LLC_CLEAR_REMOTE_BUSY ( linkp , action ) ; LLC_NEWSTATE ( linkp , REJECT ) ; } else if ( pollfinal == 0 ) { LLC_UPDATE_NR_RECEIVED ( linkp , nr ) ; LLC_CLEAR_REMOTE_BUSY ( linkp , action ) ; } break ; } case LLCFT_RNR + LLC_CMD : case LLCFT_RNR + LLC_RSP : { register int nr = LLCGBITS ( frame -> llc_control_ext , s_nr ) ; if ( cmdrsp == LLC_CMD && pollfinal == 1 ) { llc_send ( linkp , LLCFT_RR , LLC_RSP , 1 ) ; LLC_UPDATE_NR_RECEIVED ( linkp , nr ) ; LLC_SET_REMOTE_BUSY ( linkp , action ) ; } else if ( cmdrsp == LLC_RSP && pollfinal == 1 ) { LLC_UPDATE_NR_RECEIVED ( linkp , nr ) ; linkp -> llcl_vs = nr ; LLC_STOP_P_TIMER ( linkp ) ; LLC_SET_REMOTE_BUSY ( linkp , action ) ; LLC_NEWSTATE ( linkp , REJECT ) ; } else if ( pollfinal == 0 ) { LLC_UPDATE_NR_RECEIVED ( linkp , nr ) ; LLC_SET_REMOTE_BUSY ( linkp , action ) ; } break ; } case LLC_P_TIMER_EXPIRED : if ( linkp -> llcl_retry < llc_n2 ) { llc_send ( linkp , LLCFT_REJ , LLC_CMD , 1 ) ; LLC_START_P_TIMER ( linkp ) ; linkp -> llcl_retry ++ ; action = 0 ; } break ; } if ( action == LLC_PASSITON ) action = llc_state_NBRAcore ( linkp , frame , frame_kind , cmdrsp , pollfinal ) ; return action ; }
AWAIT_REJECT --- A data link connection exists between the local LLC service
                  access point and the remote LLC service access point.
AWAIT_REJECT --- A data link connection exists between the local LLC service access point and the remote LLC service access point .