···2525#include <net/llc_s_st.h>2626#include <net/llc_pdu.h>27272828-typedef int (*llc_station_ev_t)(struct sk_buff *skb);2929-3030-typedef int (*llc_station_action_t)(struct sk_buff *skb);3131-3232-/* Station component state table structure */3333-struct llc_station_state_trans {3434- llc_station_ev_t ev;3535- llc_station_action_t *ev_actions;3636-};3737-3828static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb)3929{4030 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);···99109 goto out;100110}101111102102-/* state transition for LLC_STATION_EV_RX_NULL_DSAP_XID_C event */103103-static llc_station_action_t llc_stat_up_state_actions_2[] = {104104- llc_station_ac_send_xid_r,105105- NULL,106106-};107107-108108-static struct llc_station_state_trans llc_stat_up_state_trans_2 = {109109- .ev = llc_stat_ev_rx_null_dsap_xid_c,110110- .ev_actions = llc_stat_up_state_actions_2,111111-};112112-113113-/* state transition for LLC_STATION_EV_RX_NULL_DSAP_TEST_C event */114114-static llc_station_action_t llc_stat_up_state_actions_3[] = {115115- llc_station_ac_send_test_r,116116- NULL,117117-};118118-119119-static struct llc_station_state_trans llc_stat_up_state_trans_3 = {120120- .ev = llc_stat_ev_rx_null_dsap_test_c,121121- .ev_actions = llc_stat_up_state_actions_3,122122-};123123-124124-/* array of pointers; one to each transition */125125-static struct llc_station_state_trans *llc_stat_up_state_trans [] = {126126- &llc_stat_up_state_trans_2,127127- &llc_stat_up_state_trans_3,128128- NULL,129129-};130130-131131-/**132132- * llc_exec_station_trans_actions - executes actions for transition133133- * @trans: Address of the transition134134- * @skb: Address of the event that caused the transition135135- *136136- * Executes actions of a transition of the station state machine. Returns137137- * 0 if all actions complete successfully, nonzero otherwise.138138- */139139-static u16 llc_exec_station_trans_actions(struct llc_station_state_trans *trans,140140- struct sk_buff *skb)141141-{142142- u16 rc = 0;143143- llc_station_action_t *next_action = trans->ev_actions;144144-145145- for (; next_action && *next_action; next_action++)146146- if ((*next_action)(skb))147147- rc = 1;148148- return rc;149149-}150150-151151-/**152152- * llc_find_station_trans - finds transition for this event153153- * @skb: Address of the event154154- *155155- * Search thru events of the current state of the station until list156156- * exhausted or it's obvious that the event is not valid for the current157157- * state. Returns the address of the transition if cound, %NULL otherwise.158158- */159159-static struct llc_station_state_trans *160160- llc_find_station_trans(struct sk_buff *skb)161161-{162162- int i = 0;163163- struct llc_station_state_trans *rc = NULL;164164- struct llc_station_state_trans **next_trans;165165-166166- for (next_trans = llc_stat_up_state_trans; next_trans[i]; i++)167167- if (!next_trans[i]->ev(skb)) {168168- rc = next_trans[i];169169- break;170170- }171171- return rc;172172-}173173-174112/**175113 * llc_station_rcv - send received pdu to the station state machine176114 * @skb: received frame.···107189 */108190static void llc_station_rcv(struct sk_buff *skb)109191{110110- struct llc_station_state_trans *trans;111111-112112- trans = llc_find_station_trans(skb);113113- if (trans)114114- llc_exec_station_trans_actions(trans, skb);192192+ if (llc_stat_ev_rx_null_dsap_xid_c(skb))193193+ llc_station_ac_send_xid_r(skb);194194+ else if (llc_stat_ev_rx_null_dsap_test_c(skb))195195+ llc_station_ac_send_test_r(skb);115196 kfree_skb(skb);116197}117198