extractedLnx/linux/net/802/cl2llc.c_llc_interpret_pseudo_code.c
void llc_interpret_pseudo_code(llcptr lp, int pc_label, struct sk_buff *skb,
char type)
{
short int pc; /* program counter in pseudo code array */
char p_flag_received;
frameptr fr;
int resend_count; /* number of pdus resend by llc_resend_ipdu() */
int ack_count; /* number of pdus acknowledged */
struct sk_buff *skb2;
if (skb != NULL)
{
fr = (frameptr) skb->data;
}
else
fr = NULL;
pc = pseudo_code_idx[pc_label];
while(pseudo_code[pc])
{
switch(pseudo_code[pc])
{
case 9:
if ((type != I_CMD) || (fr->i_hdr.i_pflag =0))
break;
case 1:
lp->remote_busy = 0;
llc_stop_timer(lp, BUSY_TIMER);
if ((lp->state == NORMAL) ||
(lp->state == REJECT) ||
(lp->state == BUSY))
{
skb2 = llc_pull_from_atq(lp);
if (skb2 != NULL)
llc_start_timer(lp, ACK_TIMER);
while (skb2 != NULL)
{
llc_sendipdu( lp, I_CMD, 0, skb2);
skb2 = llc_pull_from_atq(lp);
}
}
break;
case 2:
lp->state = NORMAL; /* needed to eliminate connect_response() */
lp->llc_mode = MODE_ABM;
if (lp->ops->connect_indication_ep != NULL)
lp->ops->connect_indication_ep(lp);
break;
case 3:
lp->llc_mode = MODE_ABM;
if (lp->ops->connect_confirm_ep != NULL)
lp->ops->connect_confirm_ep(lp);
break;
case 4:
if (lp->ops->data_indication_ep != NULL)
{
skb_pull(skb, 4);
lp->ops->data_indication_ep(lp, skb);
}
break;
case 5:
lp->llc_mode = MODE_ADM;
if (lp->ops->disconnect_indication_ep != NULL)
lp->ops->disconnect_indication_ep(lp);
break;
case 70:
if (lp->ops->reset_indication_ep != NULL)
lp->ops->reset_indication_ep(lp, LOCAL);
break;
case 71:
if (lp->ops->reset_indication_ep != NULL)
lp->ops->reset_indication_ep(lp, REMOTE);
break;
case 7:
if (lp->ops->reset_confirm_ep != NULL)
lp->ops->reset_confirm_ep(lp, REMOTE);
break;
case 66:
if (lp->ops->report_status_ep != NULL)
lp->ops->report_status_ep(lp, FRMR_RECEIVED);
break;
case 67:
if (lp->ops->report_status_ep != NULL)
lp->ops->report_status_ep(lp, FRMR_SENT);
break;
case 68:
if (lp->ops->report_status_ep != NULL)
lp->ops->report_status_ep(lp, REMOTE_BUSY);
break;
case 69:
if (lp->ops->report_status_ep != NULL)
lp->ops->report_status_ep(lp, REMOTE_NOT_BUSY);
break;
case 11:
llc_sendpdu(lp, DISC_CMD, lp->f_flag, 0, NULL);
break;
case 12:
llc_sendpdu(lp, DM_RSP, 0, 0, NULL);
break;
case 13:
lp->frmr_info_fld.cntl1 = fr->pdu_cntl.byte1;
lp->frmr_info_fld.cntl2 = fr->pdu_cntl.byte2;
lp->frmr_info_fld.vs = lp->vs;
lp->frmr_info_fld.vr_cr = lp->vr;
llc_sendpdu(lp, FRMR_RSP, 0, 5, (char *) &lp->frmr_info_fld);
break;
case 14:
llc_sendpdu(lp, FRMR_RSP, 0, 5, (char *) &lp->frmr_info_fld);
break;
case 15:
llc_sendpdu(lp, FRMR_RSP, lp->p_flag,
5, (char *) &lp->frmr_info_fld);
break;
case 16:
llc_sendipdu(lp, I_CMD, 1, skb);
break;
case 17:
resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_CMD, 1);
break;
case 18:
resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_CMD, 1);
if (resend_count == 0)
{
llc_sendpdu(lp, RR_CMD, 1, 0, NULL);
}
break;
case 19:
llc_sendipdu(lp, I_CMD, 0, skb);
break;
case 20:
resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_CMD, 0);
break;
case 21:
resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_CMD, 0);
if (resend_count == 0)
{
llc_sendpdu(lp, RR_CMD, 0, 0, NULL);
}
break;
case 22:
resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_RSP, 1);
break;
case 23:
llc_sendpdu(lp, REJ_CMD, 1, 0, NULL);
break;
case 24:
llc_sendpdu(lp, REJ_RSP, 1, 0, NULL);
break;
case 25:
if (IS_RSP(fr))
llc_sendpdu(lp, REJ_CMD, 0, 0, NULL);
else
llc_sendpdu(lp, REJ_RSP, 0, 0, NULL);
break;
case 26:
llc_sendpdu(lp, RNR_CMD, 1, 0, NULL);
break;
case 27:
llc_sendpdu(lp, RNR_RSP, 1, 0, NULL);
break;
case 28:
if (IS_RSP(fr))
llc_sendpdu(lp, RNR_CMD, 0, 0, NULL);
else
llc_sendpdu(lp, RNR_RSP, 0, 0, NULL);
break;
case 29:
if (lp->remote_busy == 0)
{
lp->remote_busy = 1;
llc_start_timer(lp, BUSY_TIMER);
if (lp->ops->report_status_ep != NULL)
lp->ops->report_status_ep(lp, REMOTE_BUSY);
}
else if (lp->timer_state[BUSY_TIMER] == TIMER_IDLE)
{
llc_start_timer(lp, BUSY_TIMER);
}
break;
case 30:
if (IS_RSP(fr))
llc_sendpdu(lp, RNR_CMD, 0, 0, NULL);
else
llc_sendpdu(lp, RNR_RSP, 0, 0, NULL);
break;
case 31:
llc_sendpdu(lp, RR_CMD, 1, 0, NULL);
break;
case 32:
llc_sendpdu(lp, RR_CMD, 1, 0, NULL);
break;
case 33:
llc_sendpdu(lp, RR_RSP, 1, 0, NULL);
break;
case 34:
llc_sendpdu(lp, RR_RSP, 1, 0, NULL);
break;
case 35:
llc_sendpdu(lp, RR_RSP, 0, 0, NULL);
break;
case 36:
if (IS_RSP(fr))
llc_sendpdu(lp, RR_CMD, 0, 0, NULL);
else
llc_sendpdu(lp, RR_RSP, 0, 0, NULL);
break;
case 37:
llc_sendpdu(lp, SABME_CMD, 0, 0, NULL);
lp->f_flag = 0;
break;
case 38:
llc_sendpdu(lp, UA_RSP, lp->f_flag, 0, NULL);
break;
case 39:
lp->s_flag = 0;
break;
case 40:
lp->s_flag = 1;
break;
case 41:
if(lp->timer_state[P_TIMER] == TIMER_RUNNING)
llc_stop_timer(lp, P_TIMER);
llc_start_timer(lp, P_TIMER);
if (lp->p_flag == 0)
{
lp->retry_count = 0;
lp->p_flag = 1;
}
break;
case 44:
if (lp->timer_state[ACK_TIMER] == TIMER_IDLE)
llc_start_timer(lp, ACK_TIMER);
break;
case 42:
llc_start_timer(lp, ACK_TIMER);
break;
case 43:
llc_start_timer(lp, REJ_TIMER);
break;
case 45:
llc_stop_timer(lp, ACK_TIMER);
break;
case 46:
llc_stop_timer(lp, ACK_TIMER);
lp->p_flag = 0;
break;
case 10:
if (lp->data_flag == 2)
llc_stop_timer(lp, REJ_TIMER);
break;
case 47:
llc_stop_timer(lp, REJ_TIMER);
break;
case 48:
llc_stop_timer(lp, ACK_TIMER);
llc_stop_timer(lp, P_TIMER);
llc_stop_timer(lp, REJ_TIMER);
llc_stop_timer(lp, BUSY_TIMER);
break;
case 49:
llc_stop_timer(lp, P_TIMER);
llc_stop_timer(lp, REJ_TIMER);
llc_stop_timer(lp, BUSY_TIMER);
break;
case 50:
ack_count = llc_free_acknowledged_skbs(lp,
(unsigned char) fr->s_hdr.nr);
if (ack_count > 0)
{
lp->retry_count = 0;
llc_stop_timer(lp, ACK_TIMER);
if (skb_peek(&lp->rtq) != NULL)
{
/*
* Re-transmit queue not empty
*/
llc_start_timer(lp, ACK_TIMER);
}
}
break;
case 51:
if (IS_UFRAME(fr))
p_flag_received = fr->u_hdr.u_pflag;
else
p_flag_received = fr->i_hdr.i_pflag;
if ((fr->pdu_hdr.ssap & 0x01) && (p_flag_received))
{
lp->p_flag = 0;
llc_stop_timer(lp, P_TIMER);
}
break;
case 52:
lp->data_flag = 2;
break;
case 53:
lp->data_flag = 0;
break;
case 54:
lp->data_flag = 1;
break;
case 55:
if (lp->data_flag == 0)
lp->data_flag = 1;
break;
case 56:
lp->p_flag = 0;
break;
case 57:
lp->p_flag = lp->f_flag;
break;
case 58:
lp->remote_busy = 0;
break;
case 59:
lp->retry_count = 0;
break;
case 60:
lp->retry_count++;
break;
case 61:
lp->vr = 0;
break;
case 62:
lp->vr++;
break;
case 63:
lp->vs = 0;
break;
case 64:
lp->vs = fr->i_hdr.nr;
break;
case 65:
if (IS_UFRAME(fr))
lp->f_flag = fr->u_hdr.u_pflag;
else
lp->f_flag = fr->i_hdr.i_pflag;
break;
default:
}
pc++;
}
}
Generated by GNU enscript 1.6.4.