Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
649cbf21
Commit
649cbf21
authored
Aug 14, 2002
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge master.kernel.org:/home/acme/BK/newdatalink-2.5
into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents
d572f1a5
c1d567a8
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
1284 additions
and
1433 deletions
+1284
-1433
include/net/llc_actn.h
include/net/llc_actn.h
+11
-11
include/net/llc_c_ac.h
include/net/llc_c_ac.h
+88
-128
include/net/llc_c_ev.h
include/net/llc_c_ev.h
+89
-103
include/net/llc_conn.h
include/net/llc_conn.h
+3
-5
include/net/llc_evnt.h
include/net/llc_evnt.h
+17
-11
include/net/llc_mac.h
include/net/llc_mac.h
+11
-0
include/net/llc_main.h
include/net/llc_main.h
+28
-25
include/net/llc_s_ac.h
include/net/llc_s_ac.h
+10
-18
include/net/llc_s_ev.h
include/net/llc_s_ev.h
+22
-23
include/net/llc_s_st.h
include/net/llc_s_st.h
+5
-4
include/net/llc_sap.h
include/net/llc_sap.h
+2
-4
net/llc/llc_actn.c
net/llc/llc_actn.c
+38
-41
net/llc/llc_c_ac.c
net/llc/llc_c_ac.c
+357
-404
net/llc/llc_c_ev.c
net/llc/llc_c_ev.c
+181
-199
net/llc/llc_c_st.c
net/llc/llc_c_st.c
+98
-98
net/llc/llc_conn.c
net/llc/llc_conn.c
+39
-54
net/llc/llc_evnt.c
net/llc/llc_evnt.c
+27
-14
net/llc/llc_if.c
net/llc/llc_if.c
+45
-44
net/llc/llc_mac.c
net/llc/llc_mac.c
+24
-28
net/llc/llc_main.c
net/llc/llc_main.c
+47
-63
net/llc/llc_s_ac.c
net/llc/llc_s_ac.c
+45
-49
net/llc/llc_s_ev.c
net/llc/llc_s_ev.c
+30
-16
net/llc/llc_s_st.c
net/llc/llc_s_st.c
+10
-10
net/llc/llc_sap.c
net/llc/llc_sap.c
+31
-46
net/llc/llc_sock.c
net/llc/llc_sock.c
+17
-26
net/llc/llc_stat.c
net/llc/llc_stat.c
+9
-9
No files found.
include/net/llc_actn.h
View file @
649cbf21
...
@@ -24,25 +24,25 @@
...
@@ -24,25 +24,25 @@
/* All station state event action functions look like this */
/* All station state event action functions look like this */
typedef
int
(
*
llc_station_action_t
)(
struct
llc_station
*
station
,
typedef
int
(
*
llc_station_action_t
)(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_station_ac_start_ack_timer
(
struct
llc_station
*
station
,
extern
int
llc_station_ac_start_ack_timer
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_station_ac_set_retry_cnt_0
(
struct
llc_station
*
station
,
extern
int
llc_station_ac_set_retry_cnt_0
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_station_ac_inc_retry_cnt_by_1
(
struct
llc_station
*
station
,
extern
int
llc_station_ac_inc_retry_cnt_by_1
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_station_ac_set_xid_r_cnt_0
(
struct
llc_station
*
station
,
extern
int
llc_station_ac_set_xid_r_cnt_0
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_station_ac_inc_xid_r_cnt_by_1
(
struct
llc_station
*
station
,
extern
int
llc_station_ac_inc_xid_r_cnt_by_1
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_station_ac_send_null_dsap_xid_c
(
struct
llc_station
*
station
,
extern
int
llc_station_ac_send_null_dsap_xid_c
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_station_ac_send_xid_r
(
struct
llc_station
*
station
,
extern
int
llc_station_ac_send_xid_r
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_station_ac_send_test_r
(
struct
llc_station
*
station
,
extern
int
llc_station_ac_send_test_r
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_station_ac_report_status
(
struct
llc_station
*
station
,
extern
int
llc_station_ac_report_status
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_station_ac_report_status
(
struct
llc_station
*
station
,
extern
int
llc_station_ac_report_status
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
#endif
/* LLC_ACTN_H */
#endif
/* LLC_ACTN_H */
include/net/llc_c_ac.h
View file @
649cbf21
...
@@ -87,168 +87,128 @@
...
@@ -87,168 +87,128 @@
#define LLC_CONN_AC_STOP_SENDACK_TMR 70
#define LLC_CONN_AC_STOP_SENDACK_TMR 70
#define LLC_CONN_AC_START_SENDACK_TMR_IF_NOT_RUNNING 71
#define LLC_CONN_AC_START_SENDACK_TMR_IF_NOT_RUNNING 71
typedef
int
(
*
llc_conn_action_t
)(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
typedef
int
(
*
llc_conn_action_t
)(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_clear_remote_busy
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_clear_remote_busy
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_conn_ind
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_conn_ind
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_conn_confirm
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_conn_confirm
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_data_ind
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_data_ind
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_disc_ind
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_disc_ind
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_rst_ind
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_rst_ind
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_rst_confirm
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_rst_confirm
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_report_status
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_report_status
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_clear_remote_busy_if_f_eq_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_clear_remote_busy_if_f_eq_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_disc_cmd_p_set_x
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_disc_cmd_p_set_x
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_dm_rsp_f_set_p
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_dm_rsp_f_set_p
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_dm_rsp_f_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_dm_rsp_f_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_dm_rsp_f_set_f_flag
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_dm_rsp_f_set_f_flag
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_frmr_rsp_f_set_x
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_frmr_rsp_f_set_x
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_resend_frmr_rsp_f_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_resend_frmr_rsp_f_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_resend_frmr_rsp_f_set_p
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_resend_frmr_rsp_f_set_p
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_i_cmd_p_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_i_cmd_p_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_send_i_cmd_p_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_i_cmd_p_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_resend_i_cmd_p_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_resend_i_cmd_p_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_i_xxx_x_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_i_xxx_x_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_resend_i_xxx_x_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_resend_i_xxx_x_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_resend_i_rsp_f_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_resend_i_rsp_f_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_rej_cmd_p_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_rej_cmd_p_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_rej_rsp_f_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_rej_rsp_f_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_rej_xxx_x_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_rej_xxx_x_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_rnr_cmd_p_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_rnr_cmd_p_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_rnr_rsp_f_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_rnr_rsp_f_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_rnr_xxx_x_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_rnr_xxx_x_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_set_remote_busy
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_set_remote_busy
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_opt_send_rnr_xxx_x_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_opt_send_rnr_xxx_x_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_rr_cmd_p_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_rr_cmd_p_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_ack_cmd_p_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_ack_cmd_p_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_rr_rsp_f_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_rr_rsp_f_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_ack_rsp_f_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_ack_rsp_f_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_rr_xxx_x_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_rr_xxx_x_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_ack_xxx_x_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_ack_xxx_x_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_sabme_cmd_p_set_x
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_sabme_cmd_p_set_x
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_ua_rsp_f_set_f_flag
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_ua_rsp_f_set_f_flag
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_ua_rsp_f_set_p
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_ua_rsp_f_set_p
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_set_s_flag_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_set_s_flag_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_s_flag_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_set_s_flag_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_start_p_timer
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_start_ack_timer
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_start_p_timer
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_start_rej_timer
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_start_ack_timer
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_start_rej_timer
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_start_ack_tmr_if_not_running
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_start_ack_tmr_if_not_running
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_stop_ack_timer
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_stop_ack_timer
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_stop_p_timer
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_stop_p_timer
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_stop_rej_timer
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_stop_all_timers
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_stop_rej_timer
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_stop_other_timers
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_upd_nr_received
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_stop_all_timers
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_inc_tx_win_size
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_dec_tx_win_size
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_stop_other_timers
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_upd_p_flag
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_data_flag_2
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_upd_nr_received
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_set_data_flag_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_data_flag_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_inc_tx_win_size
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_dec_tx_win_size
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_upd_p_flag
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_data_flag_2
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_data_flag_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_data_flag_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_data_flag_1_if_data_flag_eq_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_set_data_flag_1_if_data_flag_eq_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_set_p_flag_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_set_p_flag_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_p_flag_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_set_p_flag_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_set_remote_busy_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_retry_cnt_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_set_remote_busy_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_set_cause_flag_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_cause_flag_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_set_retry_cnt_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_inc_retry_cnt_by_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_vr_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_set_cause_flag_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_inc_vr_by_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_vs_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_set_cause_flag_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_set_vs_nr
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_rst_vs
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_inc_retry_cnt_by_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_upd_vs
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_f_flag_p
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_set_vr_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_disc
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_inc_vr_by_1
(
struct
sock
*
sk
,
extern
int
llc_conn_reset
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_disc_confirm
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_set_vs_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_vs_nr
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_rst_vs
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_upd_vs
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_set_f_flag_p
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_disc
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_reset
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_disc_confirm
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
u8
llc_circular_between
(
u8
a
,
u8
b
,
u8
c
);
extern
u8
llc_circular_between
(
u8
a
,
u8
b
,
u8
c
);
extern
int
llc_conn_ac_send_ack_if_needed
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_ack_if_needed
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_inc_npta_value
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_inc_npta_value
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_adjust_npta_by_rr
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_adjust_npta_by_rnr
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_adjust_npta_by_rr
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_rst_sendack_flag
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_adjust_npta_by_rnr
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_rst_sendack_flag
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_send_rr_rsp_f_set_ackpf
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_rr_rsp_f_set_ackpf
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_i_rsp_f_set_ackpf
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_i_rsp_f_set_ackpf
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_i_rsp_as_ack
(
struct
sock
*
sk
,
extern
int
llc_conn_ac_send_i_rsp_as_ack
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ac_send_i_as_ack
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ac_send_i_as_ack
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
#endif
/* LLC_C_AC_H */
#endif
/* LLC_C_AC_H */
include/net/llc_c_ev.h
View file @
649cbf21
...
@@ -124,7 +124,6 @@ struct llc_conn_ev_prim_if {
...
@@ -124,7 +124,6 @@ struct llc_conn_ev_prim_if {
struct
llc_conn_ev_pdu_if
{
struct
llc_conn_ev_pdu_if
{
u8
ev
;
u8
ev
;
u8
reason
;
u8
reason
;
struct
sk_buff
*
skb
;
};
};
/* Event interface for timer-generated events */
/* Event interface for timer-generated events */
...
@@ -155,169 +154,156 @@ struct llc_conn_state_ev {
...
@@ -155,169 +154,156 @@ struct llc_conn_state_ev {
union
llc_conn_ev_if
data
;
union
llc_conn_ev_if
data
;
};
};
typedef
int
(
*
llc_conn_ev_t
)(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
static
__inline__
struct
llc_conn_state_ev
*
llc_conn_ev
(
struct
sk_buff
*
skb
)
typedef
int
(
*
llc_conn_ev_qfyr_t
)(
struct
sock
*
sk
,
{
struct
llc_conn_state_ev
*
ev
);
return
(
struct
llc_conn_state_ev
*
)
skb
->
cb
;
}
extern
int
llc_conn_ev_conn_req
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
typedef
int
(
*
llc_conn_ev_t
)(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_conn_resp
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
typedef
int
(
*
llc_conn_ev_qfyr_t
)(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_data_req
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_disc_req
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_conn_req
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rst_req
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_conn_resp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rst_resp
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_data_req
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_disc_req
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rst_req
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rst_resp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_local_busy_detected
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_local_busy_detected
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_local_busy_cleared
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_local_busy_cleared
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_rx_bad_pdu
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_bad_pdu
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_rx_disc_cmd_pbit_set_x
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_disc_cmd_pbit_set_x
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_dm_rsp_fbit_set_x
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_dm_rsp_fbit_set_x
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_frmr_rsp_fbit_set_x
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_frmr_rsp_fbit_set_x
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_x
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_x
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_rej_rsp_fbit_set_x
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_rej_rsp_fbit_set_x
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_sabme_cmd_pbit_set_x
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_sabme_cmd_pbit_set_x
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_ua_rsp_fbit_set_x
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_ua_rsp_fbit_set_x
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_xxx_cmd_pbit_set_x
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_xxx_cmd_pbit_set_x
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_xxx_rsp_fbit_set_x
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_xxx_rsp_fbit_set_x
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_xxx_yyy
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_xxx_yyy
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_p_tmr_exp
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_p_tmr_exp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_ack_tmr_exp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_ack_tmr_exp
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rej_tmr_exp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_busy_tmr_exp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rej_tmr_exp
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_any_tmr_exp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_sendack_tmr_exp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_busy_tmr_exp
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_any_tmr_exp
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_sendack_tmr_exp
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
/* NOT_USED functions and their variations */
/* NOT_USED functions and their variations */
extern
int
llc_conn_ev_rx_xxx_cmd_pbit_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_xxx_cmd_pbit_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_xxx_cmd_pbit_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_xxx_cmd_pbit_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_xxx_rsp_fbit_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_xxx_rsp_fbit_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_i_cmd_pbit_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_i_cmd_pbit_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_i_cmd_pbit_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_i_cmd_pbit_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_i_rsp_fbit_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_rr_cmd_pbit_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_rr_cmd_pbit_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_rr_cmd_pbit_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_rr_cmd_pbit_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_rr_rsp_fbit_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_rr_rsp_fbit_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_rr_rsp_fbit_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_rr_rsp_fbit_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_rnr_cmd_pbit_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_rnr_cmd_pbit_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_rnr_cmd_pbit_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_rnr_cmd_pbit_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_rnr_rsp_fbit_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_rnr_rsp_fbit_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_rnr_rsp_fbit_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_rnr_rsp_fbit_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_rej_cmd_pbit_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_rej_cmd_pbit_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_rej_cmd_pbit_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_rej_cmd_pbit_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_rej_rsp_fbit_set_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_rej_rsp_fbit_set_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_rej_rsp_fbit_set_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_rej_rsp_fbit_set_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_rx_any_frame
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_rx_any_frame
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_tx_buffer_full
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_tx_buffer_full
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_init_p_f_cycle
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_init_p_f_cycle
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
/* Available connection action qualifiers */
/* Available connection action qualifiers */
extern
int
llc_conn_ev_qlfy_data_flag_eq_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_data_flag_eq_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_data_flag_eq_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_data_flag_eq_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_data_flag_eq_2
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_data_flag_eq_2
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_p_flag_eq_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_p_flag_eq_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_qlfy_last_frame_eq_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_last_frame_eq_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_last_frame_eq_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_last_frame_eq_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_p_flag_eq_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_p_flag_eq_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_qlfy_p_flag_eq_f
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_p_flag_eq_f
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_qlfy_remote_busy_eq_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_remote_busy_eq_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_remote_busy_eq_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_remote_busy_eq_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_retry_cnt_lt_n2
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_retry_cnt_lt_n2
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_retry_cnt_gte_n2
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_retry_cnt_gte_n2
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_s_flag_eq_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_s_flag_eq_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_qlfy_s_flag_eq_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_s_flag_eq_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
int
llc_conn_ev_qlfy_cause_flag_eq_1
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_cause_flag_eq_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_cause_flag_eq_0
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_cause_flag_eq_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_init_p_f_cycle
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_init_p_f_cycle
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_set_status_conn
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_set_status_conn
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_set_status_disc
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_set_status_disc
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_set_status_failed
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_set_status_failed
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_set_status_impossible
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_set_status_impossible
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_set_status_remote_busy
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_set_status_remote_busy
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_set_status_received
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_set_status_received
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_set_status_refuse
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_set_status_refuse
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_set_status_conflict
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_set_status_conflict
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_conn_ev_qlfy_set_status_rst_done
(
struct
sock
*
sk
,
extern
int
llc_conn_ev_qlfy_set_status_rst_done
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
#endif
/* LLC_C_EV_H */
#endif
/* LLC_C_EV_H */
include/net/llc_conn.h
View file @
649cbf21
...
@@ -136,12 +136,10 @@ extern void llc_sock_reset(struct sock *sk);
...
@@ -136,12 +136,10 @@ extern void llc_sock_reset(struct sock *sk);
extern
int
llc_sock_init
(
struct
sock
*
sk
);
extern
int
llc_sock_init
(
struct
sock
*
sk
);
/* Access to a connection */
/* Access to a connection */
extern
struct
llc_conn_state_ev
*
llc_conn_alloc_ev
(
struct
sock
*
sk
);
extern
int
llc_conn_send_ev
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
int
llc_conn_send_ev
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
extern
void
llc_conn_send_pdu
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
void
llc_conn_send_pdu
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
extern
void
llc_conn_rtn_pdu
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
extern
void
llc_conn_rtn_pdu
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
extern
void
llc_conn_free_ev
(
struct
sk_buff
*
skb
);
extern
void
llc_conn_free_ev
(
struct
llc_conn_state_ev
*
ev
);
extern
void
llc_conn_resend_i_pdu_as_cmd
(
struct
sock
*
sk
,
u8
nr
,
extern
void
llc_conn_resend_i_pdu_as_cmd
(
struct
sock
*
sk
,
u8
nr
,
u8
first_p_bit
);
u8
first_p_bit
);
extern
void
llc_conn_resend_i_pdu_as_rsp
(
struct
sock
*
sk
,
u8
nr
,
extern
void
llc_conn_resend_i_pdu_as_rsp
(
struct
sock
*
sk
,
u8
nr
,
...
...
include/net/llc_evnt.h
View file @
649cbf21
...
@@ -58,7 +58,7 @@ union llc_stat_ev_if {
...
@@ -58,7 +58,7 @@ union llc_stat_ev_if {
struct
llc_stat_ev_simple_if
a
;
/* 'a' for simple, easy ... */
struct
llc_stat_ev_simple_if
a
;
/* 'a' for simple, easy ... */
struct
llc_stat_ev_prim_if
prim
;
struct
llc_stat_ev_prim_if
prim
;
struct
llc_stat_ev_pdu_if
pdu
;
struct
llc_stat_ev_pdu_if
pdu
;
struct
llc_stat_ev_tmr_if
tmr
;
struct
llc_stat_ev_tmr_if
tmr
;
struct
llc_stat_ev_rpt_sts_if
rsts
;
/* report status */
struct
llc_stat_ev_rpt_sts_if
rsts
;
/* report status */
};
};
...
@@ -68,26 +68,32 @@ struct llc_station_state_ev {
...
@@ -68,26 +68,32 @@ struct llc_station_state_ev {
struct
list_head
node
;
/* node in station->ev_q.list */
struct
list_head
node
;
/* node in station->ev_q.list */
};
};
static
__inline__
struct
llc_station_state_ev
*
llc_station_ev
(
struct
sk_buff
*
skb
)
{
return
(
struct
llc_station_state_ev
*
)
skb
->
cb
;
}
typedef
int
(
*
llc_station_ev_t
)(
struct
llc_station
*
station
,
typedef
int
(
*
llc_station_ev_t
)(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_stat_ev_enable_with_dup_addr_check
(
struct
llc_station
*
station
,
extern
int
llc_stat_ev_enable_with_dup_addr_check
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_stat_ev_enable_without_dup_addr_check
(
struct
llc_station
*
station
,
extern
int
llc_stat_ev_enable_without_dup_addr_check
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_stat_ev_ack_tmr_exp_lt_retry_cnt_max_retry
(
struct
llc_station
*
extern
int
llc_stat_ev_ack_tmr_exp_lt_retry_cnt_max_retry
(
struct
llc_station
*
station
,
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_stat_ev_ack_tmr_exp_eq_retry_cnt_max_retry
(
struct
llc_station
*
station
,
extern
int
llc_stat_ev_ack_tmr_exp_eq_retry_cnt_max_retry
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_stat_ev_rx_null_dsap_xid_c
(
struct
llc_station
*
station
,
extern
int
llc_stat_ev_rx_null_dsap_xid_c
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq
(
struct
llc_station
*
station
,
extern
int
llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq
(
struct
llc_station
*
station
,
extern
int
llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_stat_ev_rx_null_dsap_test_c
(
struct
llc_station
*
station
,
extern
int
llc_stat_ev_rx_null_dsap_test_c
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_stat_ev_disable_req
(
struct
llc_station
*
station
,
extern
int
llc_stat_ev_disable_req
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
#endif
/* LLC_EVNT_H */
#endif
/* LLC_EVNT_H */
include/net/llc_mac.h
View file @
649cbf21
...
@@ -20,4 +20,15 @@ extern struct net_device *mac_dev_peer(struct net_device *current_dev,
...
@@ -20,4 +20,15 @@ extern struct net_device *mac_dev_peer(struct net_device *current_dev,
extern
int
llc_pdu_router
(
struct
llc_sap
*
sap
,
struct
sock
*
sk
,
extern
int
llc_pdu_router
(
struct
llc_sap
*
sap
,
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
u8
type
);
struct
sk_buff
*
skb
,
u8
type
);
extern
u16
lan_hdrs_init
(
struct
sk_buff
*
skb
,
u8
*
sa
,
u8
*
da
);
extern
u16
lan_hdrs_init
(
struct
sk_buff
*
skb
,
u8
*
sa
,
u8
*
da
);
static
__inline__
void
llc_set_backlog_type
(
struct
sk_buff
*
skb
,
char
type
)
{
skb
->
cb
[
sizeof
(
skb
->
cb
)
-
1
]
=
type
;
}
static
__inline__
char
llc_backlog_type
(
struct
sk_buff
*
skb
)
{
return
skb
->
cb
[
sizeof
(
skb
->
cb
)
-
1
];
}
#endif
/* LLC_MAC_H */
#endif
/* LLC_MAC_H */
include/net/llc_main.h
View file @
649cbf21
...
@@ -19,35 +19,40 @@
...
@@ -19,35 +19,40 @@
#define LLC_ACK_TIME 3
#define LLC_ACK_TIME 3
#define LLC_REJ_TIME 3
#define LLC_REJ_TIME 3
#define LLC_BUSY_TIME 3
#define LLC_BUSY_TIME 3
#define LLC_SENDACK_TIME 50
#define LLC_DEST_INVALID 0
/* Invalid LLC PDU type */
#define LLC_DEST_INVALID 0
/* Invalid LLC PDU type */
#define LLC_DEST_SAP 1
/* Type 1 goes here */
#define LLC_DEST_SAP 1
/* Type 1 goes here */
#define LLC_DEST_CONN 2
/* Type 2 goes here */
#define LLC_DEST_CONN 2
/* Type 2 goes here */
/* LLC Layer global default parameters */
/**
* struct llc_station - LLC station component
#define LLC_GLOBAL_DEFAULT_MAX_NBR_SAPS 4
*
#define LLC_GLOBAL_DEFAULT_MAX_NBR_CONNS 64
* SAP and connection resource manager, one per adapter.
*
/* LLC station component (SAP and connection resource manager) */
* @state - state of station
/* Station component; one per adapter */
* @xid_r_count - XID response PDU counter
* @ack_tmr_running - 1 or 0
* @mac_sa - MAC source address
* @sap_list - list of related SAPs
* @ev_q - events entering state mach.
* @mac_pdu_q - PDUs ready to send to MAC
*/
struct
llc_station
{
struct
llc_station
{
u8
state
;
/* state of station */
u8
state
;
u8
xid_r_count
;
/* XID response PDU counter */
u8
xid_r_count
;
struct
timer_list
ack_timer
;
struct
timer_list
ack_timer
;
u8
ack_tmr_running
;
/* 1 or 0 */
u8
ack_tmr_running
;
u8
retry_count
;
u8
retry_count
;
u8
maximum_retry
;
u8
maximum_retry
;
u8
mac_sa
[
6
];
/* MAC source address */
u8
mac_sa
[
6
];
struct
{
struct
{
spinlock_t
lock
;
spinlock_t
lock
;
struct
list_head
list
;
struct
list_head
list
;
}
sap_list
;
/* list of related SAPs */
}
sap_list
;
struct
{
struct
{
s
pinlock_t
lock
;
s
truct
sk_buff_head
list
;
s
truct
list_head
list
;
s
pinlock_t
lock
;
}
ev_q
;
/* events entering state mach. */
}
ev_q
;
struct
sk_buff_head
mac_pdu_q
;
/* PDUs ready to send to MAC */
struct
sk_buff_head
mac_pdu_q
;
};
};
struct
llc_station_state_ev
;
struct
llc_station_state_ev
;
...
@@ -56,10 +61,8 @@ extern void llc_sap_save(struct llc_sap *sap);
...
@@ -56,10 +61,8 @@ extern void llc_sap_save(struct llc_sap *sap);
extern
void
llc_free_sap
(
struct
llc_sap
*
sap
);
extern
void
llc_free_sap
(
struct
llc_sap
*
sap
);
extern
struct
llc_sap
*
llc_sap_find
(
u8
lsap
);
extern
struct
llc_sap
*
llc_sap_find
(
u8
lsap
);
extern
struct
llc_station
*
llc_station_get
(
void
);
extern
struct
llc_station
*
llc_station_get
(
void
);
extern
struct
llc_station_state_ev
*
llc_station_alloc_ev
(
struct
llc_station
*
station
);
extern
void
llc_station_send_ev
(
struct
llc_station
*
station
,
extern
void
llc_station_send_ev
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
void
llc_station_send_pdu
(
struct
llc_station
*
station
,
extern
void
llc_station_send_pdu
(
struct
llc_station
*
station
,
struct
sk_buff
*
skb
);
struct
sk_buff
*
skb
);
extern
struct
sk_buff
*
llc_alloc_frame
(
void
);
extern
struct
sk_buff
*
llc_alloc_frame
(
void
);
...
...
include/net/llc_s_ac.h
View file @
649cbf21
...
@@ -23,25 +23,17 @@
...
@@ -23,25 +23,17 @@
#define SAP_ACT_TEST_IND 9
#define SAP_ACT_TEST_IND 9
/* All action functions must look like this */
/* All action functions must look like this */
typedef
int
(
*
llc_sap_action_t
)(
struct
llc_sap
*
sap
,
typedef
int
(
*
llc_sap_action_t
)(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_action_unitdata_ind
(
struct
llc_sap
*
sap
,
extern
int
llc_sap_action_unitdata_ind
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_sap_action_send_ui
(
struct
llc_sap
*
sap
,
extern
int
llc_sap_action_send_ui
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_action_send_xid_c
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
extern
int
llc_sap_action_send_xid_c
(
struct
llc_sap
*
sap
,
extern
int
llc_sap_action_send_xid_r
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_action_send_test_c
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
extern
int
llc_sap_action_send_xid_r
(
struct
llc_sap
*
sap
,
extern
int
llc_sap_action_send_test_r
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_action_send_test_c
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_action_send_test_r
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_action_report_status
(
struct
llc_sap
*
sap
,
extern
int
llc_sap_action_report_status
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
struct
sk_buff
*
skb
);
extern
int
llc_sap_action_xid_ind
(
struct
llc_sap
*
sap
,
extern
int
llc_sap_action_xid_ind
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_action_test_ind
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
extern
int
llc_sap_action_test_ind
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
#endif
/* LLC_S_AC_H */
#endif
/* LLC_S_AC_H */
include/net/llc_s_ev.h
View file @
649cbf21
...
@@ -11,6 +11,9 @@
...
@@ -11,6 +11,9 @@
*
*
* See the GNU General Public License for more details.
* See the GNU General Public License for more details.
*/
*/
#include <linux/skbuff.h>
/* Defines SAP component events */
/* Defines SAP component events */
/* Types of events (possible values in 'ev->type') */
/* Types of events (possible values in 'ev->type') */
#define LLC_SAP_EV_TYPE_SIMPLE 1
#define LLC_SAP_EV_TYPE_SIMPLE 1
...
@@ -45,9 +48,8 @@ struct llc_sap_ev_prim_if {
...
@@ -45,9 +48,8 @@ struct llc_sap_ev_prim_if {
};
};
struct
llc_sap_ev_pdu_if
{
struct
llc_sap_ev_pdu_if
{
u8
ev
;
u8
ev
;
u8
reason
;
u8
reason
;
struct
sk_buff
*
skb
;
};
};
struct
llc_sap_ev_tmr_if
{
struct
llc_sap_ev_tmr_if
{
...
@@ -75,27 +77,24 @@ struct llc_sap_state_ev {
...
@@ -75,27 +77,24 @@ struct llc_sap_state_ev {
union
llc_sap_ev_if
data
;
union
llc_sap_ev_if
data
;
};
};
static
__inline__
struct
llc_sap_state_ev
*
llc_sap_ev
(
struct
sk_buff
*
skb
)
{
return
(
struct
llc_sap_state_ev
*
)
skb
->
cb
;
}
struct
llc_sap
;
struct
llc_sap
;
typedef
int
(
*
llc_sap_ev_t
)(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
typedef
int
(
*
llc_sap_ev_t
)(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
extern
int
llc_sap_ev_activation_req
(
struct
llc_sap
*
sap
,
extern
int
llc_sap_ev_activation_req
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_ev_rx_ui
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
extern
int
llc_sap_ev_rx_ui
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_ev_unitdata_req
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
extern
int
llc_sap_ev_unitdata_req
(
struct
llc_sap
*
sap
,
extern
int
llc_sap_ev_xid_req
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_ev_rx_xid_c
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
extern
int
llc_sap_ev_xid_req
(
struct
llc_sap
*
sap
,
extern
int
llc_sap_ev_rx_xid_r
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_ev_test_req
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
extern
int
llc_sap_ev_rx_xid_c
(
struct
llc_sap
*
sap
,
extern
int
llc_sap_ev_rx_test_c
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_ev_rx_test_r
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
extern
int
llc_sap_ev_rx_xid_r
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_ev_test_req
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_ev_rx_test_c
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_ev_rx_test_r
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
extern
int
llc_sap_ev_deactivation_req
(
struct
llc_sap
*
sap
,
extern
int
llc_sap_ev_deactivation_req
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
struct
sk_buff
*
skb
);
#endif
/* LLC_S_EV_H */
#endif
/* LLC_S_EV_H */
include/net/llc_s_st.h
View file @
649cbf21
...
@@ -15,7 +15,8 @@
...
@@ -15,7 +15,8 @@
#define LLC_SAP_STATE_INACTIVE 1
#define LLC_SAP_STATE_INACTIVE 1
#define LLC_SAP_STATE_ACTIVE 2
#define LLC_SAP_STATE_ACTIVE 2
#define LLC_NBR_SAP_STATES 2
/* size of state table */
#define LLC_NR_SAP_STATES 2
/* size of state table */
/* structures and types */
/* structures and types */
/* SAP state table structure */
/* SAP state table structure */
struct
llc_sap_state_trans
{
struct
llc_sap_state_trans
{
...
@@ -25,10 +26,10 @@ struct llc_sap_state_trans {
...
@@ -25,10 +26,10 @@ struct llc_sap_state_trans {
};
};
struct
llc_sap_state
{
struct
llc_sap_state
{
u8
curr_state
;
u8
curr_state
;
struct
llc_sap_state_trans
**
transitions
;
struct
llc_sap_state_trans
**
transitions
;
};
};
/* only access to SAP state table */
/* only access to SAP state table */
extern
struct
llc_sap_state
llc_sap_state_table
[
LLC_N
B
R_SAP_STATES
];
extern
struct
llc_sap_state
llc_sap_state_table
[
LLC_NR_SAP_STATES
];
#endif
/* LLC_S_ST_H */
#endif
/* LLC_S_ST_H */
include/net/llc_sap.h
View file @
649cbf21
...
@@ -49,9 +49,7 @@ struct llc_sap_state_ev;
...
@@ -49,9 +49,7 @@ struct llc_sap_state_ev;
extern
void
llc_sap_assign_sock
(
struct
llc_sap
*
sap
,
struct
sock
*
sk
);
extern
void
llc_sap_assign_sock
(
struct
llc_sap
*
sap
,
struct
sock
*
sk
);
extern
void
llc_sap_unassign_sock
(
struct
llc_sap
*
sap
,
struct
sock
*
sk
);
extern
void
llc_sap_unassign_sock
(
struct
llc_sap
*
sap
,
struct
sock
*
sk
);
extern
void
llc_sap_send_ev
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
extern
void
llc_sap_send_ev
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
extern
void
llc_sap_rtn_pdu
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
,
extern
void
llc_sap_rtn_pdu
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
struct
llc_sap_state_ev
*
ev
);
extern
void
llc_sap_send_pdu
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
extern
void
llc_sap_send_pdu
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
extern
struct
llc_sap_state_ev
*
llc_sap_alloc_ev
(
struct
llc_sap
*
sap
);
#endif
/* LLC_SAP_H */
#endif
/* LLC_SAP_H */
net/llc/llc_actn.c
View file @
649cbf21
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
static
void
llc_station_ack_tmr_callback
(
unsigned
long
timeout_data
);
static
void
llc_station_ack_tmr_callback
(
unsigned
long
timeout_data
);
int
llc_station_ac_start_ack_timer
(
struct
llc_station
*
station
,
int
llc_station_ac_start_ack_timer
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
del_timer
(
&
station
->
ack_timer
);
del_timer
(
&
station
->
ack_timer
);
station
->
ack_timer
.
expires
=
jiffies
+
LLC_ACK_TIME
*
HZ
;
station
->
ack_timer
.
expires
=
jiffies
+
LLC_ACK_TIME
*
HZ
;
...
@@ -39,98 +39,94 @@ int llc_station_ac_start_ack_timer(struct llc_station *station,
...
@@ -39,98 +39,94 @@ int llc_station_ac_start_ack_timer(struct llc_station *station,
}
}
int
llc_station_ac_set_retry_cnt_0
(
struct
llc_station
*
station
,
int
llc_station_ac_set_retry_cnt_0
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
station
->
retry_count
=
0
;
station
->
retry_count
=
0
;
return
0
;
return
0
;
}
}
int
llc_station_ac_inc_retry_cnt_by_1
(
struct
llc_station
*
station
,
int
llc_station_ac_inc_retry_cnt_by_1
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
station
->
retry_count
++
;
station
->
retry_count
++
;
return
0
;
return
0
;
}
}
int
llc_station_ac_set_xid_r_cnt_0
(
struct
llc_station
*
station
,
int
llc_station_ac_set_xid_r_cnt_0
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
station
->
xid_r_count
=
0
;
station
->
xid_r_count
=
0
;
return
0
;
return
0
;
}
}
int
llc_station_ac_inc_xid_r_cnt_by_1
(
struct
llc_station
*
station
,
int
llc_station_ac_inc_xid_r_cnt_by_1
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
station
->
xid_r_count
++
;
station
->
xid_r_count
++
;
return
0
;
return
0
;
}
}
int
llc_station_ac_send_null_dsap_xid_c
(
struct
llc_station
*
station
,
int
llc_station_ac_send_null_dsap_xid_c
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
!
skb
)
if
(
!
n
skb
)
goto
out
;
goto
out
;
rc
=
0
;
rc
=
0
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
0
,
0
,
LLC_PDU_CMD
);
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
0
,
0
,
LLC_PDU_CMD
);
llc_pdu_init_as_xid_cmd
(
skb
,
LLC_XID_NULL_CLASS_2
,
127
);
llc_pdu_init_as_xid_cmd
(
n
skb
,
LLC_XID_NULL_CLASS_2
,
127
);
lan_hdrs_init
(
skb
,
station
->
mac_sa
,
station
->
mac_sa
);
lan_hdrs_init
(
n
skb
,
station
->
mac_sa
,
station
->
mac_sa
);
llc_station_send_pdu
(
station
,
skb
);
llc_station_send_pdu
(
station
,
n
skb
);
out:
out:
return
rc
;
return
rc
;
}
}
int
llc_station_ac_send_xid_r
(
struct
llc_station
*
station
,
int
llc_station_ac_send_xid_r
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
u8
mac_da
[
ETH_ALEN
],
dsap
;
u8
mac_da
[
ETH_ALEN
],
dsap
;
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
ev_skb
;
struct
sk_buff
*
nskb
=
llc_alloc_frame
();
struct
sk_buff
*
skb
=
llc_alloc_frame
();
if
(
!
skb
)
if
(
!
n
skb
)
goto
out
;
goto
out
;
rc
=
0
;
rc
=
0
;
ev_skb
=
ev
->
data
.
pdu
.
skb
;
nskb
->
dev
=
skb
->
dev
;
skb
->
dev
=
ev_skb
->
dev
;
llc_pdu_decode_sa
(
skb
,
mac_da
);
llc_pdu_decode_sa
(
ev_skb
,
mac_da
);
llc_pdu_decode_ssap
(
skb
,
&
dsap
);
llc_pdu_decode_ssap
(
ev_skb
,
&
dsap
);
llc_pdu_header_init
(
nskb
,
LLC_PDU_TYPE_U
,
0
,
dsap
,
LLC_PDU_RSP
);
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
0
,
dsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_xid_rsp
(
nskb
,
LLC_XID_NULL_CLASS_2
,
127
);
llc_pdu_init_as_xid_rsp
(
skb
,
LLC_XID_NULL_CLASS_2
,
127
);
lan_hdrs_init
(
nskb
,
station
->
mac_sa
,
mac_da
);
lan_hdrs_init
(
skb
,
station
->
mac_sa
,
mac_da
);
llc_station_send_pdu
(
station
,
nskb
);
llc_station_send_pdu
(
station
,
skb
);
out:
out:
return
rc
;
return
rc
;
}
}
int
llc_station_ac_send_test_r
(
struct
llc_station
*
station
,
int
llc_station_ac_send_test_r
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
u8
mac_da
[
ETH_ALEN
],
dsap
;
u8
mac_da
[
ETH_ALEN
],
dsap
;
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
ev_skb
;
struct
sk_buff
*
nskb
=
llc_alloc_frame
();
struct
sk_buff
*
skb
=
llc_alloc_frame
();
if
(
!
skb
)
if
(
!
n
skb
)
goto
out
;
goto
out
;
rc
=
0
;
rc
=
0
;
ev_skb
=
ev
->
data
.
pdu
.
skb
;
nskb
->
dev
=
skb
->
dev
;
skb
->
dev
=
ev_skb
->
dev
;
llc_pdu_decode_sa
(
skb
,
mac_da
);
llc_pdu_decode_sa
(
ev_skb
,
mac_da
);
llc_pdu_decode_ssap
(
skb
,
&
dsap
);
llc_pdu_decode_ssap
(
ev_skb
,
&
dsap
);
llc_pdu_header_init
(
nskb
,
LLC_PDU_TYPE_U
,
0
,
dsap
,
LLC_PDU_RSP
);
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
0
,
dsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_test_rsp
(
nskb
,
skb
);
llc_pdu_init_as_test_rsp
(
skb
,
ev_skb
);
lan_hdrs_init
(
nskb
,
station
->
mac_sa
,
mac_da
);
lan_hdrs_init
(
skb
,
station
->
mac_sa
,
mac_da
);
llc_station_send_pdu
(
station
,
nskb
);
llc_station_send_pdu
(
station
,
skb
);
out:
out:
return
rc
;
return
rc
;
}
}
int
llc_station_ac_report_status
(
struct
llc_station
*
station
,
int
llc_station_ac_report_status
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
return
0
;
return
0
;
}
}
...
@@ -138,13 +134,14 @@ int llc_station_ac_report_status(struct llc_station *station,
...
@@ -138,13 +134,14 @@ int llc_station_ac_report_status(struct llc_station *station,
static
void
llc_station_ack_tmr_callback
(
unsigned
long
timeout_data
)
static
void
llc_station_ack_tmr_callback
(
unsigned
long
timeout_data
)
{
{
struct
llc_station
*
station
=
(
struct
llc_station
*
)
timeout_data
;
struct
llc_station
*
station
=
(
struct
llc_station
*
)
timeout_data
;
struct
llc_station_state_ev
*
ev
;
struct
sk_buff
*
skb
=
alloc_skb
(
1
,
GFP_ATOMIC
)
;
station
->
ack_tmr_running
=
0
;
station
->
ack_tmr_running
=
0
;
ev
=
llc_station_alloc_ev
(
station
);
if
(
skb
)
{
if
(
ev
)
{
struct
llc_station_state_ev
*
ev
=
llc_station_ev
(
skb
);
ev
->
type
=
LLC_STATION_EV_TYPE_ACK_TMR
;
ev
->
type
=
LLC_STATION_EV_TYPE_ACK_TMR
;
ev
->
data
.
tmr
.
timer_specific
=
NULL
;
ev
->
data
.
tmr
.
timer_specific
=
NULL
;
llc_station_send_ev
(
station
,
ev
);
llc_station_send_ev
(
station
,
skb
);
}
}
}
}
net/llc/llc_c_ac.c
View file @
649cbf21
...
@@ -32,22 +32,19 @@ static void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data);
...
@@ -32,22 +32,19 @@ static void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data);
static
void
llc_conn_ack_tmr_cb
(
unsigned
long
timeout_data
);
static
void
llc_conn_ack_tmr_cb
(
unsigned
long
timeout_data
);
static
void
llc_conn_rej_tmr_cb
(
unsigned
long
timeout_data
);
static
void
llc_conn_rej_tmr_cb
(
unsigned
long
timeout_data
);
static
void
llc_conn_busy_tmr_cb
(
unsigned
long
timeout_data
);
static
void
llc_conn_busy_tmr_cb
(
unsigned
long
timeout_data
);
static
int
llc_conn_ac_inc_vs_by_1
(
struct
sock
*
sk
,
static
int
llc_conn_ac_inc_vs_by_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
struct
llc_conn_state_ev
*
ev
);
static
void
llc_process_tmr_ev
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
static
void
llc_process_tmr_ev
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
static
int
llc_conn_ac_data_confirm
(
struct
sock
*
sk
,
struct
sk_buff
*
ev
);
static
int
llc_conn_ac_data_confirm
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
#define INCORRECT 0
#define INCORRECT 0
int
llc_conn_ac_clear_remote_busy
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_clear_remote_busy
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
if
(
llc
->
remote_busy_flag
)
{
if
(
llc
->
remote_busy_flag
)
{
u8
nr
;
u8
nr
;
struct
llc_pdu_sn
*
pdu
=
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
(
struct
llc_pdu_sn
*
)
ev
->
data
.
pdu
.
skb
->
nh
.
raw
;
llc
->
remote_busy_flag
=
0
;
llc
->
remote_busy_flag
=
0
;
del_timer
(
&
llc
->
busy_state_timer
.
timer
);
del_timer
(
&
llc
->
busy_state_timer
.
timer
);
...
@@ -58,16 +55,16 @@ int llc_conn_ac_clear_remote_busy(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -58,16 +55,16 @@ int llc_conn_ac_clear_remote_busy(struct sock *sk, struct llc_conn_state_ev *ev)
return
0
;
return
0
;
}
}
int
llc_conn_ac_conn_ind
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_conn_ind
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
int
rc
=
1
;
int
rc
=
1
;
u8
dsap
;
u8
dsap
;
struct
sk_buff
*
skb
=
ev
->
data
.
pdu
.
skb
;
struct
llc_sap
*
sap
;
struct
llc_sap
*
sap
;
llc_pdu_decode_dsap
(
skb
,
&
dsap
);
llc_pdu_decode_dsap
(
skb
,
&
dsap
);
sap
=
llc_sap_find
(
dsap
);
sap
=
llc_sap_find
(
dsap
);
if
(
sap
)
{
if
(
sap
)
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_ind_prim
;
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_ind_prim
;
union
llc_u_prim_data
*
prim_data
=
prim
->
data
;
union
llc_u_prim_data
*
prim_data
=
prim
->
data
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
...
@@ -91,9 +88,9 @@ int llc_conn_ac_conn_ind(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -91,9 +88,9 @@ int llc_conn_ac_conn_ind(struct sock *sk, struct llc_conn_state_ev *ev)
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_conn_confirm
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_conn_confirm
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
sk_buff
*
skb
=
ev
->
data
.
pdu
.
skb
;
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
)
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_cfm_prim
;
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_cfm_prim
;
...
@@ -103,10 +100,7 @@ int llc_conn_ac_conn_confirm(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -103,10 +100,7 @@ int llc_conn_ac_conn_confirm(struct sock *sk, struct llc_conn_state_ev *ev)
prim_data
->
conn
.
pri
=
0
;
prim_data
->
conn
.
pri
=
0
;
prim_data
->
conn
.
status
=
ev
->
status
;
prim_data
->
conn
.
status
=
ev
->
status
;
prim_data
->
conn
.
link
=
llc
->
link
;
prim_data
->
conn
.
link
=
llc
->
link
;
if
(
skb
)
prim_data
->
conn
.
dev
=
skb
->
dev
;
prim_data
->
conn
.
dev
=
skb
->
dev
;
else
printk
(
KERN_ERR
"%s: ev->data.pdu.skb == NULL
\n
"
,
__FUNCTION__
);
prim
->
data
=
prim_data
;
prim
->
data
=
prim_data
;
prim
->
prim
=
LLC_CONN_PRIM
;
prim
->
prim
=
LLC_CONN_PRIM
;
prim
->
sap
=
sap
;
prim
->
sap
=
sap
;
...
@@ -115,9 +109,9 @@ int llc_conn_ac_conn_confirm(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -115,9 +109,9 @@ int llc_conn_ac_conn_confirm(struct sock *sk, struct llc_conn_state_ev *ev)
return
0
;
return
0
;
}
}
static
int
llc_conn_ac_data_confirm
(
struct
sock
*
sk
,
static
int
llc_conn_ac_data_confirm
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_cfm_prim
;
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_cfm_prim
;
...
@@ -136,19 +130,20 @@ static int llc_conn_ac_data_confirm(struct sock *sk,
...
@@ -136,19 +130,20 @@ static int llc_conn_ac_data_confirm(struct sock *sk,
return
0
;
return
0
;
}
}
int
llc_conn_ac_data_ind
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_data_ind
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_conn_rtn_pdu
(
sk
,
ev
->
data
.
pdu
.
skb
,
ev
);
llc_conn_rtn_pdu
(
sk
,
skb
);
return
0
;
return
0
;
}
}
int
llc_conn_ac_disc_ind
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_disc_ind
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
u8
reason
=
0
;
u8
reason
=
0
;
int
rc
=
1
;
int
rc
=
1
;
if
(
ev
->
type
==
LLC_CONN_EV_TYPE_PDU
)
{
if
(
ev
->
type
==
LLC_CONN_EV_TYPE_PDU
)
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
if
(
!
LLC_PDU_IS_RSP
(
pdu
)
&&
if
(
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
...
@@ -186,8 +181,9 @@ int llc_conn_ac_disc_ind(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -186,8 +181,9 @@ int llc_conn_ac_disc_ind(struct sock *sk, struct llc_conn_state_ev *ev)
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_disc_confirm
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_disc_confirm
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_cfm_prim
;
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_cfm_prim
;
...
@@ -204,11 +200,12 @@ int llc_conn_ac_disc_confirm(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -204,11 +200,12 @@ int llc_conn_ac_disc_confirm(struct sock *sk, struct llc_conn_state_ev *ev)
return
0
;
return
0
;
}
}
int
llc_conn_ac_rst_ind
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_rst_ind
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
u8
reason
=
0
;
u8
reason
=
0
;
int
rc
=
1
;
int
rc
=
1
;
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
switch
(
ev
->
type
)
{
switch
(
ev
->
type
)
{
...
@@ -257,8 +254,9 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -257,8 +254,9 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct llc_conn_state_ev *ev)
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_rst_confirm
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_rst_confirm
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_cfm_prim
;
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_cfm_prim
;
...
@@ -274,210 +272,201 @@ int llc_conn_ac_rst_confirm(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -274,210 +272,201 @@ int llc_conn_ac_rst_confirm(struct sock *sk, struct llc_conn_state_ev *ev)
return
0
;
return
0
;
}
}
int
llc_conn_ac_report_status
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_report_status
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
return
0
;
return
0
;
}
}
int
llc_conn_ac_clear_remote_busy_if_f_eq_1
(
struct
sock
*
sk
,
int
llc_conn_ac_clear_remote_busy_if_f_eq_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_sn
*
pdu
=
(
struct
llc_pdu_sn
*
)
ev
->
data
.
pdu
.
skb
->
nh
.
raw
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
)
;
if
(
!
LLC_PDU_IS_RSP
(
pdu
)
&&
if
(
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
!
LLC_I_PF_IS_1
(
pdu
)
&&
llc_sk
(
sk
)
->
ack_pf
)
!
LLC_I_PF_IS_1
(
pdu
)
&&
llc_sk
(
sk
)
->
ack_pf
)
llc_conn_ac_clear_remote_busy
(
sk
,
ev
);
llc_conn_ac_clear_remote_busy
(
sk
,
skb
);
return
0
;
return
0
;
}
}
int
llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2
(
struct
sock
*
sk
,
int
llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
if
(
llc_sk
(
sk
)
->
data_flag
==
2
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
del_timer
(
&
llc_sk
(
sk
)
->
rej_sent_timer
.
timer
);
llc_sk
(
sk
)
->
rej_sent_timer
.
running
=
0
;
if
(
llc
->
data_flag
==
2
)
{
del_timer
(
&
llc
->
rej_sent_timer
.
timer
);
llc
->
rej_sent_timer
.
running
=
0
;
}
}
return
0
;
return
0
;
}
}
int
llc_conn_ac_send_disc_cmd_p_set_x
(
struct
sock
*
sk
,
int
llc_conn_ac_send_disc_cmd_p_set_x
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
u8
p_bit
=
1
;
u8
p_bit
=
1
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_CMD
);
llc
->
daddr
.
lsap
,
LLC_PDU_CMD
);
llc_pdu_init_as_disc_cmd
(
skb
,
p_bit
);
llc_pdu_init_as_disc_cmd
(
n
skb
,
p_bit
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
llc_conn_ac_set_p_flag_1
(
sk
,
ev
);
llc_conn_ac_set_p_flag_1
(
sk
,
skb
);
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_dm_rsp_f_set_p
(
struct
sock
*
sk
,
int
llc_conn_ac_send_dm_rsp_f_set_p
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
sk_buff
*
rx_skb
=
ev
->
data
.
pdu
.
skb
;
u8
f_bit
;
u8
f_bit
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_decode_pf_bit
(
rx_
skb
,
&
f_bit
);
llc_pdu_decode_pf_bit
(
skb
,
&
f_bit
);
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_dm_rsp
(
skb
,
f_bit
);
llc_pdu_init_as_dm_rsp
(
n
skb
,
f_bit
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_dm_rsp_f_set_1
(
struct
sock
*
sk
,
int
llc_conn_ac_send_dm_rsp_f_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
f_bit
=
1
;
u8
f_bit
=
1
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_dm_rsp
(
skb
,
f_bit
);
llc_pdu_init_as_dm_rsp
(
n
skb
,
f_bit
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_dm_rsp_f_set_f_flag
(
struct
sock
*
sk
,
int
llc_conn_ac_send_dm_rsp_f_set_f_flag
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
f_bit
=
llc
->
f_flag
;
u8
f_bit
=
llc
->
f_flag
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_dm_rsp
(
skb
,
f_bit
);
llc_pdu_init_as_dm_rsp
(
n
skb
,
f_bit
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_frmr_rsp_f_set_x
(
struct
sock
*
sk
,
int
llc_conn_ac_send_frmr_rsp_f_set_x
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
u8
f_bit
;
u8
f_bit
;
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
,
*
ev_skb
=
ev
->
data
.
pdu
.
skb
;
struct
sk_buff
*
n
skb
;
struct
llc_pdu_sn
*
pdu
=
(
struct
llc_pdu_sn
*
)
ev_skb
->
nh
.
raw
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
)
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
llc
->
rx_pdu_hdr
=
*
((
u32
*
)
pdu
);
llc
->
rx_pdu_hdr
=
*
((
u32
*
)
pdu
);
if
(
!
LLC_PDU_IS_CMD
(
pdu
))
if
(
!
LLC_PDU_IS_CMD
(
pdu
))
llc_pdu_decode_pf_bit
(
ev_
skb
,
&
f_bit
);
llc_pdu_decode_pf_bit
(
skb
,
&
f_bit
);
else
else
f_bit
=
0
;
f_bit
=
0
;
skb
=
llc_alloc_frame
();
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_frmr_rsp
(
skb
,
pdu
,
f_bit
,
llc
->
vS
,
llc_pdu_init_as_frmr_rsp
(
n
skb
,
pdu
,
f_bit
,
llc
->
vS
,
llc
->
vR
,
INCORRECT
);
llc
->
vR
,
INCORRECT
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_resend_frmr_rsp_f_set_0
(
struct
sock
*
sk
,
int
llc_conn_ac_resend_frmr_rsp_f_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
u8
f_bit
=
0
;
u8
f_bit
=
0
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_pdu_sn
*
pdu
=
(
struct
llc_pdu_sn
*
)
&
llc
->
rx_pdu_hdr
;
struct
llc_pdu_sn
*
pdu
=
(
struct
llc_pdu_sn
*
)
&
llc
->
rx_pdu_hdr
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_frmr_rsp
(
skb
,
pdu
,
f_bit
,
llc
->
vS
,
llc_pdu_init_as_frmr_rsp
(
n
skb
,
pdu
,
f_bit
,
llc
->
vS
,
llc
->
vR
,
INCORRECT
);
llc
->
vR
,
INCORRECT
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_resend_frmr_rsp_f_set_p
(
struct
sock
*
sk
,
int
llc_conn_ac_resend_frmr_rsp_f_set_p
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
u8
f_bit
;
u8
f_bit
;
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
;
struct
sk_buff
*
n
skb
;
llc_pdu_decode_pf_bit
(
ev
->
data
.
pdu
.
skb
,
&
f_bit
);
llc_pdu_decode_pf_bit
(
skb
,
&
f_bit
);
skb
=
llc_alloc_frame
();
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_pdu_sn
*
pdu
=
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
(
struct
llc_pdu_sn
*
)
ev
->
data
.
pdu
.
skb
->
nh
.
raw
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_frmr_rsp
(
skb
,
pdu
,
f_bit
,
llc
->
vS
,
llc_pdu_init_as_frmr_rsp
(
n
skb
,
pdu
,
f_bit
,
llc
->
vS
,
llc
->
vR
,
INCORRECT
);
llc
->
vR
,
INCORRECT
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_i_cmd_p_set_1
(
struct
sock
*
sk
,
int
llc_conn_ac_send_i_cmd_p_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
u8
p_bit
=
1
;
u8
p_bit
=
1
;
struct
sk_buff
*
skb
=
ev
->
data
.
prim
.
data
->
data
->
data
.
skb
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
...
@@ -486,15 +475,13 @@ int llc_conn_ac_send_i_cmd_p_set_1(struct sock *sk,
...
@@ -486,15 +475,13 @@ int llc_conn_ac_send_i_cmd_p_set_1(struct sock *sk,
llc_pdu_init_as_i_cmd
(
skb
,
p_bit
,
llc
->
vS
,
llc
->
vR
);
llc_pdu_init_as_i_cmd
(
skb
,
p_bit
,
llc
->
vS
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_ac_inc_vs_by_1
(
sk
,
ev
);
llc_conn_ac_inc_vs_by_1
(
sk
,
skb
);
return
0
;
return
0
;
}
}
int
llc_conn_ac_send_i_cmd_p_set_0
(
struct
sock
*
sk
,
int
llc_conn_ac_send_i_cmd_p_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
u8
p_bit
=
0
;
u8
p_bit
=
0
;
struct
sk_buff
*
skb
=
ev
->
data
.
prim
.
data
->
data
->
data
.
skb
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
...
@@ -503,14 +490,13 @@ int llc_conn_ac_send_i_cmd_p_set_0(struct sock *sk,
...
@@ -503,14 +490,13 @@ int llc_conn_ac_send_i_cmd_p_set_0(struct sock *sk,
llc_pdu_init_as_i_cmd
(
skb
,
p_bit
,
llc
->
vS
,
llc
->
vR
);
llc_pdu_init_as_i_cmd
(
skb
,
p_bit
,
llc
->
vS
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_ac_inc_vs_by_1
(
sk
,
ev
);
llc_conn_ac_inc_vs_by_1
(
sk
,
skb
);
return
0
;
return
0
;
}
}
int
llc_conn_ac_resend_i_cmd_p_set_1
(
struct
sock
*
sk
,
int
llc_conn_ac_resend_i_cmd_p_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
(
struct
llc_pdu_sn
*
)
ev
->
data
.
pdu
.
skb
->
nh
.
raw
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
)
;
u8
nr
=
LLC_I_GET_NR
(
pdu
);
u8
nr
=
LLC_I_GET_NR
(
pdu
);
llc_conn_resend_i_pdu_as_cmd
(
sk
,
nr
,
1
);
llc_conn_resend_i_pdu_as_cmd
(
sk
,
nr
,
1
);
...
@@ -518,22 +504,20 @@ int llc_conn_ac_resend_i_cmd_p_set_1(struct sock *sk,
...
@@ -518,22 +504,20 @@ int llc_conn_ac_resend_i_cmd_p_set_1(struct sock *sk,
}
}
int
llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr
(
struct
sock
*
sk
,
int
llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_sn
*
pdu
=
(
struct
llc_pdu_sn
*
)
ev
->
data
.
pdu
.
skb
->
nh
.
raw
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
)
;
u8
nr
=
LLC_I_GET_NR
(
pdu
);
u8
nr
=
LLC_I_GET_NR
(
pdu
);
int
rc
=
llc_conn_ac_send_rr_cmd_p_set_1
(
sk
,
ev
);
int
rc
=
llc_conn_ac_send_rr_cmd_p_set_1
(
sk
,
skb
);
if
(
!
rc
)
if
(
!
rc
)
llc_conn_resend_i_pdu_as_cmd
(
sk
,
nr
,
0
);
llc_conn_resend_i_pdu_as_cmd
(
sk
,
nr
,
0
);
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_i_xxx_x_set_0
(
struct
sock
*
sk
,
int
llc_conn_ac_send_i_xxx_x_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
u8
p_bit
=
0
;
u8
p_bit
=
0
;
struct
sk_buff
*
skb
=
ev
->
data
.
prim
.
data
->
data
->
data
.
skb
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
...
@@ -542,14 +526,13 @@ int llc_conn_ac_send_i_xxx_x_set_0(struct sock *sk,
...
@@ -542,14 +526,13 @@ int llc_conn_ac_send_i_xxx_x_set_0(struct sock *sk,
llc_pdu_init_as_i_cmd
(
skb
,
p_bit
,
llc
->
vS
,
llc
->
vR
);
llc_pdu_init_as_i_cmd
(
skb
,
p_bit
,
llc
->
vS
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_ac_inc_vs_by_1
(
sk
,
ev
);
llc_conn_ac_inc_vs_by_1
(
sk
,
skb
);
return
0
;
return
0
;
}
}
int
llc_conn_ac_resend_i_xxx_x_set_0
(
struct
sock
*
sk
,
int
llc_conn_ac_resend_i_xxx_x_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
(
struct
llc_pdu_sn
*
)
ev
->
data
.
pdu
.
skb
->
nh
.
raw
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
)
;
u8
nr
=
LLC_I_GET_NR
(
pdu
);
u8
nr
=
LLC_I_GET_NR
(
pdu
);
llc_conn_resend_i_pdu_as_cmd
(
sk
,
nr
,
0
);
llc_conn_resend_i_pdu_as_cmd
(
sk
,
nr
,
0
);
...
@@ -557,25 +540,25 @@ int llc_conn_ac_resend_i_xxx_x_set_0(struct sock *sk,
...
@@ -557,25 +540,25 @@ int llc_conn_ac_resend_i_xxx_x_set_0(struct sock *sk,
}
}
int
llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr
(
struct
sock
*
sk
,
int
llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
u8
nr
;
u8
nr
;
u8
f_bit
=
0
;
u8
f_bit
=
0
;
struct
llc_pdu_sn
*
pdu
=
(
struct
llc_pdu_sn
*
)
ev
->
data
.
pdu
.
skb
->
nh
.
raw
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
)
;
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_rr_rsp
(
skb
,
f_bit
,
llc
->
vR
);
llc_pdu_init_as_rr_rsp
(
n
skb
,
f_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
if
(
rc
)
{
if
(
rc
)
{
nr
=
LLC_I_GET_NR
(
pdu
);
nr
=
LLC_I_GET_NR
(
pdu
);
...
@@ -585,149 +568,142 @@ int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk,
...
@@ -585,149 +568,142 @@ int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk,
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_resend_i_rsp_f_set_1
(
struct
sock
*
sk
,
int
llc_conn_ac_resend_i_rsp_f_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
(
struct
llc_pdu_sn
*
)
ev
->
data
.
pdu
.
skb
->
nh
.
raw
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
)
;
u8
nr
=
LLC_I_GET_NR
(
pdu
);
u8
nr
=
LLC_I_GET_NR
(
pdu
);
llc_conn_resend_i_pdu_as_rsp
(
sk
,
nr
,
1
);
llc_conn_resend_i_pdu_as_rsp
(
sk
,
nr
,
1
);
return
0
;
return
0
;
}
}
int
llc_conn_ac_send_rej_cmd_p_set_1
(
struct
sock
*
sk
,
int
llc_conn_ac_send_rej_cmd_p_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
p_bit
=
1
;
u8
p_bit
=
1
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_CMD
);
llc
->
daddr
.
lsap
,
LLC_PDU_CMD
);
llc_pdu_init_as_rej_cmd
(
skb
,
p_bit
,
llc
->
vR
);
llc_pdu_init_as_rej_cmd
(
n
skb
,
p_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_rej_rsp_f_set_1
(
struct
sock
*
sk
,
int
llc_conn_ac_send_rej_rsp_f_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
u8
f_bit
=
1
;
u8
f_bit
=
1
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_rej_rsp
(
skb
,
f_bit
,
llc
->
vR
);
llc_pdu_init_as_rej_rsp
(
n
skb
,
f_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_rej_xxx_x_set_0
(
struct
sock
*
sk
,
int
llc_conn_ac_send_rej_xxx_x_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
f_bit
=
0
;
u8
f_bit
=
0
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_rej_rsp
(
skb
,
f_bit
,
llc
->
vR
);
llc_pdu_init_as_rej_rsp
(
n
skb
,
f_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_rnr_cmd_p_set_1
(
struct
sock
*
sk
,
int
llc_conn_ac_send_rnr_cmd_p_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
p_bit
=
1
;
u8
p_bit
=
1
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_CMD
);
llc
->
daddr
.
lsap
,
LLC_PDU_CMD
);
llc_pdu_init_as_rnr_cmd
(
skb
,
p_bit
,
llc
->
vR
);
llc_pdu_init_as_rnr_cmd
(
n
skb
,
p_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_rnr_rsp_f_set_1
(
struct
sock
*
sk
,
int
llc_conn_ac_send_rnr_rsp_f_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
f_bit
=
1
;
u8
f_bit
=
1
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_rnr_rsp
(
skb
,
f_bit
,
llc
->
vR
);
llc_pdu_init_as_rnr_rsp
(
n
skb
,
f_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_rnr_xxx_x_set_0
(
struct
sock
*
sk
,
int
llc_conn_ac_send_rnr_xxx_x_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
u8
f_bit
=
0
;
u8
f_bit
=
0
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_rnr_rsp
(
skb
,
f_bit
,
llc
->
vR
);
llc_pdu_init_as_rnr_rsp
(
n
skb
,
f_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_set_remote_busy
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_remote_busy
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
...
@@ -743,246 +719,234 @@ int llc_conn_ac_set_remote_busy(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -743,246 +719,234 @@ int llc_conn_ac_set_remote_busy(struct sock *sk, struct llc_conn_state_ev *ev)
return
0
;
return
0
;
}
}
int
llc_conn_ac_opt_send_rnr_xxx_x_set_0
(
struct
sock
*
sk
,
int
llc_conn_ac_opt_send_rnr_xxx_x_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
f_bit
=
0
;
u8
f_bit
=
0
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_rnr_rsp
(
skb
,
f_bit
,
llc
->
vR
);
llc_pdu_init_as_rnr_rsp
(
n
skb
,
f_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_rr_cmd_p_set_1
(
struct
sock
*
sk
,
int
llc_conn_ac_send_rr_cmd_p_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
u8
p_bit
=
1
;
u8
p_bit
=
1
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_CMD
);
llc
->
daddr
.
lsap
,
LLC_PDU_CMD
);
llc_pdu_init_as_rr_cmd
(
skb
,
p_bit
,
llc
->
vR
);
llc_pdu_init_as_rr_cmd
(
n
skb
,
p_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_ack_cmd_p_set_1
(
struct
sock
*
sk
,
int
llc_conn_ac_send_ack_cmd_p_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
u8
p_bit
=
1
;
u8
p_bit
=
1
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_CMD
);
llc
->
daddr
.
lsap
,
LLC_PDU_CMD
);
llc_pdu_init_as_rr_cmd
(
skb
,
p_bit
,
llc
->
vR
);
llc_pdu_init_as_rr_cmd
(
n
skb
,
p_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_rr_rsp_f_set_1
(
struct
sock
*
sk
,
int
llc_conn_ac_send_rr_rsp_f_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
f_bit
=
1
;
u8
f_bit
=
1
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_rr_rsp
(
skb
,
f_bit
,
llc
->
vR
);
llc_pdu_init_as_rr_rsp
(
n
skb
,
f_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_ack_rsp_f_set_1
(
struct
sock
*
sk
,
int
llc_conn_ac_send_ack_rsp_f_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
f_bit
=
1
;
u8
f_bit
=
1
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_rr_rsp
(
skb
,
f_bit
,
llc
->
vR
);
llc_pdu_init_as_rr_rsp
(
n
skb
,
f_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_rr_xxx_x_set_0
(
struct
sock
*
sk
,
int
llc_conn_ac_send_rr_xxx_x_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
f_bit
=
0
;
u8
f_bit
=
0
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_rr_rsp
(
skb
,
f_bit
,
llc
->
vR
);
llc_pdu_init_as_rr_rsp
(
n
skb
,
f_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_ack_xxx_x_set_0
(
struct
sock
*
sk
,
int
llc_conn_ac_send_ack_xxx_x_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
f_bit
=
0
;
u8
f_bit
=
0
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_rr_rsp
(
skb
,
f_bit
,
llc
->
vR
);
llc_pdu_init_as_rr_rsp
(
n
skb
,
f_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_sabme_cmd_p_set_x
(
struct
sock
*
sk
,
int
llc_conn_ac_send_sabme_cmd_p_set_x
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
u8
p_bit
=
1
;
u8
p_bit
=
1
;
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
*
dmac
=
llc
->
daddr
.
mac
;
u8
*
dmac
=
llc
->
daddr
.
mac
;
if
(
llc
->
dev
->
flags
&
IFF_LOOPBACK
)
if
(
llc
->
dev
->
flags
&
IFF_LOOPBACK
)
dmac
=
llc
->
dev
->
dev_addr
;
dmac
=
llc
->
dev
->
dev_addr
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_CMD
);
llc
->
daddr
.
lsap
,
LLC_PDU_CMD
);
llc_pdu_init_as_sabme_cmd
(
skb
,
p_bit
);
llc_pdu_init_as_sabme_cmd
(
n
skb
,
p_bit
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
dmac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
dmac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
llc
->
p_flag
=
p_bit
;
llc
->
p_flag
=
p_bit
;
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_ua_rsp_f_set_f_flag
(
struct
sock
*
sk
,
int
llc_conn_ac_send_ua_rsp_f_set_f_flag
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
f_bit
=
llc
->
f_flag
;
u8
f_bit
=
llc
->
f_flag
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_ua_rsp
(
skb
,
f_bit
);
llc_pdu_init_as_ua_rsp
(
n
skb
,
f_bit
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_send_ua_rsp_f_set_p
(
struct
sock
*
sk
,
int
llc_conn_ac_send_ua_rsp_f_set_p
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
u8
f_bit
;
u8
f_bit
;
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
rx_skb
=
ev
->
data
.
pdu
.
skb
;
struct
sk_buff
*
nskb
=
llc_alloc_frame
();
struct
sk_buff
*
skb
;
llc_pdu_decode_pf_bit
(
rx_skb
,
&
f_bit
);
llc_pdu_decode_pf_bit
(
skb
,
&
f_bit
);
skb
=
llc_alloc_frame
();
if
(
nskb
)
{
if
(
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_ua_rsp
(
skb
,
f_bit
);
llc_pdu_init_as_ua_rsp
(
n
skb
,
f_bit
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ac_set_s_flag_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_s_flag_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
s_flag
=
0
;
llc_sk
(
sk
)
->
s_flag
=
0
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_s_flag_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_s_flag_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
s_flag
=
1
;
llc_sk
(
sk
)
->
s_flag
=
1
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_start_p_timer
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_start_p_timer
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
...
@@ -1000,18 +964,16 @@ int llc_conn_ac_start_p_timer(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1000,18 +964,16 @@ int llc_conn_ac_start_p_timer(struct sock *sk, struct llc_conn_state_ev *ev)
/**
/**
* llc_conn_ac_send_ack_if_needed - check if ack is needed
* llc_conn_ac_send_ack_if_needed - check if ack is needed
* @sk: current connection structure
* @sk: current connection structure
* @
ev
: current event
* @
skb
: current event
*
*
* Checks number of received PDUs which have not been acknowledged, yet,
* Checks number of received PDUs which have not been acknowledged, yet,
* If number of them reaches to "npta"(Number of PDUs To Acknowledge) then
* If number of them reaches to "npta"(Number of PDUs To Acknowledge) then
* sends an RR response as acknowledgement for them. Returns 0 for
* sends an RR response as acknowledgement for them. Returns 0 for
* success, 1 otherwise.
* success, 1 otherwise.
*/
*/
int
llc_conn_ac_send_ack_if_needed
(
struct
sock
*
sk
,
int
llc_conn_ac_send_ack_if_needed
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
u8
pf_bit
;
u8
pf_bit
;
struct
sk_buff
*
skb
=
ev
->
data
.
pdu
.
skb
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
llc_pdu_decode_pf_bit
(
skb
,
&
pf_bit
);
llc_pdu_decode_pf_bit
(
skb
,
&
pf_bit
);
...
@@ -1022,10 +984,10 @@ int llc_conn_ac_send_ack_if_needed(struct sock *sk,
...
@@ -1022,10 +984,10 @@ int llc_conn_ac_send_ack_if_needed(struct sock *sk,
llc
->
ack_pf
=
pf_bit
&
1
;
llc
->
ack_pf
=
pf_bit
&
1
;
}
}
if
(((
llc
->
vR
-
llc
->
first_pdu_Ns
+
129
)
%
128
)
>=
llc
->
npta
)
{
if
(((
llc
->
vR
-
llc
->
first_pdu_Ns
+
129
)
%
128
)
>=
llc
->
npta
)
{
llc_conn_ac_send_rr_rsp_f_set_ackpf
(
sk
,
ev
);
llc_conn_ac_send_rr_rsp_f_set_ackpf
(
sk
,
skb
);
llc
->
ack_must_be_send
=
0
;
llc
->
ack_must_be_send
=
0
;
llc
->
ack_pf
=
0
;
llc
->
ack_pf
=
0
;
llc_conn_ac_inc_npta_value
(
sk
,
ev
);
llc_conn_ac_inc_npta_value
(
sk
,
skb
);
}
}
return
0
;
return
0
;
}
}
...
@@ -1033,14 +995,13 @@ int llc_conn_ac_send_ack_if_needed(struct sock *sk,
...
@@ -1033,14 +995,13 @@ int llc_conn_ac_send_ack_if_needed(struct sock *sk,
/**
/**
* llc_conn_ac_rst_sendack_flag - resets ack_must_be_send flag
* llc_conn_ac_rst_sendack_flag - resets ack_must_be_send flag
* @sk: current connection structure
* @sk: current connection structure
* @
ev
: current event
* @
skb
: current event
*
*
* This action resets ack_must_be_send flag of given connection, this flag
* This action resets ack_must_be_send flag of given connection, this flag
* indicates if there is any PDU which has not been acknowledged yet.
* indicates if there is any PDU which has not been acknowledged yet.
* Returns 0 for success, 1 otherwise.
* Returns 0 for success, 1 otherwise.
*/
*/
int
llc_conn_ac_rst_sendack_flag
(
struct
sock
*
sk
,
int
llc_conn_ac_rst_sendack_flag
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
llc_sk
(
sk
)
->
ack_must_be_send
=
llc_sk
(
sk
)
->
ack_pf
=
0
;
llc_sk
(
sk
)
->
ack_must_be_send
=
llc_sk
(
sk
)
->
ack_pf
=
0
;
return
0
;
return
0
;
...
@@ -1049,17 +1010,15 @@ int llc_conn_ac_rst_sendack_flag(struct sock *sk,
...
@@ -1049,17 +1010,15 @@ int llc_conn_ac_rst_sendack_flag(struct sock *sk,
/**
/**
* llc_conn_ac_send_i_rsp_f_set_ackpf - acknowledge received PDUs
* llc_conn_ac_send_i_rsp_f_set_ackpf - acknowledge received PDUs
* @sk: current connection structure
* @sk: current connection structure
* @
ev
: current event
* @
skb
: current event
*
*
* Sends an I response PDU with f-bit set to ack_pf flag as acknowledge to
* Sends an I response PDU with f-bit set to ack_pf flag as acknowledge to
* all received PDUs which have not been acknowledged, yet. ack_pf flag is
* all received PDUs which have not been acknowledged, yet. ack_pf flag is
* set to one if one PDU with p-bit set to one is received. Returns 0 for
* set to one if one PDU with p-bit set to one is received. Returns 0 for
* success, 1 otherwise.
* success, 1 otherwise.
*/
*/
int
llc_conn_ac_send_i_rsp_f_set_ackpf
(
struct
sock
*
sk
,
int
llc_conn_ac_send_i_rsp_f_set_ackpf
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
sk_buff
*
skb
=
ev
->
data
.
prim
.
data
->
data
->
data
.
skb
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
u8
p_bit
=
llc
->
ack_pf
;
u8
p_bit
=
llc
->
ack_pf
;
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
...
@@ -1069,61 +1028,60 @@ int llc_conn_ac_send_i_rsp_f_set_ackpf(struct sock *sk,
...
@@ -1069,61 +1028,60 @@ int llc_conn_ac_send_i_rsp_f_set_ackpf(struct sock *sk,
llc_pdu_init_as_i_cmd
(
skb
,
p_bit
,
llc
->
vS
,
llc
->
vR
);
llc_pdu_init_as_i_cmd
(
skb
,
p_bit
,
llc
->
vS
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_ac_inc_vs_by_1
(
sk
,
ev
);
llc_conn_ac_inc_vs_by_1
(
sk
,
skb
);
return
0
;
return
0
;
}
}
/**
/**
* llc_conn_ac_send_i_as_ack - sends an I-format PDU to acknowledge rx PDUs
* llc_conn_ac_send_i_as_ack - sends an I-format PDU to acknowledge rx PDUs
* @sk: current connection structure.
* @sk: current connection structure.
* @
ev
: current event.
* @
skb
: current event.
*
*
* This action sends an I-format PDU as acknowledge to received PDUs which
* This action sends an I-format PDU as acknowledge to received PDUs which
* have not been acknowledged, yet, if there is any. By using of this
* have not been acknowledged, yet, if there is any. By using of this
* action number of acknowledgements decreases, this technic is called
* action number of acknowledgements decreases, this technic is called
* piggy backing. Returns 0 for success, 1 otherwise.
* piggy backing. Returns 0 for success, 1 otherwise.
*/
*/
int
llc_conn_ac_send_i_as_ack
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_send_i_as_ack
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
if
(
llc
->
ack_must_be_send
)
{
if
(
llc
->
ack_must_be_send
)
{
llc_conn_ac_send_i_rsp_f_set_ackpf
(
sk
,
ev
);
llc_conn_ac_send_i_rsp_f_set_ackpf
(
sk
,
skb
);
llc
->
ack_must_be_send
=
0
;
llc
->
ack_must_be_send
=
0
;
llc
->
ack_pf
=
0
;
llc
->
ack_pf
=
0
;
}
else
}
else
llc_conn_ac_send_i_cmd_p_set_0
(
sk
,
ev
);
llc_conn_ac_send_i_cmd_p_set_0
(
sk
,
skb
);
return
0
;
return
0
;
}
}
/**
/**
* llc_conn_ac_send_rr_rsp_f_set_ackpf - ack all rx PDUs not yet acked
* llc_conn_ac_send_rr_rsp_f_set_ackpf - ack all rx PDUs not yet acked
* @sk: current connection structure.
* @sk: current connection structure.
* @
ev
: current event.
* @
skb
: current event.
*
*
* This action sends an RR response with f-bit set to ack_pf flag as
* This action sends an RR response with f-bit set to ack_pf flag as
* acknowledge to all received PDUs which have not been acknowledged, yet,
* acknowledge to all received PDUs which have not been acknowledged, yet,
* if there is any. ack_pf flag indicates if a PDU has been received with
* if there is any. ack_pf flag indicates if a PDU has been received with
* p-bit set to one. Returns 0 for success, 1 otherwise.
* p-bit set to one. Returns 0 for success, 1 otherwise.
*/
*/
int
llc_conn_ac_send_rr_rsp_f_set_ackpf
(
struct
sock
*
sk
,
int
llc_conn_ac_send_rr_rsp_f_set_ackpf
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
skb
=
llc_alloc_frame
();
struct
sk_buff
*
n
skb
=
llc_alloc_frame
();
if
(
skb
)
{
if
(
n
skb
)
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
u8
f_bit
=
llc
->
ack_pf
;
u8
f_bit
=
llc
->
ack_pf
;
skb
->
dev
=
llc
->
dev
;
n
skb
->
dev
=
llc
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_S
,
sap
->
laddr
.
lsap
,
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc
->
daddr
.
lsap
,
LLC_PDU_RSP
);
llc_pdu_init_as_rr_rsp
(
skb
,
f_bit
,
llc
->
vR
);
llc_pdu_init_as_rr_rsp
(
n
skb
,
f_bit
,
llc
->
vR
);
lan_hdrs_init
(
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
lan_hdrs_init
(
n
skb
,
llc
->
dev
->
dev_addr
,
llc
->
daddr
.
mac
);
rc
=
0
;
rc
=
0
;
llc_conn_send_pdu
(
sk
,
skb
);
llc_conn_send_pdu
(
sk
,
n
skb
);
}
}
return
rc
;
return
rc
;
}
}
...
@@ -1131,14 +1089,14 @@ int llc_conn_ac_send_rr_rsp_f_set_ackpf(struct sock *sk,
...
@@ -1131,14 +1089,14 @@ int llc_conn_ac_send_rr_rsp_f_set_ackpf(struct sock *sk,
/**
/**
* llc_conn_ac_inc_npta_value - tries to make value of npta greater
* llc_conn_ac_inc_npta_value - tries to make value of npta greater
* @sk: current connection structure.
* @sk: current connection structure.
* @
ev
: current event.
* @
skb
: current event.
*
*
* After "inc_cntr" times calling of this action, "npta" increase by one.
* After "inc_cntr" times calling of this action, "npta" increase by one.
* this action tries to make vale of "npta" greater as possible; number of
* this action tries to make vale of "npta" greater as possible; number of
* acknowledgements decreases by increasing of "npta". Returns 0 for
* acknowledgements decreases by increasing of "npta". Returns 0 for
* success, 1 otherwise.
* success, 1 otherwise.
*/
*/
int
llc_conn_ac_inc_npta_value
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_inc_npta_value
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
...
@@ -1156,12 +1114,12 @@ int llc_conn_ac_inc_npta_value(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1156,12 +1114,12 @@ int llc_conn_ac_inc_npta_value(struct sock *sk, struct llc_conn_state_ev *ev)
/**
/**
* llc_conn_ac_adjust_npta_by_rr - decreases "npta" by one
* llc_conn_ac_adjust_npta_by_rr - decreases "npta" by one
* @sk: current connection structure.
* @sk: current connection structure.
* @
ev
: current event.
* @
skb
: current event.
*
*
* After receiving "dec_cntr" times RR command, this action decreases
* After receiving "dec_cntr" times RR command, this action decreases
* "npta" by one. Returns 0 for success, 1 otherwise.
* "npta" by one. Returns 0 for success, 1 otherwise.
*/
*/
int
llc_conn_ac_adjust_npta_by_rr
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_adjust_npta_by_rr
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
...
@@ -1182,13 +1140,12 @@ int llc_conn_ac_adjust_npta_by_rr(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1182,13 +1140,12 @@ int llc_conn_ac_adjust_npta_by_rr(struct sock *sk, struct llc_conn_state_ev *ev)
/**
/**
* llc_conn_ac_adjust_npta_by_rnr - decreases "npta" by one
* llc_conn_ac_adjust_npta_by_rnr - decreases "npta" by one
* @sk: current connection structure.
* @sk: current connection structure.
* @
ev
: current event.
* @
skb
: current event.
*
*
* After receiving "dec_cntr" times RNR command, this action decreases
* After receiving "dec_cntr" times RNR command, this action decreases
* "npta" by one. Returns 0 for success, 1 otherwise.
* "npta" by one. Returns 0 for success, 1 otherwise.
*/
*/
int
llc_conn_ac_adjust_npta_by_rnr
(
struct
sock
*
sk
,
int
llc_conn_ac_adjust_npta_by_rnr
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
...
@@ -1207,13 +1164,13 @@ int llc_conn_ac_adjust_npta_by_rnr(struct sock *sk,
...
@@ -1207,13 +1164,13 @@ int llc_conn_ac_adjust_npta_by_rnr(struct sock *sk,
/**
/**
* llc_conn_ac_dec_tx_win_size - decreases tx window size
* llc_conn_ac_dec_tx_win_size - decreases tx window size
* @sk: current connection structure.
* @sk: current connection structure.
* @
ev
: current event.
* @
skb
: current event.
*
*
* After receiving of a REJ command or response, transmit window size is
* After receiving of a REJ command or response, transmit window size is
* decreased by number of PDUs which are outstanding yet. Returns 0 for
* decreased by number of PDUs which are outstanding yet. Returns 0 for
* success, 1 otherwise.
* success, 1 otherwise.
*/
*/
int
llc_conn_ac_dec_tx_win_size
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_dec_tx_win_size
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
u8
unacked_pdu
=
skb_queue_len
(
&
llc
->
pdu_unack_q
);
u8
unacked_pdu
=
skb_queue_len
(
&
llc
->
pdu_unack_q
);
...
@@ -1227,12 +1184,12 @@ int llc_conn_ac_dec_tx_win_size(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1227,12 +1184,12 @@ int llc_conn_ac_dec_tx_win_size(struct sock *sk, struct llc_conn_state_ev *ev)
/**
/**
* llc_conn_ac_inc_tx_win_size - tx window size is inc by 1
* llc_conn_ac_inc_tx_win_size - tx window size is inc by 1
* @sk: current connection structure.
* @sk: current connection structure.
* @
ev
: current event.
* @
skb
: current event.
*
*
* After receiving an RR response with f-bit set to one, transmit window
* After receiving an RR response with f-bit set to one, transmit window
* size is increased by one. Returns 0 for success, 1 otherwise.
* size is increased by one. Returns 0 for success, 1 otherwise.
*/
*/
int
llc_conn_ac_inc_tx_win_size
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_inc_tx_win_size
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
...
@@ -1242,7 +1199,7 @@ int llc_conn_ac_inc_tx_win_size(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1242,7 +1199,7 @@ int llc_conn_ac_inc_tx_win_size(struct sock *sk, struct llc_conn_state_ev *ev)
return
0
;
return
0
;
}
}
int
llc_conn_ac_stop_all_timers
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_stop_all_timers
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
...
@@ -1259,7 +1216,7 @@ int llc_conn_ac_stop_all_timers(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1259,7 +1216,7 @@ int llc_conn_ac_stop_all_timers(struct sock *sk, struct llc_conn_state_ev *ev)
return
0
;
return
0
;
}
}
int
llc_conn_ac_stop_other_timers
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_stop_other_timers
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
...
@@ -1274,7 +1231,7 @@ int llc_conn_ac_stop_other_timers(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1274,7 +1231,7 @@ int llc_conn_ac_stop_other_timers(struct sock *sk, struct llc_conn_state_ev *ev)
return
0
;
return
0
;
}
}
int
llc_conn_ac_start_ack_timer
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_start_ack_timer
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
...
@@ -1287,7 +1244,7 @@ int llc_conn_ac_start_ack_timer(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1287,7 +1244,7 @@ int llc_conn_ac_start_ack_timer(struct sock *sk, struct llc_conn_state_ev *ev)
return
0
;
return
0
;
}
}
int
llc_conn_ac_start_rej_timer
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_start_rej_timer
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
...
@@ -1302,7 +1259,7 @@ int llc_conn_ac_start_rej_timer(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1302,7 +1259,7 @@ int llc_conn_ac_start_rej_timer(struct sock *sk, struct llc_conn_state_ev *ev)
}
}
int
llc_conn_ac_start_ack_tmr_if_not_running
(
struct
sock
*
sk
,
int
llc_conn_ac_start_ack_tmr_if_not_running
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
...
@@ -1317,14 +1274,14 @@ int llc_conn_ac_start_ack_tmr_if_not_running(struct sock *sk,
...
@@ -1317,14 +1274,14 @@ int llc_conn_ac_start_ack_tmr_if_not_running(struct sock *sk,
return
0
;
return
0
;
}
}
int
llc_conn_ac_stop_ack_timer
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_stop_ack_timer
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
del_timer
(
&
llc_sk
(
sk
)
->
ack_timer
.
timer
);
del_timer
(
&
llc_sk
(
sk
)
->
ack_timer
.
timer
);
llc_sk
(
sk
)
->
ack_timer
.
running
=
0
;
llc_sk
(
sk
)
->
ack_timer
.
running
=
0
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_stop_p_timer
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_stop_p_timer
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
...
@@ -1334,20 +1291,19 @@ int llc_conn_ac_stop_p_timer(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1334,20 +1291,19 @@ int llc_conn_ac_stop_p_timer(struct sock *sk, struct llc_conn_state_ev *ev)
return
0
;
return
0
;
}
}
int
llc_conn_ac_stop_rej_timer
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_stop_rej_timer
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
del_timer
(
&
llc_sk
(
sk
)
->
rej_sent_timer
.
timer
);
del_timer
(
&
llc_sk
(
sk
)
->
rej_sent_timer
.
timer
);
llc_sk
(
sk
)
->
rej_sent_timer
.
running
=
0
;
llc_sk
(
sk
)
->
rej_sent_timer
.
running
=
0
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_upd_nr_received
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_upd_nr_received
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
int
acked
;
int
acked
;
u16
unacked
=
0
;
u16
unacked
=
0
;
u8
fbit
;
u8
fbit
;
struct
sk_buff
*
skb
=
ev
->
data
.
pdu
.
skb
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
struct
llc_pdu_sn
*
pdu
=
(
struct
llc_pdu_sn
*
)
skb
->
nh
.
raw
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
llc
->
last_nr
=
PDU_SUPV_GET_Nr
(
pdu
);
llc
->
last_nr
=
PDU_SUPV_GET_Nr
(
pdu
);
...
@@ -1363,7 +1319,7 @@ int llc_conn_ac_upd_nr_received(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1363,7 +1319,7 @@ int llc_conn_ac_upd_nr_received(struct sock *sk, struct llc_conn_state_ev *ev)
* can send data and must inform to upper layer.
* can send data and must inform to upper layer.
*/
*/
llc
->
failed_data_req
=
0
;
llc
->
failed_data_req
=
0
;
llc_conn_ac_data_confirm
(
sk
,
ev
);
llc_conn_ac_data_confirm
(
sk
,
skb
);
}
}
if
(
unacked
)
{
if
(
unacked
)
{
llc
->
ack_timer
.
timer
.
expires
=
jiffies
+
llc
->
ack_timer
.
timer
.
expires
=
jiffies
+
...
@@ -1377,201 +1333,203 @@ int llc_conn_ac_upd_nr_received(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1377,201 +1333,203 @@ int llc_conn_ac_upd_nr_received(struct sock *sk, struct llc_conn_state_ev *ev)
llc_pdu_decode_pf_bit
(
skb
,
&
fbit
);
llc_pdu_decode_pf_bit
(
skb
,
&
fbit
);
if
(
fbit
==
1
)
{
if
(
fbit
==
1
)
{
llc
->
failed_data_req
=
0
;
llc
->
failed_data_req
=
0
;
llc_conn_ac_data_confirm
(
sk
,
ev
);
llc_conn_ac_data_confirm
(
sk
,
skb
);
}
}
}
}
return
0
;
return
0
;
}
}
int
llc_conn_ac_upd_p_flag
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_upd_p_flag
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
sk_buff
*
skb
=
ev
->
data
.
pdu
.
skb
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
struct
llc_pdu_sn
*
pdu
=
(
struct
llc_pdu_sn
*
)
skb
->
nh
.
raw
;
u8
f_bit
;
u8
f_bit
;
if
(
!
LLC_PDU_IS_RSP
(
pdu
)
&&
if
(
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
llc_pdu_decode_pf_bit
(
skb
,
&
f_bit
)
&&
f_bit
)
{
!
llc_pdu_decode_pf_bit
(
skb
,
&
f_bit
)
&&
f_bit
)
{
llc_sk
(
sk
)
->
p_flag
=
0
;
llc_sk
(
sk
)
->
p_flag
=
0
;
llc_conn_ac_stop_p_timer
(
sk
,
ev
);
llc_conn_ac_stop_p_timer
(
sk
,
skb
);
}
}
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_data_flag_2
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_data_flag_2
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
data_flag
=
2
;
llc_sk
(
sk
)
->
data_flag
=
2
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_data_flag_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_data_flag_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
data_flag
=
0
;
llc_sk
(
sk
)
->
data_flag
=
0
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_data_flag_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_data_flag_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
data_flag
=
1
;
llc_sk
(
sk
)
->
data_flag
=
1
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_data_flag_1_if_data_flag_eq_0
(
struct
sock
*
sk
,
int
llc_conn_ac_set_data_flag_1_if_data_flag_eq_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
if
(
!
llc_sk
(
sk
)
->
data_flag
)
if
(
!
llc_sk
(
sk
)
->
data_flag
)
llc_sk
(
sk
)
->
data_flag
=
1
;
llc_sk
(
sk
)
->
data_flag
=
1
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_p_flag_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_p_flag_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
p_flag
=
0
;
llc_sk
(
sk
)
->
p_flag
=
0
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_p_flag_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_p_flag_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
p_flag
=
1
;
llc_sk
(
sk
)
->
p_flag
=
1
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_remote_busy_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_remote_busy_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
remote_busy_flag
=
0
;
llc_sk
(
sk
)
->
remote_busy_flag
=
0
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_cause_flag_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_cause_flag_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
cause_flag
=
0
;
llc_sk
(
sk
)
->
cause_flag
=
0
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_cause_flag_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_cause_flag_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
cause_flag
=
1
;
llc_sk
(
sk
)
->
cause_flag
=
1
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_retry_cnt_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_retry_cnt_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
retry_count
=
0
;
llc_sk
(
sk
)
->
retry_count
=
0
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_inc_retry_cnt_by_1
(
struct
sock
*
sk
,
int
llc_conn_ac_inc_retry_cnt_by_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
llc_sk
(
sk
)
->
retry_count
++
;
llc_sk
(
sk
)
->
retry_count
++
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_vr_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_vr_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
vR
=
0
;
llc_sk
(
sk
)
->
vR
=
0
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_inc_vr_by_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_inc_vr_by_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
vR
=
PDU_GET_NEXT_Vr
(
llc_sk
(
sk
)
->
vR
);
llc_sk
(
sk
)
->
vR
=
PDU_GET_NEXT_Vr
(
llc_sk
(
sk
)
->
vR
);
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_vs_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_vs_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
vS
=
0
;
llc_sk
(
sk
)
->
vS
=
0
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_vs_nr
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_vs_nr
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
vS
=
llc_sk
(
sk
)
->
last_nr
;
llc_sk
(
sk
)
->
vS
=
llc_sk
(
sk
)
->
last_nr
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_inc_vs_by_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_inc_vs_by_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
vS
=
(
llc_sk
(
sk
)
->
vS
+
1
)
%
128
;
llc_sk
(
sk
)
->
vS
=
(
llc_sk
(
sk
)
->
vS
+
1
)
%
128
;
return
0
;
return
0
;
}
}
int
llc_conn_ac_set_f_flag_p
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_set_f_flag_p
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_pdu_decode_pf_bit
(
ev
->
data
.
pdu
.
skb
,
&
llc_sk
(
sk
)
->
f_flag
);
llc_pdu_decode_pf_bit
(
skb
,
&
llc_sk
(
sk
)
->
f_flag
);
return
0
;
return
0
;
}
}
void
llc_conn_pf_cycle_tmr_cb
(
unsigned
long
timeout_data
)
void
llc_conn_pf_cycle_tmr_cb
(
unsigned
long
timeout_data
)
{
{
struct
sock
*
sk
=
(
struct
sock
*
)
timeout_data
;
struct
sock
*
sk
=
(
struct
sock
*
)
timeout_data
;
struct
llc_conn_state_ev
*
ev
;
struct
sk_buff
*
skb
=
alloc_skb
(
1
,
GFP_ATOMIC
)
;
llc_sk
(
sk
)
->
pf_cycle_timer
.
running
=
0
;
llc_sk
(
sk
)
->
pf_cycle_timer
.
running
=
0
;
ev
=
llc_conn_alloc_ev
(
sk
);
if
(
skb
)
{
if
(
ev
)
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
type
=
LLC_CONN_EV_TYPE_P_TMR
;
ev
->
type
=
LLC_CONN_EV_TYPE_P_TMR
;
ev
->
data
.
tmr
.
timer_specific
=
NULL
;
ev
->
data
.
tmr
.
timer_specific
=
NULL
;
llc_process_tmr_ev
(
sk
,
ev
);
llc_process_tmr_ev
(
sk
,
skb
);
}
}
}
}
static
void
llc_conn_busy_tmr_cb
(
unsigned
long
timeout_data
)
static
void
llc_conn_busy_tmr_cb
(
unsigned
long
timeout_data
)
{
{
struct
sock
*
sk
=
(
struct
sock
*
)
timeout_data
;
struct
sock
*
sk
=
(
struct
sock
*
)
timeout_data
;
struct
llc_conn_state_ev
*
ev
;
struct
sk_buff
*
skb
=
alloc_skb
(
1
,
GFP_ATOMIC
)
;
llc_sk
(
sk
)
->
busy_state_timer
.
running
=
0
;
llc_sk
(
sk
)
->
busy_state_timer
.
running
=
0
;
ev
=
llc_conn_alloc_ev
(
sk
);
if
(
skb
)
{
if
(
ev
)
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
type
=
LLC_CONN_EV_TYPE_BUSY_TMR
;
ev
->
type
=
LLC_CONN_EV_TYPE_BUSY_TMR
;
ev
->
data
.
tmr
.
timer_specific
=
NULL
;
ev
->
data
.
tmr
.
timer_specific
=
NULL
;
llc_process_tmr_ev
(
sk
,
ev
);
llc_process_tmr_ev
(
sk
,
skb
);
}
}
}
}
void
llc_conn_ack_tmr_cb
(
unsigned
long
timeout_data
)
void
llc_conn_ack_tmr_cb
(
unsigned
long
timeout_data
)
{
{
struct
sock
*
sk
=
(
struct
sock
*
)
timeout_data
;
struct
sock
*
sk
=
(
struct
sock
*
)
timeout_data
;
struct
llc_conn_state_ev
*
ev
;
struct
sk_buff
*
skb
=
alloc_skb
(
1
,
GFP_ATOMIC
)
;
llc_sk
(
sk
)
->
ack_timer
.
running
=
0
;
llc_sk
(
sk
)
->
ack_timer
.
running
=
0
;
ev
=
llc_conn_alloc_ev
(
sk
);
if
(
skb
)
{
if
(
ev
)
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
type
=
LLC_CONN_EV_TYPE_ACK_TMR
;
ev
->
type
=
LLC_CONN_EV_TYPE_ACK_TMR
;
ev
->
data
.
tmr
.
timer_specific
=
NULL
;
ev
->
data
.
tmr
.
timer_specific
=
NULL
;
llc_process_tmr_ev
(
sk
,
ev
);
llc_process_tmr_ev
(
sk
,
skb
);
}
}
}
}
static
void
llc_conn_rej_tmr_cb
(
unsigned
long
timeout_data
)
static
void
llc_conn_rej_tmr_cb
(
unsigned
long
timeout_data
)
{
{
struct
sock
*
sk
=
(
struct
sock
*
)
timeout_data
;
struct
sock
*
sk
=
(
struct
sock
*
)
timeout_data
;
struct
llc_conn_state_ev
*
ev
;
struct
sk_buff
*
skb
=
alloc_skb
(
1
,
GFP_ATOMIC
)
;
llc_sk
(
sk
)
->
rej_sent_timer
.
running
=
0
;
llc_sk
(
sk
)
->
rej_sent_timer
.
running
=
0
;
ev
=
llc_conn_alloc_ev
(
sk
);
if
(
skb
)
{
if
(
ev
)
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
type
=
LLC_CONN_EV_TYPE_REJ_TMR
;
ev
->
type
=
LLC_CONN_EV_TYPE_REJ_TMR
;
ev
->
data
.
tmr
.
timer_specific
=
NULL
;
ev
->
data
.
tmr
.
timer_specific
=
NULL
;
llc_process_tmr_ev
(
sk
,
ev
);
llc_process_tmr_ev
(
sk
,
skb
);
}
}
}
}
int
llc_conn_ac_rst_vs
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_rst_vs
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sk
(
sk
)
->
X
=
llc_sk
(
sk
)
->
vS
;
llc_sk
(
sk
)
->
X
=
llc_sk
(
sk
)
->
vS
;
llc_conn_ac_set_vs_nr
(
sk
,
ev
);
llc_conn_ac_set_vs_nr
(
sk
,
skb
);
return
0
;
return
0
;
}
}
int
llc_conn_ac_upd_vs
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ac_upd_vs
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_sn
*
pdu
=
(
struct
llc_pdu_sn
*
)
ev
->
data
.
pdu
.
skb
->
nh
.
raw
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
)
;
u8
nr
=
PDU_SUPV_GET_Nr
(
pdu
);
u8
nr
=
PDU_SUPV_GET_Nr
(
pdu
);
if
(
llc_circular_between
(
llc_sk
(
sk
)
->
vS
,
nr
,
llc_sk
(
sk
)
->
X
))
if
(
llc_circular_between
(
llc_sk
(
sk
)
->
vS
,
nr
,
llc_sk
(
sk
)
->
X
))
llc_conn_ac_set_vs_nr
(
sk
,
ev
);
llc_conn_ac_set_vs_nr
(
sk
,
skb
);
return
0
;
return
0
;
}
}
...
@@ -1582,11 +1540,11 @@ int llc_conn_ac_upd_vs(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1582,11 +1540,11 @@ int llc_conn_ac_upd_vs(struct sock *sk, struct llc_conn_state_ev *ev)
/**
/**
* llc_conn_disc - removes connection from SAP list and frees it
* llc_conn_disc - removes connection from SAP list and frees it
* @sk: closed connection
* @sk: closed connection
* @
ev
: occurred event
* @
skb
: occurred event
*
*
* Returns 2, to indicate the state machine that the connection was freed.
* Returns 2, to indicate the state machine that the connection was freed.
*/
*/
int
llc_conn_disc
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_disc
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sap_unassign_sock
(
llc_sk
(
sk
)
->
sap
,
sk
);
llc_sap_unassign_sock
(
llc_sk
(
sk
)
->
sap
,
sk
);
llc_sock_free
(
sk
);
llc_sock_free
(
sk
);
...
@@ -1596,11 +1554,11 @@ int llc_conn_disc(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -1596,11 +1554,11 @@ int llc_conn_disc(struct sock *sk, struct llc_conn_state_ev *ev)
/**
/**
* llc_conn_reset - resets connection
* llc_conn_reset - resets connection
* @sk : reseting connection.
* @sk : reseting connection.
* @
ev
: occurred event.
* @
skb
: occurred event.
*
*
* Stop all timers, empty all queues and reset all flags.
* Stop all timers, empty all queues and reset all flags.
*/
*/
int
llc_conn_reset
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_reset
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
llc_sock_reset
(
sk
);
llc_sock_reset
(
sk
);
return
0
;
return
0
;
...
@@ -1626,7 +1584,7 @@ u8 llc_circular_between(u8 a, u8 b, u8 c)
...
@@ -1626,7 +1584,7 @@ u8 llc_circular_between(u8 a, u8 b, u8 c)
/**
/**
* llc_process_tmr_ev - timer backend
* llc_process_tmr_ev - timer backend
* @sk: active connection
* @sk: active connection
* @
ev
: occurred event
* @
skb
: occurred event
*
*
* This function is called from timer callback functions. When connection
* This function is called from timer callback functions. When connection
* is busy (during sending a data frame) timer expiration event must be
* is busy (during sending a data frame) timer expiration event must be
...
@@ -1634,25 +1592,20 @@ u8 llc_circular_between(u8 a, u8 b, u8 c)
...
@@ -1634,25 +1592,20 @@ u8 llc_circular_between(u8 a, u8 b, u8 c)
* Queued events will process by process_rxframes_events function after
* Queued events will process by process_rxframes_events function after
* sending data frame. Returns 0 for success, 1 otherwise.
* sending data frame. Returns 0 for success, 1 otherwise.
*/
*/
static
void
llc_process_tmr_ev
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
static
void
llc_process_tmr_ev
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
bh_lock_sock
(
sk
);
bh_lock_sock
(
sk
);
if
(
llc_sk
(
sk
)
->
state
==
LLC_CONN_OUT_OF_SVC
)
{
if
(
llc_sk
(
sk
)
->
state
==
LLC_CONN_OUT_OF_SVC
)
{
printk
(
KERN_WARNING
"timer called on closed connection
\n
"
);
printk
(
KERN_WARNING
"%s: timer called on closed connection
\n
"
,
llc_conn_free_ev
(
ev
);
__FUNCTION__
);
llc_conn_free_ev
(
skb
);
goto
out
;
goto
out
;
}
}
if
(
!
sk
->
lock
.
users
)
if
(
!
sk
->
lock
.
users
)
llc_conn_send_ev
(
sk
,
ev
);
llc_conn_send_ev
(
sk
,
skb
);
else
{
else
{
struct
sk_buff
*
skb
=
alloc_skb
(
1
,
GFP_ATOMIC
);
llc_set_backlog_type
(
skb
,
LLC_EVENT
);
sk_add_backlog
(
sk
,
skb
);
if
(
skb
)
{
skb
->
cb
[
0
]
=
LLC_EVENT
;
skb
->
data
=
(
void
*
)
ev
;
sk_add_backlog
(
sk
,
skb
);
}
else
llc_conn_free_ev
(
ev
);
}
}
out:
out:
bh_unlock_sock
(
sk
);
bh_unlock_sock
(
sk
);
...
...
net/llc/llc_c_ev.c
View file @
649cbf21
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
#include <net/llc_c_ev.h>
#include <net/llc_c_ev.h>
#include <net/llc_pdu.h>
#include <net/llc_pdu.h>
#if
0
#if
1
#define dprintk(args...) printk(KERN_DEBUG args)
#define dprintk(args...) printk(KERN_DEBUG args)
#else
#else
#define dprintk(args...)
#define dprintk(args...)
...
@@ -97,102 +97,111 @@ static u16 llc_util_nr_inside_tx_window(struct sock *sk, u8 nr)
...
@@ -97,102 +97,111 @@ static u16 llc_util_nr_inside_tx_window(struct sock *sk, u8 nr)
return
rc
;
return
rc
;
}
}
int
llc_conn_ev_conn_req
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_conn_req
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
data
.
prim
.
prim
==
LLC_CONN_PRIM
&&
return
ev
->
data
.
prim
.
prim
==
LLC_CONN_PRIM
&&
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
}
}
int
llc_conn_ev_conn_resp
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_conn_resp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
data
.
prim
.
prim
==
LLC_CONN_PRIM
&&
return
ev
->
data
.
prim
.
prim
==
LLC_CONN_PRIM
&&
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_RESP
?
0
:
1
;
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_RESP
?
0
:
1
;
}
}
int
llc_conn_ev_data_req
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_data_req
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
data
.
prim
.
prim
==
LLC_DATA_PRIM
&&
return
ev
->
data
.
prim
.
prim
==
LLC_DATA_PRIM
&&
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
}
}
int
llc_conn_ev_disc_req
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_disc_req
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
data
.
prim
.
prim
==
LLC_DISC_PRIM
&&
return
ev
->
data
.
prim
.
prim
==
LLC_DISC_PRIM
&&
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
}
}
int
llc_conn_ev_rst_req
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_rst_req
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
data
.
prim
.
prim
==
LLC_RESET_PRIM
&&
return
ev
->
data
.
prim
.
prim
==
LLC_RESET_PRIM
&&
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
}
}
int
llc_conn_ev_rst_resp
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_rst_resp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
data
.
prim
.
prim
==
LLC_RESET_PRIM
&&
return
ev
->
data
.
prim
.
prim
==
LLC_RESET_PRIM
&&
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_RESP
?
0
:
1
;
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_RESP
?
0
:
1
;
}
}
int
llc_conn_ev_local_busy_detected
(
struct
sock
*
sk
,
int
llc_conn_ev_local_busy_detected
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
type
==
LLC_CONN_EV_TYPE_SIMPLE
&&
return
ev
->
type
==
LLC_CONN_EV_TYPE_SIMPLE
&&
ev
->
data
.
a
.
ev
==
LLC_CONN_EV_LOCAL_BUSY_DETECTED
?
0
:
1
;
ev
->
data
.
a
.
ev
==
LLC_CONN_EV_LOCAL_BUSY_DETECTED
?
0
:
1
;
}
}
int
llc_conn_ev_local_busy_cleared
(
struct
sock
*
sk
,
int
llc_conn_ev_local_busy_cleared
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
type
==
LLC_CONN_EV_TYPE_SIMPLE
&&
return
ev
->
type
==
LLC_CONN_EV_TYPE_SIMPLE
&&
ev
->
data
.
a
.
ev
==
LLC_CONN_EV_LOCAL_BUSY_CLEARED
?
0
:
1
;
ev
->
data
.
a
.
ev
==
LLC_CONN_EV_LOCAL_BUSY_CLEARED
?
0
:
1
;
}
}
int
llc_conn_ev_rx_bad_pdu
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_rx_bad_pdu
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
return
1
;
return
1
;
}
}
int
llc_conn_ev_rx_disc_cmd_pbit_set_x
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_disc_cmd_pbit_set_x
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
LLC_U_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_DISC
?
0
:
1
;
LLC_U_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_DISC
?
0
:
1
;
}
}
int
llc_conn_ev_rx_dm_rsp_fbit_set_x
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_dm_rsp_fbit_set_x
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
LLC_U_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_DM
?
0
:
1
;
LLC_U_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_DM
?
0
:
1
;
}
}
int
llc_conn_ev_rx_frmr_rsp_fbit_set_x
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_frmr_rsp_fbit_set_x
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
LLC_U_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_FRMR
?
0
:
1
;
LLC_U_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_FRMR
?
0
:
1
;
}
}
int
llc_conn_ev_rx_i_cmd_pbit_set_0
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_i_cmd_pbit_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
!
LLC_I_PF_IS_0
(
pdu
)
&&
!
LLC_I_PF_IS_0
(
pdu
)
&&
LLC_I_GET_NS
(
pdu
)
==
llc_sk
(
sk
)
->
vR
?
0
:
1
;
LLC_I_GET_NS
(
pdu
)
==
llc_sk
(
sk
)
->
vR
?
0
:
1
;
}
}
int
llc_conn_ev_rx_i_cmd_pbit_set_1
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_i_cmd_pbit_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
!
LLC_I_PF_IS_1
(
pdu
)
&&
!
LLC_I_PF_IS_1
(
pdu
)
&&
...
@@ -200,9 +209,9 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk,
...
@@ -200,9 +209,9 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk,
}
}
int
llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
ns
=
LLC_I_GET_NS
(
pdu
);
u8
ns
=
LLC_I_GET_NS
(
pdu
);
...
@@ -212,9 +221,9 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk,
...
@@ -212,9 +221,9 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk,
}
}
int
llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
ns
=
LLC_I_GET_NS
(
pdu
);
u8
ns
=
LLC_I_GET_NS
(
pdu
);
...
@@ -224,9 +233,9 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk,
...
@@ -224,9 +233,9 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk,
}
}
int
llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
ns
=
LLC_I_GET_NS
(
pdu
);
u8
ns
=
LLC_I_GET_NS
(
pdu
);
u16
rc
=
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
ns
!=
vr
&&
u16
rc
=
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
ns
!=
vr
&&
...
@@ -238,39 +247,36 @@ int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk,
...
@@ -238,39 +247,36 @@ int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk,
return
rc
;
return
rc
;
}
}
int
llc_conn_ev_rx_i_rsp_fbit_set_0
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_i_rsp_fbit_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
!
LLC_I_PF_IS_0
(
pdu
)
&&
!
LLC_I_PF_IS_0
(
pdu
)
&&
LLC_I_GET_NS
(
pdu
)
==
llc_sk
(
sk
)
->
vR
?
0
:
1
;
LLC_I_GET_NS
(
pdu
)
==
llc_sk
(
sk
)
->
vR
?
0
:
1
;
}
}
int
llc_conn_ev_rx_i_rsp_fbit_set_1
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_i_rsp_fbit_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
!
LLC_I_PF_IS_1
(
pdu
)
&&
!
LLC_I_PF_IS_1
(
pdu
)
&&
LLC_I_GET_NS
(
pdu
)
==
llc_sk
(
sk
)
->
vR
?
0
:
1
;
LLC_I_GET_NS
(
pdu
)
==
llc_sk
(
sk
)
->
vR
?
0
:
1
;
}
}
int
llc_conn_ev_rx_i_rsp_fbit_set_x
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_i_rsp_fbit_set_x
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
LLC_I_GET_NS
(
pdu
)
==
llc_sk
(
sk
)
->
vR
?
0
:
1
;
LLC_I_GET_NS
(
pdu
)
==
llc_sk
(
sk
)
->
vR
?
0
:
1
;
}
}
int
llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
ns
=
LLC_I_GET_NS
(
pdu
);
u8
ns
=
LLC_I_GET_NS
(
pdu
);
...
@@ -280,9 +286,9 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk,
...
@@ -280,9 +286,9 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk,
}
}
int
llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
ns
=
LLC_I_GET_NS
(
pdu
);
u8
ns
=
LLC_I_GET_NS
(
pdu
);
...
@@ -292,9 +298,9 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk,
...
@@ -292,9 +298,9 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk,
}
}
int
llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
ns
=
LLC_I_GET_NS
(
pdu
);
u8
ns
=
LLC_I_GET_NS
(
pdu
);
...
@@ -303,9 +309,9 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk,
...
@@ -303,9 +309,9 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk,
}
}
int
llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
vr
=
llc_sk
(
sk
)
->
vR
;
u8
ns
=
LLC_I_GET_NS
(
pdu
);
u8
ns
=
LLC_I_GET_NS
(
pdu
);
u16
rc
=
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
ns
!=
vr
&&
u16
rc
=
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_I
(
pdu
)
&&
ns
!=
vr
&&
...
@@ -317,158 +323,142 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk,
...
@@ -317,158 +323,142 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk,
return
rc
;
return
rc
;
}
}
int
llc_conn_ev_rx_rej_cmd_pbit_set_0
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_rej_cmd_pbit_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
!
LLC_S_PF_IS_0
(
pdu
)
&&
!
LLC_S_PF_IS_0
(
pdu
)
&&
LLC_S_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_REJ
?
0
:
1
;
LLC_S_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_REJ
?
0
:
1
;
}
}
int
llc_conn_ev_rx_rej_cmd_pbit_set_1
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_rej_cmd_pbit_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
!
LLC_S_PF_IS_1
(
pdu
)
&&
!
LLC_S_PF_IS_1
(
pdu
)
&&
LLC_S_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_REJ
?
0
:
1
;
LLC_S_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_REJ
?
0
:
1
;
}
}
int
llc_conn_ev_rx_rej_rsp_fbit_set_0
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_rej_rsp_fbit_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
!
LLC_S_PF_IS_0
(
pdu
)
&&
!
LLC_S_PF_IS_0
(
pdu
)
&&
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_REJ
?
0
:
1
;
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_REJ
?
0
:
1
;
}
}
int
llc_conn_ev_rx_rej_rsp_fbit_set_1
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_rej_rsp_fbit_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
!
LLC_S_PF_IS_1
(
pdu
)
&&
!
LLC_S_PF_IS_1
(
pdu
)
&&
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_REJ
?
0
:
1
;
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_REJ
?
0
:
1
;
}
}
int
llc_conn_ev_rx_rej_rsp_fbit_set_x
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_rej_rsp_fbit_set_x
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_REJ
?
0
:
1
;
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_REJ
?
0
:
1
;
}
}
int
llc_conn_ev_rx_rnr_cmd_pbit_set_0
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_rnr_cmd_pbit_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
!
LLC_S_PF_IS_0
(
pdu
)
&&
!
LLC_S_PF_IS_0
(
pdu
)
&&
LLC_S_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_RNR
?
0
:
1
;
LLC_S_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_RNR
?
0
:
1
;
}
}
int
llc_conn_ev_rx_rnr_cmd_pbit_set_1
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_rnr_cmd_pbit_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
!
LLC_S_PF_IS_1
(
pdu
)
&&
!
LLC_S_PF_IS_1
(
pdu
)
&&
LLC_S_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_RNR
?
0
:
1
;
LLC_S_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_RNR
?
0
:
1
;
}
}
int
llc_conn_ev_rx_rnr_rsp_fbit_set_0
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_rnr_rsp_fbit_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
!
LLC_S_PF_IS_0
(
pdu
)
&&
!
LLC_S_PF_IS_0
(
pdu
)
&&
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_RNR
?
0
:
1
;
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_RNR
?
0
:
1
;
}
}
int
llc_conn_ev_rx_rnr_rsp_fbit_set_1
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_rnr_rsp_fbit_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
!
LLC_S_PF_IS_1
(
pdu
)
&&
!
LLC_S_PF_IS_1
(
pdu
)
&&
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_RNR
?
0
:
1
;
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_RNR
?
0
:
1
;
}
}
int
llc_conn_ev_rx_rr_cmd_pbit_set_0
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_rr_cmd_pbit_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
!
LLC_S_PF_IS_0
(
pdu
)
&&
!
LLC_S_PF_IS_0
(
pdu
)
&&
LLC_S_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_RR
?
0
:
1
;
LLC_S_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_RR
?
0
:
1
;
}
}
int
llc_conn_ev_rx_rr_cmd_pbit_set_1
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_rr_cmd_pbit_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
!
LLC_S_PF_IS_1
(
pdu
)
&&
!
LLC_S_PF_IS_1
(
pdu
)
&&
LLC_S_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_RR
?
0
:
1
;
LLC_S_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_RR
?
0
:
1
;
}
}
int
llc_conn_ev_rx_rr_rsp_fbit_set_0
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_rr_rsp_fbit_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
!
LLC_S_PF_IS_0
(
pdu
)
&&
!
LLC_S_PF_IS_0
(
pdu
)
&&
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_RR
?
0
:
1
;
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_RR
?
0
:
1
;
}
}
int
llc_conn_ev_rx_rr_rsp_fbit_set_1
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_rr_rsp_fbit_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_S
(
pdu
)
&&
!
LLC_S_PF_IS_1
(
pdu
)
&&
!
LLC_S_PF_IS_1
(
pdu
)
&&
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_RR
?
0
:
1
;
LLC_S_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_RR
?
0
:
1
;
}
}
int
llc_conn_ev_rx_sabme_cmd_pbit_set_x
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_sabme_cmd_pbit_set_x
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
return
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
LLC_U_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_SABME
?
0
:
1
;
LLC_U_PDU_CMD
(
pdu
)
==
LLC_2_PDU_CMD_SABME
?
0
:
1
;
}
}
int
llc_conn_ev_rx_ua_rsp_fbit_set_x
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_ua_rsp_fbit_set_x
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
return
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
LLC_U_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_UA
?
0
:
1
;
LLC_U_PDU_RSP
(
pdu
)
==
LLC_2_PDU_RSP_UA
?
0
:
1
;
}
}
int
llc_conn_ev_rx_xxx_cmd_pbit_set_1
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_xxx_cmd_pbit_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
u16
rc
=
1
;
u16
rc
=
1
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
if
(
!
LLC_PDU_IS_CMD
(
pdu
))
{
if
(
!
LLC_PDU_IS_CMD
(
pdu
))
{
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
{
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
{
...
@@ -480,11 +470,10 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk,
...
@@ -480,11 +470,10 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk,
return
rc
;
return
rc
;
}
}
int
llc_conn_ev_rx_xxx_cmd_pbit_set_0
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_xxx_cmd_pbit_set_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
u16
rc
=
1
;
u16
rc
=
1
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
if
(
!
LLC_PDU_IS_CMD
(
pdu
))
{
if
(
!
LLC_PDU_IS_CMD
(
pdu
))
{
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
{
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
{
...
@@ -502,11 +491,10 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_0(struct sock *sk,
...
@@ -502,11 +491,10 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_0(struct sock *sk,
return
rc
;
return
rc
;
}
}
int
llc_conn_ev_rx_xxx_cmd_pbit_set_x
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_xxx_cmd_pbit_set_x
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
u16
rc
=
1
;
u16
rc
=
1
;
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
if
(
!
LLC_PDU_IS_CMD
(
pdu
))
{
if
(
!
LLC_PDU_IS_CMD
(
pdu
))
{
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
...
@@ -522,11 +510,10 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk,
...
@@ -522,11 +510,10 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk,
return
rc
;
return
rc
;
}
}
int
llc_conn_ev_rx_xxx_rsp_fbit_set_1
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_xxx_rsp_fbit_set_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
u16
rc
=
1
;
u16
rc
=
1
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
if
(
!
LLC_PDU_IS_RSP
(
pdu
))
{
if
(
!
LLC_PDU_IS_RSP
(
pdu
))
{
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
{
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
{
...
@@ -545,11 +532,10 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk,
...
@@ -545,11 +532,10 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk,
return
rc
;
return
rc
;
}
}
int
llc_conn_ev_rx_xxx_rsp_fbit_set_x
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_xxx_rsp_fbit_set_x
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
u16
rc
=
1
;
u16
rc
=
1
;
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
if
(
!
LLC_PDU_IS_RSP
(
pdu
))
{
if
(
!
LLC_PDU_IS_RSP
(
pdu
))
{
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
...
@@ -567,10 +553,10 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk,
...
@@ -567,10 +553,10 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk,
return
rc
;
return
rc
;
}
}
int
llc_conn_ev_rx_xxx_yyy
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_rx_xxx_yyy
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
u16
rc
=
1
;
u16
rc
=
1
;
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
rc
=
0
;
rc
=
0
;
...
@@ -588,77 +574,79 @@ int llc_conn_ev_rx_xxx_yyy(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -588,77 +574,79 @@ int llc_conn_ev_rx_xxx_yyy(struct sock *sk, struct llc_conn_state_ev *ev)
}
}
int
llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
u16
rc
=
1
;
u16
rc
=
1
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
u8
vs
=
llc_sk
(
sk
)
->
vS
;
u8
vs
=
llc_sk
(
sk
)
->
vS
;
u8
nr
=
LLC_I_GET_NR
(
pdu
);
u8
nr
=
LLC_I_GET_NR
(
pdu
);
if
(
!
LLC_PDU_IS_CMD
(
pdu
))
{
if
(
!
LLC_PDU_IS_CMD
(
pdu
)
&&
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
{
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
&&
if
(
nr
!=
vs
&&
nr
!=
vs
&&
llc_util_nr_inside_tx_window
(
sk
,
nr
))
{
llc_util_nr_inside_tx_window
(
sk
,
nr
))
{
dprintk
(
KERN_ERR
"conn_ev_rx_zzz_cmd_inv_nr matched, state = "
dprintk
(
KERN_ERR
"conn_ev_rx_zzz_cmd_inv_nr "
"%d, vs = %d, nr = %d
\n
"
,
"matched, state = %d, vs = %d, "
llc_sk
(
sk
)
->
state
,
vs
,
nr
);
"nr = %d
\n
"
,
llc_sk
(
sk
)
->
state
,
vs
,
nr
);
rc
=
0
;
rc
=
0
;
}
}
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr
(
struct
sock
*
sk
,
int
llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
u16
rc
=
1
;
u16
rc
=
1
;
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
u8
vs
=
llc_sk
(
sk
)
->
vS
;
u8
vs
=
llc_sk
(
sk
)
->
vS
;
u8
nr
=
LLC_I_GET_NR
(
pdu
);
u8
nr
=
LLC_I_GET_NR
(
pdu
);
if
(
!
LLC_PDU_IS_RSP
(
pdu
))
{
if
(
!
LLC_PDU_IS_RSP
(
pdu
)
&&
if
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
{
(
!
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
LLC_PDU_TYPE_IS_S
(
pdu
))
&&
if
(
nr
!=
vs
&&
nr
!=
vs
&&
llc_util_nr_inside_tx_window
(
sk
,
nr
))
{
llc_util_nr_inside_tx_window
(
sk
,
nr
))
{
rc
=
0
;
rc
=
0
;
dprintk
(
KERN_ERR
"conn_ev_rx_zzz_fbit_set_x_inval_nr matched, "
dprintk
(
KERN_ERR
"conn_ev_rx_zzz_fbit_set"
"state = %d, vs = %d, nr = %d
\n
"
,
"_x_inval_nr matched, state = %d, "
llc_sk
(
sk
)
->
state
,
vs
,
nr
);
"vs = %d, nr = %d
\n
"
,
llc_sk
(
sk
)
->
state
,
vs
,
nr
);
}
}
}
}
return
rc
;
return
rc
;
}
}
int
llc_conn_ev_rx_any_frame
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_rx_any_frame
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
return
0
;
return
0
;
}
}
int
llc_conn_ev_p_tmr_exp
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_p_tmr_exp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
type
!=
LLC_CONN_EV_TYPE_P_TMR
;
return
ev
->
type
!=
LLC_CONN_EV_TYPE_P_TMR
;
}
}
int
llc_conn_ev_ack_tmr_exp
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_ack_tmr_exp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
type
!=
LLC_CONN_EV_TYPE_ACK_TMR
;
return
ev
->
type
!=
LLC_CONN_EV_TYPE_ACK_TMR
;
}
}
int
llc_conn_ev_rej_tmr_exp
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_rej_tmr_exp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
type
!=
LLC_CONN_EV_TYPE_REJ_TMR
;
return
ev
->
type
!=
LLC_CONN_EV_TYPE_REJ_TMR
;
}
}
int
llc_conn_ev_busy_tmr_exp
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_busy_tmr_exp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
type
!=
LLC_CONN_EV_TYPE_BUSY_TMR
;
return
ev
->
type
!=
LLC_CONN_EV_TYPE_BUSY_TMR
;
}
}
int
llc_conn_ev_any_tmr_exp
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_any_tmr_exp
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
type
==
LLC_CONN_EV_TYPE_P_TMR
||
return
ev
->
type
==
LLC_CONN_EV_TYPE_P_TMR
||
ev
->
type
==
LLC_CONN_EV_TYPE_ACK_TMR
||
ev
->
type
==
LLC_CONN_EV_TYPE_ACK_TMR
||
...
@@ -666,13 +654,15 @@ int llc_conn_ev_any_tmr_exp(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -666,13 +654,15 @@ int llc_conn_ev_any_tmr_exp(struct sock *sk, struct llc_conn_state_ev *ev)
ev
->
type
==
LLC_CONN_EV_TYPE_BUSY_TMR
?
0
:
1
;
ev
->
type
==
LLC_CONN_EV_TYPE_BUSY_TMR
?
0
:
1
;
}
}
int
llc_conn_ev_init_p_f_cycle
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_init_p_f_cycle
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
return
1
;
return
1
;
}
}
int
llc_conn_ev_tx_buffer_full
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_tx_buffer_full
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
return
ev
->
type
==
LLC_CONN_EV_TYPE_SIMPLE
&&
return
ev
->
type
==
LLC_CONN_EV_TYPE_SIMPLE
&&
ev
->
data
.
a
.
ev
==
LLC_CONN_EV_TX_BUFF_FULL
?
0
:
1
;
ev
->
data
.
a
.
ev
==
LLC_CONN_EV_TX_BUFF_FULL
?
0
:
1
;
}
}
...
@@ -683,26 +673,22 @@ int llc_conn_ev_tx_buffer_full(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -683,26 +673,22 @@ int llc_conn_ev_tx_buffer_full(struct sock *sk, struct llc_conn_state_ev *ev)
* the connection and return either a 0 for success or a non-zero value
* the connection and return either a 0 for success or a non-zero value
* for not-success; verify the event is the type we expect
* for not-success; verify the event is the type we expect
*/
*/
int
llc_conn_ev_qlfy_data_flag_eq_1
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_data_flag_eq_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
return
llc_sk
(
sk
)
->
data_flag
!=
1
;
return
llc_sk
(
sk
)
->
data_flag
!=
1
;
}
}
int
llc_conn_ev_qlfy_data_flag_eq_0
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_data_flag_eq_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
return
llc_sk
(
sk
)
->
data_flag
;
return
llc_sk
(
sk
)
->
data_flag
;
}
}
int
llc_conn_ev_qlfy_data_flag_eq_2
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_data_flag_eq_2
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
return
llc_sk
(
sk
)
->
data_flag
!=
2
;
return
llc_sk
(
sk
)
->
data_flag
!=
2
;
}
}
int
llc_conn_ev_qlfy_p_flag_eq_1
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_p_flag_eq_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
return
llc_sk
(
sk
)
->
p_flag
!=
1
;
return
llc_sk
(
sk
)
->
p_flag
!=
1
;
}
}
...
@@ -710,7 +696,7 @@ int llc_conn_ev_qlfy_p_flag_eq_1(struct sock *sk,
...
@@ -710,7 +696,7 @@ int llc_conn_ev_qlfy_p_flag_eq_1(struct sock *sk,
/**
/**
* conn_ev_qlfy_last_frame_eq_1 - checks if frame is last in tx window
* conn_ev_qlfy_last_frame_eq_1 - checks if frame is last in tx window
* @sk: current connection structure.
* @sk: current connection structure.
* @
ev
: current event.
* @
skb
: current event.
*
*
* This function determines when frame which is sent, is last frame of
* This function determines when frame which is sent, is last frame of
* transmit window, if it is then this function return zero else return
* transmit window, if it is then this function return zero else return
...
@@ -718,8 +704,7 @@ int llc_conn_ev_qlfy_p_flag_eq_1(struct sock *sk,
...
@@ -718,8 +704,7 @@ int llc_conn_ev_qlfy_p_flag_eq_1(struct sock *sk,
* as I-format command with p-bit set to one. Returns 0 if frame is last
* as I-format command with p-bit set to one. Returns 0 if frame is last
* frame, 1 otherwise.
* frame, 1 otherwise.
*/
*/
int
llc_conn_ev_qlfy_last_frame_eq_1
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_last_frame_eq_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
return
!
(
skb_queue_len
(
&
llc_sk
(
sk
)
->
pdu_unack_q
)
+
1
==
llc_sk
(
sk
)
->
k
);
return
!
(
skb_queue_len
(
&
llc_sk
(
sk
)
->
pdu_unack_q
)
+
1
==
llc_sk
(
sk
)
->
k
);
}
}
...
@@ -727,147 +712,144 @@ int llc_conn_ev_qlfy_last_frame_eq_1(struct sock *sk,
...
@@ -727,147 +712,144 @@ int llc_conn_ev_qlfy_last_frame_eq_1(struct sock *sk,
/**
/**
* conn_ev_qlfy_last_frame_eq_0 - checks if frame isn't last in tx window
* conn_ev_qlfy_last_frame_eq_0 - checks if frame isn't last in tx window
* @sk: current connection structure.
* @sk: current connection structure.
* @
ev
: current event.
* @
skb
: current event.
*
*
* This function determines when frame which is sent, isn't last frame of
* This function determines when frame which is sent, isn't last frame of
* transmit window, if it isn't then this function return zero else return
* transmit window, if it isn't then this function return zero else return
* one. Returns 0 if frame isn't last frame, 1 otherwise.
* one. Returns 0 if frame isn't last frame, 1 otherwise.
*/
*/
int
llc_conn_ev_qlfy_last_frame_eq_0
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_last_frame_eq_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
return
skb_queue_len
(
&
llc_sk
(
sk
)
->
pdu_unack_q
)
+
1
==
llc_sk
(
sk
)
->
k
;
return
skb_queue_len
(
&
llc_sk
(
sk
)
->
pdu_unack_q
)
+
1
==
llc_sk
(
sk
)
->
k
;
}
}
int
llc_conn_ev_qlfy_p_flag_eq_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_qlfy_p_flag_eq_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
return
llc_sk
(
sk
)
->
p_flag
;
return
llc_sk
(
sk
)
->
p_flag
;
}
}
int
llc_conn_ev_qlfy_p_flag_eq_f
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_qlfy_p_flag_eq_f
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
u8
f_bit
;
u8
f_bit
;
struct
sk_buff
*
skb
;
if
(
ev
->
type
==
LLC_CONN_EV_TYPE_PDU
)
skb
=
ev
->
data
.
pdu
.
skb
;
else
skb
=
ev
->
data
.
prim
.
data
->
data
->
conn
.
skb
;
llc_pdu_decode_pf_bit
(
skb
,
&
f_bit
);
llc_pdu_decode_pf_bit
(
skb
,
&
f_bit
);
return
llc_sk
(
sk
)
->
p_flag
==
f_bit
?
0
:
1
;
return
llc_sk
(
sk
)
->
p_flag
==
f_bit
?
0
:
1
;
}
}
int
llc_conn_ev_qlfy_remote_busy_eq_0
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_remote_busy_eq_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
return
llc_sk
(
sk
)
->
remote_busy_flag
;
return
llc_sk
(
sk
)
->
remote_busy_flag
;
}
}
int
llc_conn_ev_qlfy_remote_busy_eq_1
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_remote_busy_eq_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
return
!
llc_sk
(
sk
)
->
remote_busy_flag
;
return
!
llc_sk
(
sk
)
->
remote_busy_flag
;
}
}
int
llc_conn_ev_qlfy_retry_cnt_lt_n2
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_retry_cnt_lt_n2
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
return
!
(
llc_sk
(
sk
)
->
retry_count
<
llc_sk
(
sk
)
->
n2
);
return
!
(
llc_sk
(
sk
)
->
retry_count
<
llc_sk
(
sk
)
->
n2
);
}
}
int
llc_conn_ev_qlfy_retry_cnt_gte_n2
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_retry_cnt_gte_n2
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
return
!
(
llc_sk
(
sk
)
->
retry_count
>=
llc_sk
(
sk
)
->
n2
);
return
!
(
llc_sk
(
sk
)
->
retry_count
>=
llc_sk
(
sk
)
->
n2
);
}
}
int
llc_conn_ev_qlfy_s_flag_eq_1
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_qlfy_s_flag_eq_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
return
!
llc_sk
(
sk
)
->
s_flag
;
return
!
llc_sk
(
sk
)
->
s_flag
;
}
}
int
llc_conn_ev_qlfy_s_flag_eq_0
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_ev_qlfy_s_flag_eq_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
return
llc_sk
(
sk
)
->
s_flag
;
return
llc_sk
(
sk
)
->
s_flag
;
}
}
int
llc_conn_ev_qlfy_cause_flag_eq_1
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_cause_flag_eq_1
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
return
!
llc_sk
(
sk
)
->
cause_flag
;
return
!
llc_sk
(
sk
)
->
cause_flag
;
}
}
int
llc_conn_ev_qlfy_cause_flag_eq_0
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_cause_flag_eq_0
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
return
llc_sk
(
sk
)
->
cause_flag
;
return
llc_sk
(
sk
)
->
cause_flag
;
}
}
int
llc_conn_ev_qlfy_init_p_f_cycle
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_init_p_f_cycle
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
return
0
;
return
0
;
}
}
int
llc_conn_ev_qlfy_set_status_conn
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_set_status_conn
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
status
=
LLC_STATUS_CONN
;
ev
->
status
=
LLC_STATUS_CONN
;
return
0
;
return
0
;
}
}
int
llc_conn_ev_qlfy_set_status_disc
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_set_status_disc
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
status
=
LLC_STATUS_DISC
;
ev
->
status
=
LLC_STATUS_DISC
;
return
0
;
return
0
;
}
}
int
llc_conn_ev_qlfy_set_status_impossible
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_set_status_impossible
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
status
=
LLC_STATUS_IMPOSSIBLE
;
ev
->
status
=
LLC_STATUS_IMPOSSIBLE
;
return
0
;
return
0
;
}
}
int
llc_conn_ev_qlfy_set_status_failed
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_set_status_failed
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
status
=
LLC_STATUS_FAILED
;
ev
->
status
=
LLC_STATUS_FAILED
;
return
0
;
return
0
;
}
}
int
llc_conn_ev_qlfy_set_status_remote_busy
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_set_status_remote_busy
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
status
=
LLC_STATUS_REMOTE_BUSY
;
ev
->
status
=
LLC_STATUS_REMOTE_BUSY
;
return
0
;
return
0
;
}
}
int
llc_conn_ev_qlfy_set_status_received
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_set_status_received
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
status
=
LLC_STATUS_RECEIVED
;
ev
->
status
=
LLC_STATUS_RECEIVED
;
return
0
;
return
0
;
}
}
int
llc_conn_ev_qlfy_set_status_refuse
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_set_status_refuse
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
status
=
LLC_STATUS_REFUSE
;
ev
->
status
=
LLC_STATUS_REFUSE
;
return
0
;
return
0
;
}
}
int
llc_conn_ev_qlfy_set_status_conflict
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_set_status_conflict
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
status
=
LLC_STATUS_CONFLICT
;
ev
->
status
=
LLC_STATUS_CONFLICT
;
return
0
;
return
0
;
}
}
int
llc_conn_ev_qlfy_set_status_rst_done
(
struct
sock
*
sk
,
int
llc_conn_ev_qlfy_set_status_rst_done
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
status
=
LLC_STATUS_RESET_DONE
;
ev
->
status
=
LLC_STATUS_RESET_DONE
;
return
0
;
return
0
;
}
}
net/llc/llc_c_st.c
View file @
649cbf21
...
@@ -347,7 +347,7 @@ static struct llc_conn_state_trans llc_common_state_trans_11d = {
...
@@ -347,7 +347,7 @@ static struct llc_conn_state_trans llc_common_state_trans_11d = {
* Common dummy state transition; must be last entry for all state
* Common dummy state transition; must be last entry for all state
* transition groups - it'll be on .bss, so will be zeroed.
* transition groups - it'll be on .bss, so will be zeroed.
*/
*/
static
struct
llc_conn_state_trans
llc_common_state_trans_
n
;
static
struct
llc_conn_state_trans
llc_common_state_trans_
end
;
/* LLC_CONN_STATE_ADM transitions */
/* LLC_CONN_STATE_ADM transitions */
/* State transitions for LLC_CONN_EV_CONN_REQ event */
/* State transitions for LLC_CONN_EV_CONN_REQ event */
...
@@ -432,15 +432,15 @@ static struct llc_conn_state_trans llc_adm_state_trans_5 = {
...
@@ -432,15 +432,15 @@ static struct llc_conn_state_trans llc_adm_state_trans_5 = {
*/
*/
static
struct
llc_conn_state_trans
*
llc_adm_state_transitions
[]
=
{
static
struct
llc_conn_state_trans
*
llc_adm_state_transitions
[]
=
{
[
0
]
=
&
llc_adm_state_trans_1
,
/* Request */
[
0
]
=
&
llc_adm_state_trans_1
,
/* Request */
[
1
]
=
&
llc_common_state_trans_
n
,
[
1
]
=
&
llc_common_state_trans_
end
,
[
2
]
=
&
llc_common_state_trans_
n
,
/* local_busy */
[
2
]
=
&
llc_common_state_trans_
end
,
/* local_busy */
[
3
]
=
&
llc_common_state_trans_
n
,
/* init_pf_cycle */
[
3
]
=
&
llc_common_state_trans_
end
,
/* init_pf_cycle */
[
4
]
=
&
llc_common_state_trans_
n
,
/* timer */
[
4
]
=
&
llc_common_state_trans_
end
,
/* timer */
[
5
]
=
&
llc_adm_state_trans_2
,
/* Receive frame */
[
5
]
=
&
llc_adm_state_trans_2
,
/* Receive frame */
[
6
]
=
&
llc_adm_state_trans_3
,
[
6
]
=
&
llc_adm_state_trans_3
,
[
7
]
=
&
llc_adm_state_trans_4
,
[
7
]
=
&
llc_adm_state_trans_4
,
[
8
]
=
&
llc_adm_state_trans_5
,
[
8
]
=
&
llc_adm_state_trans_5
,
[
9
]
=
&
llc_common_state_trans_
n
,
[
9
]
=
&
llc_common_state_trans_
end
,
};
};
/* LLC_CONN_STATE_SETUP transitions */
/* LLC_CONN_STATE_SETUP transitions */
...
@@ -593,18 +593,18 @@ static struct llc_conn_state_trans llc_setup_state_trans_8 = {
...
@@ -593,18 +593,18 @@ static struct llc_conn_state_trans llc_setup_state_trans_8 = {
* one to each transition
* one to each transition
*/
*/
static
struct
llc_conn_state_trans
*
llc_setup_state_transitions
[]
=
{
static
struct
llc_conn_state_trans
*
llc_setup_state_transitions
[]
=
{
[
0
]
=
&
llc_common_state_trans_
n
,
/* Request */
[
0
]
=
&
llc_common_state_trans_
end
,
/* Request */
[
1
]
=
&
llc_common_state_trans_
n
,
/* local busy */
[
1
]
=
&
llc_common_state_trans_
end
,
/* local busy */
[
2
]
=
&
llc_common_state_trans_
n
,
/* init_pf_cycle */
[
2
]
=
&
llc_common_state_trans_
end
,
/* init_pf_cycle */
[
3
]
=
&
llc_setup_state_trans_3
,
/* Timer */
[
3
]
=
&
llc_setup_state_trans_3
,
/* Timer */
[
4
]
=
&
llc_setup_state_trans_7
,
[
4
]
=
&
llc_setup_state_trans_7
,
[
5
]
=
&
llc_setup_state_trans_8
,
[
5
]
=
&
llc_setup_state_trans_8
,
[
6
]
=
&
llc_common_state_trans_
n
,
[
6
]
=
&
llc_common_state_trans_
end
,
[
7
]
=
&
llc_setup_state_trans_1
,
/* Receive frame */
[
7
]
=
&
llc_setup_state_trans_1
,
/* Receive frame */
[
8
]
=
&
llc_setup_state_trans_2
,
[
8
]
=
&
llc_setup_state_trans_2
,
[
9
]
=
&
llc_setup_state_trans_4
,
[
9
]
=
&
llc_setup_state_trans_4
,
[
10
]
=
&
llc_setup_state_trans_5
,
[
10
]
=
&
llc_setup_state_trans_5
,
[
11
]
=
&
llc_common_state_trans_
n
,
[
11
]
=
&
llc_common_state_trans_
end
,
};
};
/* LLC_CONN_STATE_NORMAL transitions */
/* LLC_CONN_STATE_NORMAL transitions */
...
@@ -1287,13 +1287,13 @@ static struct llc_conn_state_trans *llc_normal_state_transitions[] = {
...
@@ -1287,13 +1287,13 @@ static struct llc_conn_state_trans *llc_normal_state_transitions[] = {
[
2
]
=
&
llc_normal_state_trans_2_1
,
[
2
]
=
&
llc_normal_state_trans_2_1
,
[
3
]
=
&
llc_common_state_trans_1
,
[
3
]
=
&
llc_common_state_trans_1
,
[
4
]
=
&
llc_common_state_trans_2
,
[
4
]
=
&
llc_common_state_trans_2
,
[
5
]
=
&
llc_common_state_trans_
n
,
[
5
]
=
&
llc_common_state_trans_
end
,
[
6
]
=
&
llc_normal_state_trans_21
,
[
6
]
=
&
llc_normal_state_trans_21
,
[
7
]
=
&
llc_normal_state_trans_3
,
/* Local busy */
[
7
]
=
&
llc_normal_state_trans_3
,
/* Local busy */
[
8
]
=
&
llc_normal_state_trans_4
,
[
8
]
=
&
llc_normal_state_trans_4
,
[
9
]
=
&
llc_common_state_trans_
n
,
[
9
]
=
&
llc_common_state_trans_
end
,
[
10
]
=
&
llc_normal_state_trans_18
,
/* Init pf cycle */
[
10
]
=
&
llc_normal_state_trans_18
,
/* Init pf cycle */
[
11
]
=
&
llc_common_state_trans_
n
,
[
11
]
=
&
llc_common_state_trans_
end
,
[
12
]
=
&
llc_common_state_trans_11a
,
/* Timers */
[
12
]
=
&
llc_common_state_trans_11a
,
/* Timers */
[
13
]
=
&
llc_common_state_trans_11b
,
[
13
]
=
&
llc_common_state_trans_11b
,
[
14
]
=
&
llc_common_state_trans_11c
,
[
14
]
=
&
llc_common_state_trans_11c
,
...
@@ -1301,7 +1301,7 @@ static struct llc_conn_state_trans *llc_normal_state_transitions[] = {
...
@@ -1301,7 +1301,7 @@ static struct llc_conn_state_trans *llc_normal_state_transitions[] = {
[
16
]
=
&
llc_normal_state_trans_19
,
[
16
]
=
&
llc_normal_state_trans_19
,
[
17
]
=
&
llc_normal_state_trans_20a
,
[
17
]
=
&
llc_normal_state_trans_20a
,
[
18
]
=
&
llc_normal_state_trans_20b
,
[
18
]
=
&
llc_normal_state_trans_20b
,
[
19
]
=
&
llc_common_state_trans_
n
,
[
19
]
=
&
llc_common_state_trans_
end
,
[
20
]
=
&
llc_normal_state_trans_8b
,
/* Receive frames */
[
20
]
=
&
llc_normal_state_trans_8b
,
/* Receive frames */
[
21
]
=
&
llc_normal_state_trans_9b
,
[
21
]
=
&
llc_normal_state_trans_9b
,
[
22
]
=
&
llc_normal_state_trans_10
,
[
22
]
=
&
llc_normal_state_trans_10
,
...
@@ -1337,7 +1337,7 @@ static struct llc_conn_state_trans *llc_normal_state_transitions[] = {
...
@@ -1337,7 +1337,7 @@ static struct llc_conn_state_trans *llc_normal_state_transitions[] = {
[
52
]
=
&
llc_common_state_trans_8c
,
[
52
]
=
&
llc_common_state_trans_8c
,
[
53
]
=
&
llc_common_state_trans_9
,
[
53
]
=
&
llc_common_state_trans_9
,
/* [54] = &llc_common_state_trans_10, */
/* [54] = &llc_common_state_trans_10, */
[
54
]
=
&
llc_common_state_trans_
n
,
[
54
]
=
&
llc_common_state_trans_
end
,
};
};
/* LLC_CONN_STATE_BUSY transitions */
/* LLC_CONN_STATE_BUSY transitions */
...
@@ -2096,16 +2096,16 @@ static struct llc_conn_state_trans *llc_busy_state_transitions[] = {
...
@@ -2096,16 +2096,16 @@ static struct llc_conn_state_trans *llc_busy_state_transitions[] = {
[
2
]
=
&
llc_busy_state_trans_1
,
[
2
]
=
&
llc_busy_state_trans_1
,
[
3
]
=
&
llc_busy_state_trans_2
,
[
3
]
=
&
llc_busy_state_trans_2
,
[
4
]
=
&
llc_busy_state_trans_2_1
,
[
4
]
=
&
llc_busy_state_trans_2_1
,
[
5
]
=
&
llc_common_state_trans_
n
,
[
5
]
=
&
llc_common_state_trans_
end
,
[
6
]
=
&
llc_busy_state_trans_3
,
/* Local busy */
[
6
]
=
&
llc_busy_state_trans_3
,
/* Local busy */
[
7
]
=
&
llc_busy_state_trans_4
,
[
7
]
=
&
llc_busy_state_trans_4
,
[
8
]
=
&
llc_busy_state_trans_5
,
[
8
]
=
&
llc_busy_state_trans_5
,
[
9
]
=
&
llc_busy_state_trans_6
,
[
9
]
=
&
llc_busy_state_trans_6
,
[
10
]
=
&
llc_busy_state_trans_7
,
[
10
]
=
&
llc_busy_state_trans_7
,
[
11
]
=
&
llc_busy_state_trans_8
,
[
11
]
=
&
llc_busy_state_trans_8
,
[
12
]
=
&
llc_common_state_trans_
n
,
[
12
]
=
&
llc_common_state_trans_
end
,
[
13
]
=
&
llc_busy_state_trans_22
,
/* Initiate PF cycle */
[
13
]
=
&
llc_busy_state_trans_22
,
/* Initiate PF cycle */
[
14
]
=
&
llc_common_state_trans_
n
,
[
14
]
=
&
llc_common_state_trans_
end
,
[
15
]
=
&
llc_common_state_trans_11a
,
/* Timer */
[
15
]
=
&
llc_common_state_trans_11a
,
/* Timer */
[
16
]
=
&
llc_common_state_trans_11b
,
[
16
]
=
&
llc_common_state_trans_11b
,
[
17
]
=
&
llc_common_state_trans_11c
,
[
17
]
=
&
llc_common_state_trans_11c
,
...
@@ -2115,7 +2115,7 @@ static struct llc_conn_state_trans *llc_busy_state_transitions[] = {
...
@@ -2115,7 +2115,7 @@ static struct llc_conn_state_trans *llc_busy_state_transitions[] = {
[
21
]
=
&
llc_busy_state_trans_24b
,
[
21
]
=
&
llc_busy_state_trans_24b
,
[
22
]
=
&
llc_busy_state_trans_25
,
[
22
]
=
&
llc_busy_state_trans_25
,
[
23
]
=
&
llc_busy_state_trans_26
,
[
23
]
=
&
llc_busy_state_trans_26
,
[
24
]
=
&
llc_common_state_trans_
n
,
[
24
]
=
&
llc_common_state_trans_
end
,
[
25
]
=
&
llc_busy_state_trans_9a
,
/* Receive frame */
[
25
]
=
&
llc_busy_state_trans_9a
,
/* Receive frame */
[
26
]
=
&
llc_busy_state_trans_9b
,
[
26
]
=
&
llc_busy_state_trans_9b
,
[
27
]
=
&
llc_busy_state_trans_10a
,
[
27
]
=
&
llc_busy_state_trans_10a
,
...
@@ -2150,7 +2150,7 @@ static struct llc_conn_state_trans *llc_busy_state_transitions[] = {
...
@@ -2150,7 +2150,7 @@ static struct llc_conn_state_trans *llc_busy_state_transitions[] = {
[
56
]
=
&
llc_common_state_trans_8c
,
[
56
]
=
&
llc_common_state_trans_8c
,
[
57
]
=
&
llc_common_state_trans_9
,
[
57
]
=
&
llc_common_state_trans_9
,
/* [58] = &llc_common_state_trans_10, */
/* [58] = &llc_common_state_trans_10, */
[
58
]
=
&
llc_common_state_trans_
n
,
[
58
]
=
&
llc_common_state_trans_
end
,
};
};
/* LLC_CONN_STATE_REJ transitions */
/* LLC_CONN_STATE_REJ transitions */
...
@@ -2770,15 +2770,15 @@ static struct llc_conn_state_trans llc_reject_state_trans_20b = {
...
@@ -2770,15 +2770,15 @@ static struct llc_conn_state_trans llc_reject_state_trans_20b = {
static
struct
llc_conn_state_trans
*
llc_reject_state_transitions
[]
=
{
static
struct
llc_conn_state_trans
*
llc_reject_state_transitions
[]
=
{
[
0
]
=
&
llc_common_state_trans_1
,
/* Request */
[
0
]
=
&
llc_common_state_trans_1
,
/* Request */
[
1
]
=
&
llc_common_state_trans_2
,
[
1
]
=
&
llc_common_state_trans_2
,
[
2
]
=
&
llc_common_state_trans_
n
,
[
2
]
=
&
llc_common_state_trans_
end
,
[
3
]
=
&
llc_reject_state_trans_1
,
[
3
]
=
&
llc_reject_state_trans_1
,
[
4
]
=
&
llc_reject_state_trans_2
,
[
4
]
=
&
llc_reject_state_trans_2
,
[
5
]
=
&
llc_reject_state_trans_2_1
,
[
5
]
=
&
llc_reject_state_trans_2_1
,
[
6
]
=
&
llc_reject_state_trans_3
,
/* Local busy */
[
6
]
=
&
llc_reject_state_trans_3
,
/* Local busy */
[
7
]
=
&
llc_reject_state_trans_4
,
[
7
]
=
&
llc_reject_state_trans_4
,
[
8
]
=
&
llc_common_state_trans_
n
,
[
8
]
=
&
llc_common_state_trans_
end
,
[
9
]
=
&
llc_reject_state_trans_17
,
/* Initiate PF cycle */
[
9
]
=
&
llc_reject_state_trans_17
,
/* Initiate PF cycle */
[
10
]
=
&
llc_common_state_trans_
n
,
[
10
]
=
&
llc_common_state_trans_
end
,
[
11
]
=
&
llc_common_state_trans_11a
,
/* Timer */
[
11
]
=
&
llc_common_state_trans_11a
,
/* Timer */
[
12
]
=
&
llc_common_state_trans_11b
,
[
12
]
=
&
llc_common_state_trans_11b
,
[
13
]
=
&
llc_common_state_trans_11c
,
[
13
]
=
&
llc_common_state_trans_11c
,
...
@@ -2787,7 +2787,7 @@ static struct llc_conn_state_trans *llc_reject_state_transitions[] = {
...
@@ -2787,7 +2787,7 @@ static struct llc_conn_state_trans *llc_reject_state_transitions[] = {
[
16
]
=
&
llc_reject_state_trans_19
,
[
16
]
=
&
llc_reject_state_trans_19
,
[
17
]
=
&
llc_reject_state_trans_20a
,
[
17
]
=
&
llc_reject_state_trans_20a
,
[
18
]
=
&
llc_reject_state_trans_20b
,
[
18
]
=
&
llc_reject_state_trans_20b
,
[
19
]
=
&
llc_common_state_trans_
n
,
[
19
]
=
&
llc_common_state_trans_
end
,
[
20
]
=
&
llc_common_state_trans_3
,
/* Receive frame */
[
20
]
=
&
llc_common_state_trans_3
,
/* Receive frame */
[
21
]
=
&
llc_common_state_trans_4
,
[
21
]
=
&
llc_common_state_trans_4
,
[
22
]
=
&
llc_common_state_trans_5
,
[
22
]
=
&
llc_common_state_trans_5
,
...
@@ -2821,7 +2821,7 @@ static struct llc_conn_state_trans *llc_reject_state_transitions[] = {
...
@@ -2821,7 +2821,7 @@ static struct llc_conn_state_trans *llc_reject_state_transitions[] = {
[
49
]
=
&
llc_reject_state_trans_15a
,
[
49
]
=
&
llc_reject_state_trans_15a
,
[
50
]
=
&
llc_reject_state_trans_15b
,
[
50
]
=
&
llc_reject_state_trans_15b
,
[
51
]
=
&
llc_reject_state_trans_16
,
[
51
]
=
&
llc_reject_state_trans_16
,
[
52
]
=
&
llc_common_state_trans_
n
,
[
52
]
=
&
llc_common_state_trans_
end
,
};
};
/* LLC_CONN_STATE_AWAIT transitions */
/* LLC_CONN_STATE_AWAIT transitions */
...
@@ -3209,16 +3209,16 @@ static struct llc_conn_state_trans *llc_await_state_transitions[] = {
...
@@ -3209,16 +3209,16 @@ static struct llc_conn_state_trans *llc_await_state_transitions[] = {
[
0
]
=
&
llc_common_state_trans_1
,
/* Request */
[
0
]
=
&
llc_common_state_trans_1
,
/* Request */
[
1
]
=
&
llc_common_state_trans_2
,
[
1
]
=
&
llc_common_state_trans_2
,
[
2
]
=
&
llc_await_state_trans_1_0
,
[
2
]
=
&
llc_await_state_trans_1_0
,
[
3
]
=
&
llc_common_state_trans_
n
,
[
3
]
=
&
llc_common_state_trans_
end
,
[
4
]
=
&
llc_await_state_trans_1
,
/* Local busy */
[
4
]
=
&
llc_await_state_trans_1
,
/* Local busy */
[
5
]
=
&
llc_common_state_trans_
n
,
[
5
]
=
&
llc_common_state_trans_
end
,
[
6
]
=
&
llc_common_state_trans_
n
,
/* Initiate PF Cycle */
[
6
]
=
&
llc_common_state_trans_
end
,
/* Initiate PF Cycle */
[
7
]
=
&
llc_common_state_trans_11a
,
/* Timer */
[
7
]
=
&
llc_common_state_trans_11a
,
/* Timer */
[
8
]
=
&
llc_common_state_trans_11b
,
[
8
]
=
&
llc_common_state_trans_11b
,
[
9
]
=
&
llc_common_state_trans_11c
,
[
9
]
=
&
llc_common_state_trans_11c
,
[
10
]
=
&
llc_common_state_trans_11d
,
[
10
]
=
&
llc_common_state_trans_11d
,
[
11
]
=
&
llc_await_state_trans_14
,
[
11
]
=
&
llc_await_state_trans_14
,
[
12
]
=
&
llc_common_state_trans_
n
,
[
12
]
=
&
llc_common_state_trans_
end
,
[
13
]
=
&
llc_common_state_trans_3
,
/* Receive frame */
[
13
]
=
&
llc_common_state_trans_3
,
/* Receive frame */
[
14
]
=
&
llc_common_state_trans_4
,
[
14
]
=
&
llc_common_state_trans_4
,
[
15
]
=
&
llc_common_state_trans_5
,
[
15
]
=
&
llc_common_state_trans_5
,
...
@@ -3250,7 +3250,7 @@ static struct llc_conn_state_trans *llc_await_state_transitions[] = {
...
@@ -3250,7 +3250,7 @@ static struct llc_conn_state_trans *llc_await_state_transitions[] = {
[
40
]
=
&
llc_await_state_trans_12a
,
[
40
]
=
&
llc_await_state_trans_12a
,
[
41
]
=
&
llc_await_state_trans_12b
,
[
41
]
=
&
llc_await_state_trans_12b
,
[
42
]
=
&
llc_await_state_trans_13
,
[
42
]
=
&
llc_await_state_trans_13
,
[
43
]
=
&
llc_common_state_trans_
n
,
[
43
]
=
&
llc_common_state_trans_
end
,
};
};
/* LLC_CONN_STATE_AWAIT_BUSY transitions */
/* LLC_CONN_STATE_AWAIT_BUSY transitions */
...
@@ -3683,18 +3683,18 @@ static struct llc_conn_state_trans *llc_await_busy_state_transitions[] = {
...
@@ -3683,18 +3683,18 @@ static struct llc_conn_state_trans *llc_await_busy_state_transitions[] = {
[
0
]
=
&
llc_common_state_trans_1
,
/* Request */
[
0
]
=
&
llc_common_state_trans_1
,
/* Request */
[
1
]
=
&
llc_common_state_trans_2
,
[
1
]
=
&
llc_common_state_trans_2
,
[
2
]
=
&
llc_await_busy_state_trans_1_0
,
[
2
]
=
&
llc_await_busy_state_trans_1_0
,
[
3
]
=
&
llc_common_state_trans_
n
,
[
3
]
=
&
llc_common_state_trans_
end
,
[
4
]
=
&
llc_await_busy_state_trans_1
,
/* Local busy */
[
4
]
=
&
llc_await_busy_state_trans_1
,
/* Local busy */
[
5
]
=
&
llc_await_busy_state_trans_2
,
[
5
]
=
&
llc_await_busy_state_trans_2
,
[
6
]
=
&
llc_await_busy_state_trans_3
,
[
6
]
=
&
llc_await_busy_state_trans_3
,
[
7
]
=
&
llc_common_state_trans_
n
,
[
7
]
=
&
llc_common_state_trans_
end
,
[
8
]
=
&
llc_common_state_trans_
n
,
/* Initiate PF cycle */
[
8
]
=
&
llc_common_state_trans_
end
,
/* Initiate PF cycle */
[
9
]
=
&
llc_common_state_trans_11a
,
/* Timer */
[
9
]
=
&
llc_common_state_trans_11a
,
/* Timer */
[
10
]
=
&
llc_common_state_trans_11b
,
[
10
]
=
&
llc_common_state_trans_11b
,
[
11
]
=
&
llc_common_state_trans_11c
,
[
11
]
=
&
llc_common_state_trans_11c
,
[
12
]
=
&
llc_common_state_trans_11d
,
[
12
]
=
&
llc_common_state_trans_11d
,
[
13
]
=
&
llc_await_busy_state_trans_16
,
[
13
]
=
&
llc_await_busy_state_trans_16
,
[
14
]
=
&
llc_common_state_trans_
n
,
[
14
]
=
&
llc_common_state_trans_
end
,
[
15
]
=
&
llc_await_busy_state_trans_4
,
/* Receive frame */
[
15
]
=
&
llc_await_busy_state_trans_4
,
/* Receive frame */
[
16
]
=
&
llc_await_busy_state_trans_5a
,
[
16
]
=
&
llc_await_busy_state_trans_5a
,
[
17
]
=
&
llc_await_busy_state_trans_5b
,
[
17
]
=
&
llc_await_busy_state_trans_5b
,
...
@@ -3726,7 +3726,7 @@ static struct llc_conn_state_trans *llc_await_busy_state_transitions[] = {
...
@@ -3726,7 +3726,7 @@ static struct llc_conn_state_trans *llc_await_busy_state_transitions[] = {
[
43
]
=
&
llc_common_state_trans_8c
,
[
43
]
=
&
llc_common_state_trans_8c
,
[
44
]
=
&
llc_common_state_trans_9
,
[
44
]
=
&
llc_common_state_trans_9
,
/* [45] = &llc_common_state_trans_10, */
/* [45] = &llc_common_state_trans_10, */
[
45
]
=
&
llc_common_state_trans_
n
,
[
45
]
=
&
llc_common_state_trans_
end
,
};
};
/* ----------------- LLC_CONN_STATE_AWAIT_REJ transitions --------------- */
/* ----------------- LLC_CONN_STATE_AWAIT_REJ transitions --------------- */
...
@@ -4110,16 +4110,16 @@ static struct llc_conn_state_trans *llc_await_rejct_state_transitions[] = {
...
@@ -4110,16 +4110,16 @@ static struct llc_conn_state_trans *llc_await_rejct_state_transitions[] = {
[
0
]
=
&
llc_await_reject_state_trans_1_0
,
[
0
]
=
&
llc_await_reject_state_trans_1_0
,
[
1
]
=
&
llc_common_state_trans_1
,
/* requests */
[
1
]
=
&
llc_common_state_trans_1
,
/* requests */
[
2
]
=
&
llc_common_state_trans_2
,
[
2
]
=
&
llc_common_state_trans_2
,
[
3
]
=
&
llc_common_state_trans_
n
,
[
3
]
=
&
llc_common_state_trans_
end
,
[
4
]
=
&
llc_await_rejct_state_trans_1
,
/* local busy */
[
4
]
=
&
llc_await_rejct_state_trans_1
,
/* local busy */
[
5
]
=
&
llc_common_state_trans_
n
,
[
5
]
=
&
llc_common_state_trans_
end
,
[
6
]
=
&
llc_common_state_trans_
n
,
/* Initiate PF cycle */
[
6
]
=
&
llc_common_state_trans_
end
,
/* Initiate PF cycle */
[
7
]
=
&
llc_await_rejct_state_trans_13
,
/* timers */
[
7
]
=
&
llc_await_rejct_state_trans_13
,
/* timers */
[
8
]
=
&
llc_common_state_trans_11a
,
[
8
]
=
&
llc_common_state_trans_11a
,
[
9
]
=
&
llc_common_state_trans_11b
,
[
9
]
=
&
llc_common_state_trans_11b
,
[
10
]
=
&
llc_common_state_trans_11c
,
[
10
]
=
&
llc_common_state_trans_11c
,
[
11
]
=
&
llc_common_state_trans_11d
,
[
11
]
=
&
llc_common_state_trans_11d
,
[
12
]
=
&
llc_common_state_trans_
n
,
[
12
]
=
&
llc_common_state_trans_
end
,
[
13
]
=
&
llc_await_rejct_state_trans_2a
,
/* receive frames */
[
13
]
=
&
llc_await_rejct_state_trans_2a
,
/* receive frames */
[
14
]
=
&
llc_await_rejct_state_trans_2b
,
[
14
]
=
&
llc_await_rejct_state_trans_2b
,
[
15
]
=
&
llc_await_rejct_state_trans_3
,
[
15
]
=
&
llc_await_rejct_state_trans_3
,
...
@@ -4151,7 +4151,7 @@ static struct llc_conn_state_trans *llc_await_rejct_state_transitions[] = {
...
@@ -4151,7 +4151,7 @@ static struct llc_conn_state_trans *llc_await_rejct_state_transitions[] = {
[
41
]
=
&
llc_common_state_trans_8c
,
[
41
]
=
&
llc_common_state_trans_8c
,
[
42
]
=
&
llc_common_state_trans_9
,
[
42
]
=
&
llc_common_state_trans_9
,
/* [43] = &llc_common_state_trans_10, */
/* [43] = &llc_common_state_trans_10, */
[
43
]
=
&
llc_common_state_trans_
n
,
[
43
]
=
&
llc_common_state_trans_
end
,
};
};
/* LLC_CONN_STATE_D_CONN transitions */
/* LLC_CONN_STATE_D_CONN transitions */
...
@@ -4392,13 +4392,13 @@ static struct llc_conn_state_trans llc_d_conn_state_trans_8 = {
...
@@ -4392,13 +4392,13 @@ static struct llc_conn_state_trans llc_d_conn_state_trans_8 = {
*/
*/
static
struct
llc_conn_state_trans
*
llc_d_conn_state_transitions
[]
=
{
static
struct
llc_conn_state_trans
*
llc_d_conn_state_transitions
[]
=
{
[
0
]
=
&
llc_d_conn_state_trans_5
,
/* Request */
[
0
]
=
&
llc_d_conn_state_trans_5
,
/* Request */
[
1
]
=
&
llc_common_state_trans_
n
,
[
1
]
=
&
llc_common_state_trans_
end
,
[
2
]
=
&
llc_common_state_trans_
n
,
/* Local busy */
[
2
]
=
&
llc_common_state_trans_
end
,
/* Local busy */
[
3
]
=
&
llc_common_state_trans_
n
,
/* Initiate PF cycle */
[
3
]
=
&
llc_common_state_trans_
end
,
/* Initiate PF cycle */
[
4
]
=
&
llc_d_conn_state_trans_6
,
/* Timer */
[
4
]
=
&
llc_d_conn_state_trans_6
,
/* Timer */
[
5
]
=
&
llc_d_conn_state_trans_7
,
[
5
]
=
&
llc_d_conn_state_trans_7
,
[
6
]
=
&
llc_d_conn_state_trans_8
,
[
6
]
=
&
llc_d_conn_state_trans_8
,
[
7
]
=
&
llc_common_state_trans_
n
,
[
7
]
=
&
llc_common_state_trans_
end
,
[
8
]
=
&
llc_d_conn_state_trans_1
,
/* Receive frame */
[
8
]
=
&
llc_d_conn_state_trans_1
,
/* Receive frame */
[
9
]
=
&
llc_d_conn_state_trans_1_1
,
[
9
]
=
&
llc_d_conn_state_trans_1_1
,
[
10
]
=
&
llc_d_conn_state_trans_2
,
[
10
]
=
&
llc_d_conn_state_trans_2
,
...
@@ -4406,7 +4406,7 @@ static struct llc_conn_state_trans *llc_d_conn_state_transitions[] = {
...
@@ -4406,7 +4406,7 @@ static struct llc_conn_state_trans *llc_d_conn_state_transitions[] = {
[
12
]
=
&
llc_d_conn_state_trans_3
,
[
12
]
=
&
llc_d_conn_state_trans_3
,
[
13
]
=
&
llc_d_conn_state_trans_4
,
[
13
]
=
&
llc_d_conn_state_trans_4
,
[
14
]
=
&
llc_d_conn_state_trans_4_1
,
[
14
]
=
&
llc_d_conn_state_trans_4_1
,
[
15
]
=
&
llc_common_state_trans_
n
,
[
15
]
=
&
llc_common_state_trans_
end
,
};
};
/* LLC_CONN_STATE_RESET transitions */
/* LLC_CONN_STATE_RESET transitions */
...
@@ -4678,14 +4678,14 @@ static struct llc_conn_state_trans llc_rst_state_trans_8_1 = {
...
@@ -4678,14 +4678,14 @@ static struct llc_conn_state_trans llc_rst_state_trans_8_1 = {
*/
*/
static
struct
llc_conn_state_trans
*
llc_rst_state_transitions
[]
=
{
static
struct
llc_conn_state_trans
*
llc_rst_state_transitions
[]
=
{
[
0
]
=
&
llc_rst_state_trans_6
,
/* Request */
[
0
]
=
&
llc_rst_state_trans_6
,
/* Request */
[
1
]
=
&
llc_common_state_trans_
n
,
[
1
]
=
&
llc_common_state_trans_
end
,
[
2
]
=
&
llc_common_state_trans_
n
,
/* Local busy */
[
2
]
=
&
llc_common_state_trans_
end
,
/* Local busy */
[
3
]
=
&
llc_common_state_trans_
n
,
/* Initiate PF cycle */
[
3
]
=
&
llc_common_state_trans_
end
,
/* Initiate PF cycle */
[
4
]
=
&
llc_rst_state_trans_3
,
/* Timer */
[
4
]
=
&
llc_rst_state_trans_3
,
/* Timer */
[
5
]
=
&
llc_rst_state_trans_7
,
[
5
]
=
&
llc_rst_state_trans_7
,
[
6
]
=
&
llc_rst_state_trans_8
,
[
6
]
=
&
llc_rst_state_trans_8
,
[
7
]
=
&
llc_rst_state_trans_8_1
,
[
7
]
=
&
llc_rst_state_trans_8_1
,
[
8
]
=
&
llc_common_state_trans_
n
,
[
8
]
=
&
llc_common_state_trans_
end
,
[
9
]
=
&
llc_rst_state_trans_1
,
/* Receive frame */
[
9
]
=
&
llc_rst_state_trans_1
,
/* Receive frame */
[
10
]
=
&
llc_rst_state_trans_2
,
[
10
]
=
&
llc_rst_state_trans_2
,
[
11
]
=
&
llc_rst_state_trans_2_1
,
[
11
]
=
&
llc_rst_state_trans_2_1
,
...
@@ -4693,7 +4693,7 @@ static struct llc_conn_state_trans *llc_rst_state_transitions[] = {
...
@@ -4693,7 +4693,7 @@ static struct llc_conn_state_trans *llc_rst_state_transitions[] = {
[
13
]
=
&
llc_rst_state_trans_4_1
,
[
13
]
=
&
llc_rst_state_trans_4_1
,
[
14
]
=
&
llc_rst_state_trans_5
,
[
14
]
=
&
llc_rst_state_trans_5
,
[
15
]
=
&
llc_rst_state_trans_5_1
,
[
15
]
=
&
llc_rst_state_trans_5_1
,
[
16
]
=
&
llc_common_state_trans_
n
,
[
16
]
=
&
llc_common_state_trans_
end
,
};
};
/* LLC_CONN_STATE_ERROR transitions */
/* LLC_CONN_STATE_ERROR transitions */
...
@@ -4849,19 +4849,19 @@ static struct llc_conn_state_trans llc_error_state_trans_9 = {
...
@@ -4849,19 +4849,19 @@ static struct llc_conn_state_trans llc_error_state_trans_9 = {
*/
*/
static
struct
llc_conn_state_trans
*
llc_error_state_transitions
[]
=
{
static
struct
llc_conn_state_trans
*
llc_error_state_transitions
[]
=
{
[
0
]
=
&
llc_error_state_trans_9
,
/* Request */
[
0
]
=
&
llc_error_state_trans_9
,
/* Request */
[
1
]
=
&
llc_common_state_trans_
n
,
[
1
]
=
&
llc_common_state_trans_
end
,
[
2
]
=
&
llc_common_state_trans_
n
,
/* Local busy */
[
2
]
=
&
llc_common_state_trans_
end
,
/* Local busy */
[
3
]
=
&
llc_common_state_trans_
n
,
/* Initiate PF cycle */
[
3
]
=
&
llc_common_state_trans_
end
,
/* Initiate PF cycle */
[
4
]
=
&
llc_error_state_trans_7
,
/* Timer */
[
4
]
=
&
llc_error_state_trans_7
,
/* Timer */
[
5
]
=
&
llc_error_state_trans_8
,
[
5
]
=
&
llc_error_state_trans_8
,
[
6
]
=
&
llc_common_state_trans_
n
,
[
6
]
=
&
llc_common_state_trans_
end
,
[
7
]
=
&
llc_error_state_trans_1
,
/* Receive frame */
[
7
]
=
&
llc_error_state_trans_1
,
/* Receive frame */
[
8
]
=
&
llc_error_state_trans_2
,
[
8
]
=
&
llc_error_state_trans_2
,
[
9
]
=
&
llc_error_state_trans_3
,
[
9
]
=
&
llc_error_state_trans_3
,
[
10
]
=
&
llc_error_state_trans_4
,
[
10
]
=
&
llc_error_state_trans_4
,
[
11
]
=
&
llc_error_state_trans_5
,
[
11
]
=
&
llc_error_state_trans_5
,
[
12
]
=
&
llc_error_state_trans_6
,
[
12
]
=
&
llc_error_state_trans_6
,
[
13
]
=
&
llc_common_state_trans_
n
,
[
13
]
=
&
llc_common_state_trans_
end
,
};
};
/* LLC_CONN_STATE_TEMP transitions */
/* LLC_CONN_STATE_TEMP transitions */
...
@@ -4886,61 +4886,61 @@ static struct llc_conn_state_trans llc_temp_state_trans_1 = {
...
@@ -4886,61 +4886,61 @@ static struct llc_conn_state_trans llc_temp_state_trans_1 = {
*/
*/
static
struct
llc_conn_state_trans
*
llc_temp_state_transitions
[]
=
{
static
struct
llc_conn_state_trans
*
llc_temp_state_transitions
[]
=
{
[
0
]
=
&
llc_temp_state_trans_1
,
/* requests */
[
0
]
=
&
llc_temp_state_trans_1
,
/* requests */
[
1
]
=
&
llc_common_state_trans_
n
,
[
1
]
=
&
llc_common_state_trans_
end
,
[
2
]
=
&
llc_common_state_trans_
n
,
/* local busy */
[
2
]
=
&
llc_common_state_trans_
end
,
/* local busy */
[
3
]
=
&
llc_common_state_trans_
n
,
/* init_pf_cycle */
[
3
]
=
&
llc_common_state_trans_
end
,
/* init_pf_cycle */
[
4
]
=
&
llc_common_state_trans_
n
,
/* timer */
[
4
]
=
&
llc_common_state_trans_
end
,
/* timer */
[
5
]
=
&
llc_common_state_trans_
n
,
/* receive */
[
5
]
=
&
llc_common_state_trans_
end
,
/* receive */
};
};
/* Connection State Transition Table */
/* Connection State Transition Table */
struct
llc_conn_state
llc_conn_state_table
[]
=
{
struct
llc_conn_state
llc_conn_state_table
[
NBR_CONN_STATES
]
=
{
{
[
LLC_CONN_STATE_ADM
-
1
]
=
{
.
current_state
=
LLC_CONN_STATE_ADM
,
.
current_state
=
LLC_CONN_STATE_ADM
,
.
transitions
=
llc_adm_state_transitions
,
.
transitions
=
llc_adm_state_transitions
,
},
},
{
[
LLC_CONN_STATE_SETUP
-
1
]
=
{
.
current_state
=
LLC_CONN_STATE_SETUP
,
.
current_state
=
LLC_CONN_STATE_SETUP
,
.
transitions
=
llc_setup_state_transitions
,
.
transitions
=
llc_setup_state_transitions
,
},
},
{
[
LLC_CONN_STATE_NORMAL
-
1
]
=
{
.
current_state
=
LLC_CONN_STATE_NORMAL
,
.
current_state
=
LLC_CONN_STATE_NORMAL
,
.
transitions
=
llc_normal_state_transitions
,
.
transitions
=
llc_normal_state_transitions
,
},
},
{
[
LLC_CONN_STATE_BUSY
-
1
]
=
{
.
current_state
=
LLC_CONN_STATE_BUSY
,
.
current_state
=
LLC_CONN_STATE_BUSY
,
.
transitions
=
llc_busy_state_transitions
,
.
transitions
=
llc_busy_state_transitions
,
},
},
{
[
LLC_CONN_STATE_REJ
-
1
]
=
{
.
current_state
=
LLC_CONN_STATE_REJ
,
.
current_state
=
LLC_CONN_STATE_REJ
,
.
transitions
=
llc_reject_state_transitions
,
.
transitions
=
llc_reject_state_transitions
,
},
},
{
[
LLC_CONN_STATE_AWAIT
-
1
]
=
{
.
current_state
=
LLC_CONN_STATE_AWAIT
,
.
current_state
=
LLC_CONN_STATE_AWAIT
,
.
transitions
=
llc_await_state_transitions
,
.
transitions
=
llc_await_state_transitions
,
},
},
{
[
LLC_CONN_STATE_AWAIT_BUSY
-
1
]
=
{
.
current_state
=
LLC_CONN_STATE_AWAIT_BUSY
,
.
current_state
=
LLC_CONN_STATE_AWAIT_BUSY
,
.
transitions
=
llc_await_busy_state_transitions
,
.
transitions
=
llc_await_busy_state_transitions
,
},
},
{
[
LLC_CONN_STATE_AWAIT_REJ
-
1
]
=
{
.
current_state
=
LLC_CONN_STATE_AWAIT_REJ
,
.
current_state
=
LLC_CONN_STATE_AWAIT_REJ
,
.
transitions
=
llc_await_rejct_state_transitions
,
.
transitions
=
llc_await_rejct_state_transitions
,
},
},
{
[
LLC_CONN_STATE_D_CONN
-
1
]
=
{
.
current_state
=
LLC_CONN_STATE_D_CONN
,
.
current_state
=
LLC_CONN_STATE_D_CONN
,
.
transitions
=
llc_d_conn_state_transitions
,
.
transitions
=
llc_d_conn_state_transitions
,
},
},
{
[
LLC_CONN_STATE_RESET
-
1
]
=
{
.
current_state
=
LLC_CONN_STATE_RESET
,
.
current_state
=
LLC_CONN_STATE_RESET
,
.
transitions
=
llc_rst_state_transitions
,
.
transitions
=
llc_rst_state_transitions
,
},
},
{
[
LLC_CONN_STATE_ERROR
-
1
]
=
{
.
current_state
=
LLC_CONN_STATE_ERROR
,
.
current_state
=
LLC_CONN_STATE_ERROR
,
.
transitions
=
llc_error_state_transitions
,
.
transitions
=
llc_error_state_transitions
,
},
},
{
[
LLC_CONN_STATE_TEMP
-
1
]
=
{
.
current_state
=
LLC_CONN_STATE_TEMP
,
.
current_state
=
LLC_CONN_STATE_TEMP
,
.
transitions
=
llc_temp_state_transitions
,
.
transitions
=
llc_temp_state_transitions
,
},
},
};
};
net/llc/llc_conn.c
View file @
649cbf21
...
@@ -28,56 +28,37 @@
...
@@ -28,56 +28,37 @@
static
int
llc_find_offset
(
int
state
,
int
ev_type
);
static
int
llc_find_offset
(
int
state
,
int
ev_type
);
static
void
llc_conn_send_pdus
(
struct
sock
*
sk
);
static
void
llc_conn_send_pdus
(
struct
sock
*
sk
);
static
int
llc_conn_service
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
static
int
llc_conn_service
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
static
int
llc_exec_conn_trans_actions
(
struct
sock
*
sk
,
static
int
llc_exec_conn_trans_actions
(
struct
sock
*
sk
,
struct
llc_conn_state_trans
*
trans
,
struct
llc_conn_state_trans
*
trans
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
ev
);
static
struct
llc_conn_state_trans
*
static
struct
llc_conn_state_trans
*
llc_qualify_conn_ev
(
struct
sock
*
sk
,
llc_qualify_conn_ev
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
);
struct
sk_buff
*
skb
);
/* Offset table on connection states transition diagram */
/* Offset table on connection states transition diagram */
static
int
llc_offset_table
[
NBR_CONN_STATES
][
NBR_CONN_EV
];
static
int
llc_offset_table
[
NBR_CONN_STATES
][
NBR_CONN_EV
];
/**
* llc_conn_alloc_event: allocates an event
* @sk: socket that event is associated
*
* Returns pointer to allocated connection on success, %NULL on failure.
*/
struct
llc_conn_state_ev
*
llc_conn_alloc_ev
(
struct
sock
*
sk
)
{
struct
llc_conn_state_ev
*
ev
=
NULL
;
/* verify connection is valid, active and open */
if
(
llc_sk
(
sk
)
->
state
!=
LLC_CONN_OUT_OF_SVC
)
{
/* get event structure to build a station event */
ev
=
kmalloc
(
sizeof
(
*
ev
),
GFP_ATOMIC
);
if
(
ev
)
memset
(
ev
,
0
,
sizeof
(
*
ev
));
}
return
ev
;
}
/**
/**
* llc_conn_send_event - sends event to connection state machine
* llc_conn_send_event - sends event to connection state machine
* @sk: connection
* @sk: connection
* @
ev
: occurred event
* @
skb
: occurred event
*
*
* Sends an event to connection state machine. after processing event
* Sends an event to connection state machine. after processing event
* (executing it's actions and changing state), upper layer will be
* (executing it's actions and changing state), upper layer will be
* indicated or confirmed, if needed. Returns 0 for success, 1 for
* indicated or confirmed, if needed. Returns 0 for success, 1 for
* failure. The socket lock has to be held before calling this function.
* failure. The socket lock has to be held before calling this function.
*/
*/
int
llc_conn_send_ev
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
int
llc_conn_send_ev
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
/* sending event to state machine */
/* sending event to state machine */
int
rc
=
llc_conn_service
(
sk
,
ev
);
int
rc
=
llc_conn_service
(
sk
,
skb
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
u8
flag
=
ev
->
flag
;
u8
flag
=
ev
->
flag
;
struct
llc_prim_if_block
*
ind_prim
=
ev
->
ind_prim
;
struct
llc_prim_if_block
*
ind_prim
=
ev
->
ind_prim
;
struct
llc_prim_if_block
*
cfm_prim
=
ev
->
cfm_prim
;
struct
llc_prim_if_block
*
cfm_prim
=
ev
->
cfm_prim
;
llc_conn_free_ev
(
ev
);
llc_conn_free_ev
(
skb
);
#ifdef THIS_BREAKS_DISCONNECT_NOTIFICATION_BADLY
#ifdef THIS_BREAKS_DISCONNECT_NOTIFICATION_BADLY
/* check if the connection was freed by the state machine by
/* check if the connection was freed by the state machine by
* means of llc_conn_disc */
* means of llc_conn_disc */
...
@@ -125,15 +106,14 @@ void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb)
...
@@ -125,15 +106,14 @@ void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb)
* llc_conn_rtn_pdu - sends received data pdu to upper layer
* llc_conn_rtn_pdu - sends received data pdu to upper layer
* @sk: Active connection
* @sk: Active connection
* @skb: Received data frame
* @skb: Received data frame
* @ev: Occurred event
*
*
* Sends received data pdu to upper layer (by using indicate function).
* Sends received data pdu to upper layer (by using indicate function).
* Prepares service parameters (prim and prim_data). calling indication
* Prepares service parameters (prim and prim_data). calling indication
* function will be done in llc_conn_send_ev.
* function will be done in llc_conn_send_ev.
*/
*/
void
llc_conn_rtn_pdu
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
void
llc_conn_rtn_pdu
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
struct
llc_conn_state_ev
*
ev
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_sap
*
sap
=
llc
->
sap
;
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_ind_prim
;
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_ind_prim
;
...
@@ -291,34 +271,37 @@ static void llc_conn_send_pdus(struct sock *sk)
...
@@ -291,34 +271,37 @@ static void llc_conn_send_pdus(struct sock *sk)
/**
/**
* llc_conn_free_ev - free event
* llc_conn_free_ev - free event
* @
ev
: event to free
* @
skb
: event to free
*
*
* Free allocated event.
* Free allocated event.
*/
*/
void
llc_conn_free_ev
(
struct
llc_conn_state_ev
*
ev
)
void
llc_conn_free_ev
(
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
if
(
ev
->
type
==
LLC_CONN_EV_TYPE_PDU
)
{
if
(
ev
->
type
==
LLC_CONN_EV_TYPE_PDU
)
{
/* free the frame that binded to this event */
/* free the frame that is bound to this event */
struct
llc_pdu_sn
*
pdu
=
struct
llc_pdu_sn
*
pdu
=
llc_pdu_sn_hdr
(
skb
);
(
struct
llc_pdu_sn
*
)
ev
->
data
.
pdu
.
skb
->
nh
.
raw
;
if
(
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
ev
->
flag
||
!
ev
->
ind_prim
)
if
(
LLC_PDU_TYPE_IS_I
(
pdu
)
||
!
ev
->
flag
||
!
ev
->
ind_prim
)
kfree_skb
(
ev
->
data
.
pdu
.
skb
);
kfree_skb
(
skb
);
}
}
else
if
(
ev
->
type
==
LLC_CONN_EV_TYPE_PRIM
&&
/* free event structure to free list of the same */
ev
->
data
.
prim
.
prim
!=
LLC_DATA_PRIM
)
kfree
(
ev
);
kfree_skb
(
skb
);
else
if
(
ev
->
type
==
LLC_CONN_EV_TYPE_P_TMR
)
kfree_skb
(
skb
);
}
}
/**
/**
* llc_conn_service - finds transition and changes state of connection
* llc_conn_service - finds transition and changes state of connection
* @sk: connection
* @sk: connection
* @
ev
: happened event
* @
skb
: happened event
*
*
* This function finds transition that matches with happened event, then
* This function finds transition that matches with happened event, then
* executes related actions and finally changes state of connection.
* executes related actions and finally changes state of connection.
* Returns 0 for success, 1 for failure.
* Returns 0 for success, 1 for failure.
*/
*/
static
int
llc_conn_service
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
static
int
llc_conn_service
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
llc_conn_state_trans
*
trans
;
struct
llc_conn_state_trans
*
trans
;
...
@@ -326,9 +309,9 @@ static int llc_conn_service(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -326,9 +309,9 @@ static int llc_conn_service(struct sock *sk, struct llc_conn_state_ev *ev)
if
(
llc_sk
(
sk
)
->
state
>
NBR_CONN_STATES
)
if
(
llc_sk
(
sk
)
->
state
>
NBR_CONN_STATES
)
goto
out
;
goto
out
;
rc
=
0
;
rc
=
0
;
trans
=
llc_qualify_conn_ev
(
sk
,
ev
);
trans
=
llc_qualify_conn_ev
(
sk
,
skb
);
if
(
trans
)
{
if
(
trans
)
{
rc
=
llc_exec_conn_trans_actions
(
sk
,
trans
,
ev
);
rc
=
llc_exec_conn_trans_actions
(
sk
,
trans
,
skb
);
if
(
!
rc
&&
trans
->
next_state
!=
NO_STATE_CHANGE
)
if
(
!
rc
&&
trans
->
next_state
!=
NO_STATE_CHANGE
)
llc_sk
(
sk
)
->
state
=
trans
->
next_state
;
llc_sk
(
sk
)
->
state
=
trans
->
next_state
;
}
}
...
@@ -339,26 +322,28 @@ static int llc_conn_service(struct sock *sk, struct llc_conn_state_ev *ev)
...
@@ -339,26 +322,28 @@ static int llc_conn_service(struct sock *sk, struct llc_conn_state_ev *ev)
/**
/**
* llc_qualify_conn_ev - finds transition for event
* llc_qualify_conn_ev - finds transition for event
* @sk: connection
* @sk: connection
* @
ev
: happened event
* @
skb
: happened event
*
*
* This function finds transition that matches with happened event.
* This function finds transition that matches with happened event.
* Returns pointer to found transition on success, %NULL otherwise.
* Returns pointer to found transition on success, %NULL otherwise.
*/
*/
static
struct
llc_conn_state_trans
*
static
struct
llc_conn_state_trans
*
llc_qualify_conn_ev
(
struct
sock
*
sk
,
llc_qualify_conn_ev
(
struct
sock
*
sk
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_conn_state_trans
**
next_trans
;
struct
llc_conn_state_trans
**
next_trans
;
llc_conn_ev_qfyr_t
*
next_qualifier
;
llc_conn_ev_qfyr_t
*
next_qualifier
;
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_conn_state
*
curr_state
=
struct
llc_conn_state
*
curr_state
=
&
llc_conn_state_table
[
llc_sk
(
sk
)
->
state
-
1
];
&
llc_conn_state_table
[
llc
->
state
-
1
];
/* search thru events for this state until
/* search thru events for this state until
* list exhausted or until no more
* list exhausted or until no more
*/
*/
for
(
next_trans
=
curr_state
->
transitions
+
for
(
next_trans
=
curr_state
->
transitions
+
llc_find_offset
(
llc
_sk
(
sk
)
->
state
-
1
,
ev
->
type
);
llc_find_offset
(
llc
->
state
-
1
,
ev
->
type
);
(
*
next_trans
)
->
ev
;
next_trans
++
)
{
(
*
next_trans
)
->
ev
;
next_trans
++
)
{
if
(
!
((
*
next_trans
)
->
ev
)(
sk
,
ev
))
{
if
(
!
((
*
next_trans
)
->
ev
)(
sk
,
skb
))
{
/* got POSSIBLE event match; the event may require
/* got POSSIBLE event match; the event may require
* qualification based on the values of a number of
* qualification based on the values of a number of
* state flags; if all qualifications are met (i.e.,
* state flags; if all qualifications are met (i.e.,
...
@@ -367,7 +352,7 @@ static struct llc_conn_state_trans *
...
@@ -367,7 +352,7 @@ static struct llc_conn_state_trans *
*/
*/
for
(
next_qualifier
=
(
*
next_trans
)
->
ev_qualifiers
;
for
(
next_qualifier
=
(
*
next_trans
)
->
ev_qualifiers
;
next_qualifier
&&
*
next_qualifier
&&
next_qualifier
&&
*
next_qualifier
&&
!
(
*
next_qualifier
)(
sk
,
ev
);
next_qualifier
++
)
!
(
*
next_qualifier
)(
sk
,
skb
);
next_qualifier
++
)
/* nothing */
;
/* nothing */
;
if
(
!
next_qualifier
||
!*
next_qualifier
)
if
(
!
next_qualifier
||
!*
next_qualifier
)
/* all qualifiers executed successfully; this is
/* all qualifiers executed successfully; this is
...
@@ -384,7 +369,7 @@ static struct llc_conn_state_trans *
...
@@ -384,7 +369,7 @@ static struct llc_conn_state_trans *
* llc_exec_conn_trans_actions - executes related actions
* llc_exec_conn_trans_actions - executes related actions
* @sk: connection
* @sk: connection
* @trans: transition that it's actions must be performed
* @trans: transition that it's actions must be performed
* @
ev
: happened event
* @
skb
: happened event
*
*
* Executes actions that is related to happened event. Returns 0 for
* Executes actions that is related to happened event. Returns 0 for
* success, 1 to indicate failure of at least one action or 2 if the
* success, 1 to indicate failure of at least one action or 2 if the
...
@@ -392,14 +377,14 @@ static struct llc_conn_state_trans *
...
@@ -392,14 +377,14 @@ static struct llc_conn_state_trans *
*/
*/
static
int
llc_exec_conn_trans_actions
(
struct
sock
*
sk
,
static
int
llc_exec_conn_trans_actions
(
struct
sock
*
sk
,
struct
llc_conn_state_trans
*
trans
,
struct
llc_conn_state_trans
*
trans
,
struct
llc_conn_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
int
rc
=
0
;
int
rc
=
0
;
llc_conn_action_t
*
next_action
;
llc_conn_action_t
*
next_action
;
for
(
next_action
=
trans
->
ev_actions
;
for
(
next_action
=
trans
->
ev_actions
;
next_action
&&
*
next_action
;
next_action
++
)
{
next_action
&&
*
next_action
;
next_action
++
)
{
int
rc2
=
(
*
next_action
)(
sk
,
ev
);
int
rc2
=
(
*
next_action
)(
sk
,
skb
);
if
(
rc2
==
2
)
{
if
(
rc2
==
2
)
{
rc
=
rc2
;
rc
=
rc2
;
...
...
net/llc/llc_evnt.c
View file @
649cbf21
...
@@ -24,39 +24,48 @@
...
@@ -24,39 +24,48 @@
#include <net/llc_pdu.h>
#include <net/llc_pdu.h>
int
llc_stat_ev_enable_with_dup_addr_check
(
struct
llc_station
*
station
,
int
llc_stat_ev_enable_with_dup_addr_check
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_station_state_ev
*
ev
=
llc_station_ev
(
skb
);
return
ev
->
type
==
LLC_STATION_EV_TYPE_SIMPLE
&&
return
ev
->
type
==
LLC_STATION_EV_TYPE_SIMPLE
&&
ev
->
data
.
a
.
ev
==
ev
->
data
.
a
.
ev
==
LLC_STATION_EV_ENABLE_WITH_DUP_ADDR_CHECK
?
0
:
1
;
LLC_STATION_EV_ENABLE_WITH_DUP_ADDR_CHECK
?
0
:
1
;
}
}
int
llc_stat_ev_enable_without_dup_addr_check
(
struct
llc_station
*
station
,
int
llc_stat_ev_enable_without_dup_addr_check
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_station_state_ev
*
ev
=
llc_station_ev
(
skb
);
return
ev
->
type
==
LLC_STATION_EV_TYPE_SIMPLE
&&
return
ev
->
type
==
LLC_STATION_EV_TYPE_SIMPLE
&&
ev
->
data
.
a
.
ev
==
ev
->
data
.
a
.
ev
==
LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK
?
0
:
1
;
LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK
?
0
:
1
;
}
}
int
llc_stat_ev_ack_tmr_exp_lt_retry_cnt_max_retry
(
struct
llc_station
*
station
,
int
llc_stat_ev_ack_tmr_exp_lt_retry_cnt_max_retry
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_station_state_ev
*
ev
=
llc_station_ev
(
skb
);
return
ev
->
type
==
LLC_STATION_EV_TYPE_ACK_TMR
&&
return
ev
->
type
==
LLC_STATION_EV_TYPE_ACK_TMR
&&
station
->
retry_count
<
station
->
maximum_retry
?
0
:
1
;
station
->
retry_count
<
station
->
maximum_retry
?
0
:
1
;
}
}
int
llc_stat_ev_ack_tmr_exp_eq_retry_cnt_max_retry
(
struct
llc_station
*
station
,
int
llc_stat_ev_ack_tmr_exp_eq_retry_cnt_max_retry
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_station_state_ev
*
ev
=
llc_station_ev
(
skb
);
return
ev
->
type
==
LLC_STATION_EV_TYPE_ACK_TMR
&&
return
ev
->
type
==
LLC_STATION_EV_TYPE_ACK_TMR
&&
station
->
retry_count
==
station
->
maximum_retry
?
0
:
1
;
station
->
retry_count
==
station
->
maximum_retry
?
0
:
1
;
}
}
int
llc_stat_ev_rx_null_dsap_xid_c
(
struct
llc_station
*
station
,
int
llc_stat_ev_rx_null_dsap_xid_c
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_station_state_ev
*
ev
=
llc_station_ev
(
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
ev
->
type
==
LLC_STATION_EV_TYPE_PDU
&&
return
ev
->
type
==
LLC_STATION_EV_TYPE_PDU
&&
!
LLC_PDU_IS_CMD
(
pdu
)
&&
/* command PDU */
!
LLC_PDU_IS_CMD
(
pdu
)
&&
/* command PDU */
...
@@ -66,9 +75,10 @@ int llc_stat_ev_rx_null_dsap_xid_c(struct llc_station *station,
...
@@ -66,9 +75,10 @@ int llc_stat_ev_rx_null_dsap_xid_c(struct llc_station *station,
}
}
int
llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq
(
struct
llc_station
*
station
,
int
llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_station_state_ev
*
ev
=
llc_station_ev
(
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
ev
->
type
==
LLC_STATION_EV_TYPE_PDU
&&
return
ev
->
type
==
LLC_STATION_EV_TYPE_PDU
&&
!
LLC_PDU_IS_RSP
(
pdu
)
&&
/* response PDU */
!
LLC_PDU_IS_RSP
(
pdu
)
&&
/* response PDU */
...
@@ -79,9 +89,10 @@ int llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq(struct llc_station *station,
...
@@ -79,9 +89,10 @@ int llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq(struct llc_station *station,
}
}
int
llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq
(
struct
llc_station
*
station
,
int
llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_station_state_ev
*
ev
=
llc_station_ev
(
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
ev
->
type
==
LLC_STATION_EV_TYPE_PDU
&&
return
ev
->
type
==
LLC_STATION_EV_TYPE_PDU
&&
!
LLC_PDU_IS_RSP
(
pdu
)
&&
/* response PDU */
!
LLC_PDU_IS_RSP
(
pdu
)
&&
/* response PDU */
...
@@ -92,9 +103,10 @@ int llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq(struct llc_station *station,
...
@@ -92,9 +103,10 @@ int llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq(struct llc_station *station,
}
}
int
llc_stat_ev_rx_null_dsap_test_c
(
struct
llc_station
*
station
,
int
llc_stat_ev_rx_null_dsap_test_c
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_station_state_ev
*
ev
=
llc_station_ev
(
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
ev
->
type
==
LLC_STATION_EV_TYPE_PDU
&&
return
ev
->
type
==
LLC_STATION_EV_TYPE_PDU
&&
!
LLC_PDU_IS_CMD
(
pdu
)
&&
/* command PDU */
!
LLC_PDU_IS_CMD
(
pdu
)
&&
/* command PDU */
...
@@ -103,9 +115,10 @@ int llc_stat_ev_rx_null_dsap_test_c(struct llc_station *station,
...
@@ -103,9 +115,10 @@ int llc_stat_ev_rx_null_dsap_test_c(struct llc_station *station,
!
pdu
->
dsap
?
0
:
1
;
/* NULL DSAP */
!
pdu
->
dsap
?
0
:
1
;
/* NULL DSAP */
}
}
int
llc_stat_ev_disable_req
(
struct
llc_station
*
station
,
int
llc_stat_ev_disable_req
(
struct
llc_station
*
station
,
struct
sk_buff
*
skb
)
struct
llc_station_state_ev
*
ev
)
{
{
struct
llc_station_state_ev
*
ev
=
llc_station_ev
(
skb
);
return
ev
->
type
==
LLC_STATION_EV_TYPE_PRIM
&&
return
ev
->
type
==
LLC_STATION_EV_TYPE_PRIM
&&
ev
->
data
.
prim
.
prim
==
LLC_DISABLE_PRIM
&&
ev
->
data
.
prim
.
prim
==
LLC_DISABLE_PRIM
&&
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
...
...
net/llc/llc_if.c
View file @
649cbf21
...
@@ -168,15 +168,13 @@ static int llc_unitdata_req_handler(struct llc_prim_if_block *prim)
...
@@ -168,15 +168,13 @@ static int llc_unitdata_req_handler(struct llc_prim_if_block *prim)
if
(
!
sap
)
if
(
!
sap
)
goto
out
;
goto
out
;
ev
=
llc_sap_alloc_ev
(
sap
);
ev
=
llc_sap_ev
(
prim
->
data
->
udata
.
skb
);
if
(
!
ev
)
goto
out
;
ev
->
type
=
LLC_SAP_EV_TYPE_PRIM
;
ev
->
type
=
LLC_SAP_EV_TYPE_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_DATAUNIT_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_DATAUNIT_PRIM
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
ev
->
data
.
prim
.
data
=
prim
;
ev
->
data
.
prim
.
data
=
prim
;
rc
=
0
;
rc
=
0
;
llc_sap_send_ev
(
sap
,
ev
);
llc_sap_send_ev
(
sap
,
prim
->
data
->
udata
.
skb
);
out:
out:
return
rc
;
return
rc
;
}
}
...
@@ -196,15 +194,13 @@ static int llc_test_req_handler(struct llc_prim_if_block *prim)
...
@@ -196,15 +194,13 @@ static int llc_test_req_handler(struct llc_prim_if_block *prim)
struct
llc_sap
*
sap
=
llc_sap_find
(
prim
->
data
->
udata
.
saddr
.
lsap
);
struct
llc_sap
*
sap
=
llc_sap_find
(
prim
->
data
->
udata
.
saddr
.
lsap
);
if
(
!
sap
)
if
(
!
sap
)
goto
out
;
goto
out
;
ev
=
llc_sap_alloc_ev
(
sap
);
ev
=
llc_sap_ev
(
prim
->
data
->
udata
.
skb
);
if
(
!
ev
)
goto
out
;
ev
->
type
=
LLC_SAP_EV_TYPE_PRIM
;
ev
->
type
=
LLC_SAP_EV_TYPE_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_TEST_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_TEST_PRIM
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
ev
->
data
.
prim
.
data
=
prim
;
ev
->
data
.
prim
.
data
=
prim
;
rc
=
0
;
rc
=
0
;
llc_sap_send_ev
(
sap
,
ev
);
llc_sap_send_ev
(
sap
,
prim
->
data
->
udata
.
skb
);
out:
out:
return
rc
;
return
rc
;
}
}
...
@@ -225,15 +221,13 @@ static int llc_xid_req_handler(struct llc_prim_if_block *prim)
...
@@ -225,15 +221,13 @@ static int llc_xid_req_handler(struct llc_prim_if_block *prim)
if
(
!
sap
)
if
(
!
sap
)
goto
out
;
goto
out
;
ev
=
llc_sap_alloc_ev
(
sap
);
ev
=
llc_sap_ev
(
prim
->
data
->
udata
.
skb
);
if
(
!
ev
)
goto
out
;
ev
->
type
=
LLC_SAP_EV_TYPE_PRIM
;
ev
->
type
=
LLC_SAP_EV_TYPE_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_XID_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_XID_PRIM
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
ev
->
data
.
prim
.
data
=
prim
;
ev
->
data
.
prim
.
data
=
prim
;
rc
=
0
;
rc
=
0
;
llc_sap_send_ev
(
sap
,
ev
);
llc_sap_send_ev
(
sap
,
prim
->
data
->
udata
.
skb
);
out:
out:
return
rc
;
return
rc
;
}
}
...
@@ -273,29 +267,26 @@ static int llc_data_req_handler(struct llc_prim_if_block *prim)
...
@@ -273,29 +267,26 @@ static int llc_data_req_handler(struct llc_prim_if_block *prim)
llc
->
failed_data_req
=
1
;
llc
->
failed_data_req
=
1
;
goto
out
;
goto
out
;
}
}
rc
=
-
ENOMEM
;
ev
=
llc_conn_ev
(
prim
->
data
->
data
.
skb
);
ev
=
llc_conn_alloc_ev
(
sk
);
ev
->
type
=
LLC_CONN_EV_TYPE_PRIM
;
if
(
ev
)
{
ev
->
data
.
prim
.
prim
=
LLC_DATA_PRIM
;
ev
->
type
=
LLC_CONN_EV_TYPE_PRIM
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
ev
->
data
.
prim
.
prim
=
LLC_DATA_PRIM
;
ev
->
data
.
prim
.
data
=
prim
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
prim
->
data
->
data
.
skb
->
dev
=
llc
->
dev
;
ev
->
data
.
prim
.
data
=
prim
;
rc
=
llc_conn_send_ev
(
sk
,
prim
->
data
->
data
.
skb
);
prim
->
data
->
data
.
skb
->
dev
=
llc
->
dev
;
rc
=
llc_conn_send_ev
(
sk
,
ev
);
}
out:
out:
release_sock
(
sk
);
release_sock
(
sk
);
return
rc
;
return
rc
;
}
}
/**
/**
* confirm_impossible - Informs upper layer about failed connection
*
llc_
confirm_impossible - Informs upper layer about failed connection
* @prim: pointer to structure that contains confirmation data.
* @prim: pointer to structure that contains confirmation data.
*
*
* Informs upper layer about failing in connection establishment. This
* Informs upper layer about failing in connection establishment. This
* function is called by llc_conn_req_handler.
* function is called by llc_conn_req_handler.
*/
*/
static
void
confirm_impossible
(
struct
llc_prim_if_block
*
prim
)
static
void
llc_
confirm_impossible
(
struct
llc_prim_if_block
*
prim
)
{
{
prim
->
data
->
conn
.
status
=
LLC_STATUS_IMPOSSIBLE
;
prim
->
data
->
conn
.
status
=
LLC_STATUS_IMPOSSIBLE
;
prim
->
sap
->
conf
(
prim
);
prim
->
sap
->
conf
(
prim
);
...
@@ -316,7 +307,7 @@ static int llc_conn_req_handler(struct llc_prim_if_block *prim)
...
@@ -316,7 +307,7 @@ static int llc_conn_req_handler(struct llc_prim_if_block *prim)
int
rc
=
-
EBUSY
;
int
rc
=
-
EBUSY
;
struct
llc_opt
*
llc
;
struct
llc_opt
*
llc
;
struct
llc_sap
*
sap
=
prim
->
sap
;
struct
llc_sap
*
sap
=
prim
->
sap
;
struct
llc_conn_state_ev
*
ev
;
struct
sk_buff
*
skb
;
struct
net_device
*
ddev
=
mac_dev_peer
(
prim
->
data
->
conn
.
dev
,
struct
net_device
*
ddev
=
mac_dev_peer
(
prim
->
data
->
conn
.
dev
,
prim
->
data
->
conn
.
dev
->
type
,
prim
->
data
->
conn
.
dev
->
type
,
prim
->
data
->
conn
.
daddr
.
mac
),
prim
->
data
->
conn
.
daddr
.
mac
),
...
@@ -334,7 +325,7 @@ static int llc_conn_req_handler(struct llc_prim_if_block *prim)
...
@@ -334,7 +325,7 @@ static int llc_conn_req_handler(struct llc_prim_if_block *prim)
daddr
.
lsap
=
prim
->
data
->
conn
.
daddr
.
lsap
;
daddr
.
lsap
=
prim
->
data
->
conn
.
daddr
.
lsap
;
sk
=
llc_find_sock
(
sap
,
&
daddr
,
&
laddr
);
sk
=
llc_find_sock
(
sap
,
&
daddr
,
&
laddr
);
if
(
sk
)
{
if
(
sk
)
{
confirm_impossible
(
prim
);
llc_
confirm_impossible
(
prim
);
goto
out_put
;
goto
out_put
;
}
}
rc
=
-
ENOMEM
;
rc
=
-
ENOMEM
;
...
@@ -345,7 +336,7 @@ static int llc_conn_req_handler(struct llc_prim_if_block *prim)
...
@@ -345,7 +336,7 @@ static int llc_conn_req_handler(struct llc_prim_if_block *prim)
}
else
{
}
else
{
sk
=
llc_sock_alloc
();
sk
=
llc_sock_alloc
();
if
(
!
sk
)
{
if
(
!
sk
)
{
confirm_impossible
(
prim
);
llc_
confirm_impossible
(
prim
);
goto
out
;
goto
out
;
}
}
prim
->
data
->
conn
.
sk
=
sk
;
prim
->
data
->
conn
.
sk
=
sk
;
...
@@ -360,18 +351,20 @@ static int llc_conn_req_handler(struct llc_prim_if_block *prim)
...
@@ -360,18 +351,20 @@ static int llc_conn_req_handler(struct llc_prim_if_block *prim)
llc
->
dev
=
ddev
;
llc
->
dev
=
ddev
;
llc
->
link
=
prim
->
data
->
conn
.
link
;
llc
->
link
=
prim
->
data
->
conn
.
link
;
llc
->
handler
=
prim
->
data
->
conn
.
handler
;
llc
->
handler
=
prim
->
data
->
conn
.
handler
;
ev
=
llc_conn_alloc_ev
(
sk
);
skb
=
alloc_skb
(
1
,
GFP_ATOMIC
);
if
(
ev
)
{
if
(
skb
)
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
type
=
LLC_CONN_EV_TYPE_PRIM
;
ev
->
type
=
LLC_CONN_EV_TYPE_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_CONN_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_CONN_PRIM
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
ev
->
data
.
prim
.
data
=
prim
;
ev
->
data
.
prim
.
data
=
prim
;
rc
=
llc_conn_send_ev
(
sk
,
ev
);
rc
=
llc_conn_send_ev
(
sk
,
skb
);
}
}
if
(
rc
)
{
if
(
rc
)
{
llc_sap_unassign_sock
(
sap
,
sk
);
llc_sap_unassign_sock
(
sap
,
sk
);
llc_sock_free
(
sk
);
llc_sock_free
(
sk
);
confirm_impossible
(
prim
);
llc_
confirm_impossible
(
prim
);
}
}
release_sock
(
sk
);
release_sock
(
sk
);
out_put:
out_put:
...
@@ -393,6 +386,7 @@ static int llc_disc_req_handler(struct llc_prim_if_block *prim)
...
@@ -393,6 +386,7 @@ static int llc_disc_req_handler(struct llc_prim_if_block *prim)
{
{
u16
rc
=
1
;
u16
rc
=
1
;
struct
llc_conn_state_ev
*
ev
;
struct
llc_conn_state_ev
*
ev
;
struct
sk_buff
*
skb
;
struct
sock
*
sk
=
prim
->
data
->
disc
.
sk
;
struct
sock
*
sk
=
prim
->
data
->
disc
.
sk
;
sock_hold
(
sk
);
sock_hold
(
sk
);
...
@@ -400,17 +394,19 @@ static int llc_disc_req_handler(struct llc_prim_if_block *prim)
...
@@ -400,17 +394,19 @@ static int llc_disc_req_handler(struct llc_prim_if_block *prim)
if
(
llc_sk
(
sk
)
->
state
==
LLC_CONN_STATE_ADM
||
if
(
llc_sk
(
sk
)
->
state
==
LLC_CONN_STATE_ADM
||
llc_sk
(
sk
)
->
state
==
LLC_CONN_OUT_OF_SVC
)
llc_sk
(
sk
)
->
state
==
LLC_CONN_OUT_OF_SVC
)
goto
out
;
goto
out
;
/* postpone unassigning the connection from its SAP and returning the
/*
* Postpone unassigning the connection from its SAP and returning the
* connection until all ACTIONs have been completely executed
* connection until all ACTIONs have been completely executed
*/
*/
ev
=
llc_conn_alloc_ev
(
sk
);
skb
=
alloc_skb
(
1
,
GFP_ATOMIC
);
if
(
!
ev
)
if
(
!
skb
)
goto
out
;
goto
out
;
ev
->
type
=
LLC_CONN_EV_TYPE_PRIM
;
ev
=
llc_conn_ev
(
skb
);
ev
->
type
=
LLC_CONN_EV_TYPE_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_DISC_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_DISC_PRIM
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
ev
->
data
.
prim
.
data
=
prim
;
ev
->
data
.
prim
.
data
=
prim
;
rc
=
llc_conn_send_ev
(
sk
,
ev
);
rc
=
llc_conn_send_ev
(
sk
,
skb
);
out:
out:
release_sock
(
sk
);
release_sock
(
sk
);
sock_put
(
sk
);
sock_put
(
sk
);
...
@@ -428,18 +424,20 @@ static int llc_disc_req_handler(struct llc_prim_if_block *prim)
...
@@ -428,18 +424,20 @@ static int llc_disc_req_handler(struct llc_prim_if_block *prim)
*/
*/
static
int
llc_rst_req_handler
(
struct
llc_prim_if_block
*
prim
)
static
int
llc_rst_req_handler
(
struct
llc_prim_if_block
*
prim
)
{
{
struct
sk_buff
*
skb
;
int
rc
=
1
;
int
rc
=
1
;
struct
sock
*
sk
=
prim
->
data
->
res
.
sk
;
struct
sock
*
sk
=
prim
->
data
->
res
.
sk
;
struct
llc_conn_state_ev
*
ev
;
lock_sock
(
sk
);
lock_sock
(
sk
);
ev
=
llc_conn_alloc_ev
(
sk
);
skb
=
alloc_skb
(
1
,
GFP_ATOMIC
);
if
(
ev
)
{
if
(
skb
)
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
ev
->
type
=
LLC_CONN_EV_TYPE_PRIM
;
ev
->
type
=
LLC_CONN_EV_TYPE_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_RESET_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_RESET_PRIM
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_REQ
;
ev
->
data
.
prim
.
data
=
prim
;
ev
->
data
.
prim
.
data
=
prim
;
rc
=
llc_conn_send_ev
(
sk
,
ev
);
rc
=
llc_conn_send_ev
(
sk
,
skb
);
}
}
release_sock
(
sk
);
release_sock
(
sk
);
return
rc
;
return
rc
;
...
@@ -497,18 +495,21 @@ static int llc_conn_rsp_handler(struct llc_prim_if_block *prim)
...
@@ -497,18 +495,21 @@ static int llc_conn_rsp_handler(struct llc_prim_if_block *prim)
static
int
llc_rst_rsp_handler
(
struct
llc_prim_if_block
*
prim
)
static
int
llc_rst_rsp_handler
(
struct
llc_prim_if_block
*
prim
)
{
{
int
rc
=
1
;
int
rc
=
1
;
/* network layer supplies connection handle; map it to a connection;
/*
* Network layer supplies connection handle; map it to a connection;
* package as event and send it to connection event handler
* package as event and send it to connection event handler
*/
*/
struct
sock
*
sk
=
prim
->
data
->
res
.
sk
;
struct
sock
*
sk
=
prim
->
data
->
res
.
sk
;
struct
llc_conn_state_ev
*
ev
=
llc_conn_alloc_ev
(
sk
);
struct
sk_buff
*
skb
=
alloc_skb
(
1
,
GFP_ATOMIC
);
if
(
skb
)
{
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
if
(
ev
)
{
ev
->
type
=
LLC_CONN_EV_TYPE_PRIM
;
ev
->
type
=
LLC_CONN_EV_TYPE_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_RESET_PRIM
;
ev
->
data
.
prim
.
prim
=
LLC_RESET_PRIM
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_RESP
;
ev
->
data
.
prim
.
type
=
LLC_PRIM_TYPE_RESP
;
ev
->
data
.
prim
.
data
=
prim
;
ev
->
data
.
prim
.
data
=
prim
;
rc
=
llc_conn_send_ev
(
sk
,
ev
);
rc
=
llc_conn_send_ev
(
sk
,
skb
);
}
}
return
rc
;
return
rc
;
}
}
...
...
net/llc/llc_mac.c
View file @
649cbf21
...
@@ -27,6 +27,12 @@
...
@@ -27,6 +27,12 @@
#include <net/llc_s_ev.h>
#include <net/llc_s_ev.h>
#include <linux/trdevice.h>
#include <linux/trdevice.h>
#if 1
#define dprintk(args...) printk(KERN_DEBUG args)
#else
#define dprintk(args...)
#endif
/* function prototypes */
/* function prototypes */
static
void
fix_up_incoming_skb
(
struct
sk_buff
*
skb
);
static
void
fix_up_incoming_skb
(
struct
sk_buff
*
skb
);
...
@@ -46,7 +52,7 @@ int mac_send_pdu(struct sk_buff *skb)
...
@@ -46,7 +52,7 @@ int mac_send_pdu(struct sk_buff *skb)
int
pri
=
GFP_ATOMIC
,
rc
=
-
1
;
int
pri
=
GFP_ATOMIC
,
rc
=
-
1
;
if
(
!
skb
->
dev
)
{
if
(
!
skb
->
dev
)
{
printk
(
KERN_ERR
"%s: skb->dev == NULL!"
,
__FUNCTION__
);
d
printk
(
KERN_ERR
"%s: skb->dev == NULL!"
,
__FUNCTION__
);
goto
out
;
goto
out
;
}
}
if
(
skb
->
sk
)
if
(
skb
->
sk
)
...
@@ -83,7 +89,7 @@ int mac_indicate(struct sk_buff *skb, struct net_device *dev,
...
@@ -83,7 +89,7 @@ int mac_indicate(struct sk_buff *skb, struct net_device *dev,
* receives, do not try to analyse it.
* receives, do not try to analyse it.
*/
*/
if
(
skb
->
pkt_type
==
PACKET_OTHERHOST
)
{
if
(
skb
->
pkt_type
==
PACKET_OTHERHOST
)
{
printk
(
KERN_INFO
"%s: PACKET_OTHERHOST
\n
"
,
__FUNCTION__
);
d
printk
(
KERN_INFO
"%s: PACKET_OTHERHOST
\n
"
,
__FUNCTION__
);
goto
drop
;
goto
drop
;
}
}
skb
=
skb_share_check
(
skb
,
GFP_ATOMIC
);
skb
=
skb_share_check
(
skb
,
GFP_ATOMIC
);
...
@@ -140,7 +146,8 @@ int mac_indicate(struct sk_buff *skb, struct net_device *dev,
...
@@ -140,7 +146,8 @@ int mac_indicate(struct sk_buff *skb, struct net_device *dev,
rc
=
llc_pdu_router
(
llc_sk
(
sk
)
->
sap
,
sk
,
skb
,
rc
=
llc_pdu_router
(
llc_sk
(
sk
)
->
sap
,
sk
,
skb
,
LLC_TYPE_2
);
LLC_TYPE_2
);
}
else
{
}
else
{
skb
->
cb
[
0
]
=
LLC_PACKET
;
dprintk
(
KERN_INFO
"%s: add to backlog
\n
"
,
__FUNCTION__
);
llc_set_backlog_type
(
skb
,
LLC_PACKET
);
sk_add_backlog
(
sk
,
skb
);
sk_add_backlog
(
sk
,
skb
);
rc
=
0
;
rc
=
0
;
}
}
...
@@ -207,38 +214,27 @@ int llc_pdu_router(struct llc_sap *sap, struct sock* sk,
...
@@ -207,38 +214,27 @@ int llc_pdu_router(struct llc_sap *sap, struct sock* sk,
if
(
!
pdu
->
dsap
)
{
if
(
!
pdu
->
dsap
)
{
struct
llc_station
*
station
=
llc_station_get
();
struct
llc_station
*
station
=
llc_station_get
();
struct
llc_station_state_ev
*
stat_ev
=
struct
llc_station_state_ev
*
ev
=
llc_station_ev
(
skb
);
llc_station_alloc_ev
(
station
);
if
(
stat_ev
)
{
ev
->
type
=
LLC_STATION_EV_TYPE_PDU
;
stat_ev
->
type
=
LLC_STATION_EV_TYPE_PDU
;
ev
->
data
.
pdu
.
reason
=
0
;
stat_ev
->
data
.
pdu
.
skb
=
skb
;
llc_station_send_ev
(
station
,
skb
);
stat_ev
->
data
.
pdu
.
reason
=
0
;
llc_station_send_ev
(
station
,
stat_ev
);
}
else
rc
=
-
ENOMEM
;
}
else
if
(
type
==
LLC_TYPE_1
)
{
}
else
if
(
type
==
LLC_TYPE_1
)
{
struct
llc_sap_state_ev
*
sap_ev
=
llc_sap_alloc_ev
(
sap
);
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
if
(
sap_ev
)
{
ev
->
type
=
LLC_SAP_EV_TYPE_PDU
;
sap_ev
->
type
=
LLC_SAP_EV_TYPE_PDU
;
ev
->
data
.
pdu
.
reason
=
0
;
sap_ev
->
data
.
pdu
.
skb
=
skb
;
llc_sap_send_ev
(
sap
,
skb
);
sap_ev
->
data
.
pdu
.
reason
=
0
;
llc_sap_send_ev
(
sap
,
sap_ev
);
}
else
rc
=
-
ENOMEM
;
}
else
if
(
type
==
LLC_TYPE_2
)
{
}
else
if
(
type
==
LLC_TYPE_2
)
{
struct
llc_conn_state_ev
*
conn_ev
=
llc_conn_alloc_ev
(
sk
);
struct
llc_conn_state_ev
*
ev
=
llc_conn_ev
(
skb
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
if
(
!
llc
->
dev
)
if
(
!
llc
->
dev
)
llc
->
dev
=
skb
->
dev
;
llc
->
dev
=
skb
->
dev
;
if
(
conn_ev
)
{
conn_ev
->
type
=
LLC_CONN_EV_TYPE_PDU
;
ev
->
type
=
LLC_CONN_EV_TYPE_PDU
;
conn_ev
->
data
.
pdu
.
skb
=
skb
;
ev
->
data
.
pdu
.
reason
=
0
;
conn_ev
->
data
.
pdu
.
reason
=
0
;
rc
=
llc_conn_send_ev
(
sk
,
skb
);
rc
=
llc_conn_send_ev
(
sk
,
conn_ev
);
}
else
rc
=
-
ENOMEM
;
}
else
}
else
rc
=
-
EINVAL
;
rc
=
-
EINVAL
;
return
rc
;
return
rc
;
...
...
net/llc/llc_main.c
View file @
649cbf21
...
@@ -38,16 +38,16 @@
...
@@ -38,16 +38,16 @@
/* static function prototypes */
/* static function prototypes */
static
void
llc_station_service_events
(
struct
llc_station
*
station
);
static
void
llc_station_service_events
(
struct
llc_station
*
station
);
static
void
llc_station_free_ev
(
struct
llc_station
*
station
,
static
void
llc_station_free_ev
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
static
void
llc_station_send_pdus
(
struct
llc_station
*
station
);
static
void
llc_station_send_pdus
(
struct
llc_station
*
station
);
static
u16
llc_station_next_state
(
struct
llc_station
*
station
,
static
u16
llc_station_next_state
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
static
u16
llc_exec_station_trans_actions
(
struct
llc_station
*
station
,
static
u16
llc_exec_station_trans_actions
(
struct
llc_station
*
station
,
struct
llc_station_state_trans
*
trans
,
struct
llc_station_state_trans
*
trans
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
static
struct
llc_station_state_trans
*
static
struct
llc_station_state_trans
*
llc_find_station_trans
(
struct
llc_station
*
station
,
llc_find_station_trans
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
);
struct
sk_buff
*
skb
);
static
int
llc_rtn_all_conns
(
struct
llc_sap
*
sap
);
static
int
llc_rtn_all_conns
(
struct
llc_sap
*
sap
);
static
struct
llc_station
llc_main_station
;
/* only one of its kind */
static
struct
llc_station
llc_main_station
;
/* only one of its kind */
...
@@ -144,21 +144,23 @@ static int llc_backlog_rcv(struct sock *sk, struct sk_buff *skb)
...
@@ -144,21 +144,23 @@ static int llc_backlog_rcv(struct sock *sk, struct sk_buff *skb)
int
rc
=
0
;
int
rc
=
0
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
if
(
skb
->
cb
[
0
]
==
LLC_PACKET
)
{
if
(
llc_backlog_type
(
skb
)
==
LLC_PACKET
)
{
if
(
llc
->
state
>
1
)
/* not closed */
if
(
llc
->
state
>
1
)
/* not closed */
rc
=
llc_pdu_router
(
llc
->
sap
,
sk
,
skb
,
LLC_TYPE_2
);
rc
=
llc_pdu_router
(
llc
->
sap
,
sk
,
skb
,
LLC_TYPE_2
);
else
else
kfree_skb
(
skb
);
kfree_skb
(
skb
);
}
else
if
(
skb
->
cb
[
0
]
==
LLC_EVENT
)
{
}
else
if
(
llc_backlog_type
(
skb
)
==
LLC_EVENT
)
{
struct
llc_conn_state_ev
*
ev
=
(
struct
llc_conn_state_ev
*
)
skb
->
data
;
/* timer expiration event */
/* timer expiration event */
if
(
llc
->
state
>
1
)
/* not closed */
if
(
llc
->
state
>
1
)
/* not closed */
rc
=
llc_conn_send_ev
(
sk
,
ev
);
rc
=
llc_conn_send_ev
(
sk
,
skb
);
else
else
llc_conn_free_ev
(
ev
);
llc_conn_free_ev
(
skb
);
kfree_skb
(
skb
);
}
else
{
printk
(
KERN_ERR
"%s: invalid skb in backlog
\n
"
,
__FUNCTION__
);
kfree_skb
(
skb
);
kfree_skb
(
skb
);
}
}
return
rc
;
return
rc
;
}
}
...
@@ -232,9 +234,11 @@ void __llc_sock_free(struct sock *sk, u8 free)
...
@@ -232,9 +234,11 @@ void __llc_sock_free(struct sock *sk, u8 free)
/* stop all (possibly) running timers */
/* stop all (possibly) running timers */
llc_conn_ac_stop_all_timers
(
sk
,
NULL
);
llc_conn_ac_stop_all_timers
(
sk
,
NULL
);
/* handle return of frames on lists */
/* handle return of frames on lists */
#if 0
printk(KERN_INFO "%s: unackq=%d, txq=%d\n", __FUNCTION__,
printk(KERN_INFO "%s: unackq=%d, txq=%d\n", __FUNCTION__,
skb_queue_len(&llc->pdu_unack_q),
skb_queue_len(&llc->pdu_unack_q),
skb_queue_len(&sk->write_queue));
skb_queue_len(&sk->write_queue));
#endif
skb_queue_purge
(
&
sk
->
write_queue
);
skb_queue_purge
(
&
sk
->
write_queue
);
skb_queue_purge
(
&
llc
->
pdu_unack_q
);
skb_queue_purge
(
&
llc
->
pdu_unack_q
);
if
(
free
)
if
(
free
)
...
@@ -315,35 +319,18 @@ struct llc_station *llc_station_get(void)
...
@@ -315,35 +319,18 @@ struct llc_station *llc_station_get(void)
return
&
llc_main_station
;
return
&
llc_main_station
;
}
}
/**
* llc_station_alloc_ev - allocates an event
* @station: Address of the station
*
* Allocates an event in this station. Returns the allocated event on
* success, %NULL otherwise.
*/
struct
llc_station_state_ev
*
llc_station_alloc_ev
(
struct
llc_station
*
station
)
{
struct
llc_station_state_ev
*
ev
=
kmalloc
(
sizeof
(
*
ev
),
GFP_ATOMIC
);
if
(
ev
)
memset
(
ev
,
0
,
sizeof
(
*
ev
));
return
ev
;
}
/**
/**
* llc_station_send_ev: queue event and try to process queue.
* llc_station_send_ev: queue event and try to process queue.
* @station: Address of the station
* @station: Address of the station
* @
ev
: Address of the event
* @
skb
: Address of the event
*
*
* Queues an event (on the station event queue) for handling by the
* Queues an event (on the station event queue) for handling by the
* station state machine and attempts to process any queued-up events.
* station state machine and attempts to process any queued-up events.
*/
*/
void
llc_station_send_ev
(
struct
llc_station
*
station
,
void
llc_station_send_ev
(
struct
llc_station
*
station
,
struct
sk_buff
*
skb
)
struct
llc_station_state_ev
*
ev
)
{
{
spin_lock_bh
(
&
station
->
ev_q
.
lock
);
spin_lock_bh
(
&
station
->
ev_q
.
lock
);
list_add_tail
(
&
ev
->
node
,
&
station
->
ev_q
.
list
);
skb_queue_tail
(
&
station
->
ev_q
.
list
,
skb
);
llc_station_service_events
(
station
);
llc_station_service_events
(
station
);
spin_unlock_bh
(
&
station
->
ev_q
.
lock
);
spin_unlock_bh
(
&
station
->
ev_q
.
lock
);
}
}
...
@@ -384,18 +371,17 @@ static void llc_station_send_pdus(struct llc_station *station)
...
@@ -384,18 +371,17 @@ static void llc_station_send_pdus(struct llc_station *station)
/**
/**
* llc_station_free_ev - frees an event
* llc_station_free_ev - frees an event
* @station: Address of the station
* @station: Address of the station
* @
event
: Address of the event
* @
skb
: Address of the event
*
*
* Frees an event.
* Frees an event.
*/
*/
static
void
llc_station_free_ev
(
struct
llc_station
*
station
,
static
void
llc_station_free_ev
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
struct
sk_buff
*
skb
=
ev
->
data
.
pdu
.
skb
;
struct
llc_station_state_ev
*
ev
=
llc_station_ev
(
skb
)
;
if
(
ev
->
type
==
LLC_STATION_EV_TYPE_PDU
)
if
(
ev
->
type
==
LLC_STATION_EV_TYPE_PDU
)
kfree_skb
(
skb
);
kfree_skb
(
skb
);
kfree
(
ev
);
}
}
/**
/**
...
@@ -412,39 +398,35 @@ static void llc_station_free_ev(struct llc_station *station,
...
@@ -412,39 +398,35 @@ static void llc_station_free_ev(struct llc_station *station,
*/
*/
static
void
llc_station_service_events
(
struct
llc_station
*
station
)
static
void
llc_station_service_events
(
struct
llc_station
*
station
)
{
{
struct
llc_station_state_ev
*
ev
;
struct
sk_buff
*
skb
;
struct
list_head
*
entry
,
*
tmp
;
list_for_each_safe
(
entry
,
tmp
,
&
station
->
ev_q
.
list
)
{
while
((
skb
=
skb_dequeue
(
&
station
->
ev_q
.
list
))
!=
NULL
)
ev
=
list_entry
(
entry
,
struct
llc_station_state_ev
,
node
);
llc_station_next_state
(
station
,
skb
);
list_del
(
&
ev
->
node
);
llc_station_next_state
(
station
,
ev
);
}
}
}
/**
/**
* llc_station_next_state - processes event and goes to the next state
* llc_station_next_state - processes event and goes to the next state
* @station: Address of the station
* @station: Address of the station
* @
ev
: Address of the event
* @
skb
: Address of the event
*
*
* Processes an event, executes any transitions related to that event and
* Processes an event, executes any transitions related to that event and
* updates the state of the station.
* updates the state of the station.
*/
*/
static
u16
llc_station_next_state
(
struct
llc_station
*
station
,
static
u16
llc_station_next_state
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
u16
rc
=
1
;
u16
rc
=
1
;
struct
llc_station_state_trans
*
trans
;
struct
llc_station_state_trans
*
trans
;
if
(
station
->
state
>
LLC_NBR_STATION_STATES
)
if
(
station
->
state
>
LLC_NBR_STATION_STATES
)
goto
out
;
goto
out
;
trans
=
llc_find_station_trans
(
station
,
ev
);
trans
=
llc_find_station_trans
(
station
,
skb
);
if
(
trans
)
{
if
(
trans
)
{
/* got the state to which we next transition; perform the
/* got the state to which we next transition; perform the
* actions associated with this transition before actually
* actions associated with this transition before actually
* transitioning to the next state
* transitioning to the next state
*/
*/
rc
=
llc_exec_station_trans_actions
(
station
,
trans
,
ev
);
rc
=
llc_exec_station_trans_actions
(
station
,
trans
,
skb
);
if
(
!
rc
)
if
(
!
rc
)
/* transition station to next state if all actions
/* transition station to next state if all actions
* execute successfully; done; wait for next event
* execute successfully; done; wait for next event
...
@@ -456,22 +438,22 @@ static u16 llc_station_next_state(struct llc_station *station,
...
@@ -456,22 +438,22 @@ static u16 llc_station_next_state(struct llc_station *station,
*/
*/
rc
=
0
;
rc
=
0
;
out:
out:
llc_station_free_ev
(
station
,
ev
);
llc_station_free_ev
(
station
,
skb
);
return
rc
;
return
rc
;
}
}
/**
/**
* llc_find_station_trans - finds transition for this event
* llc_find_station_trans - finds transition for this event
* @station: Address of the station
* @station: Address of the station
* @
ev
: Address of the event
* @
skb
: Address of the event
*
*
* Search thru events of the current state of the station until list
* Search thru events of the current state of the station until list
* exhausted or it's obvious that the event is not valid for the current
* exhausted or it's obvious that the event is not valid for the current
* state. Returns the address of the transition if cound, %NULL otherwise.
* state. Returns the address of the transition if cound, %NULL otherwise.
*/
*/
static
struct
llc_station_state_trans
*
static
struct
llc_station_state_trans
*
llc_find_station_trans
(
struct
llc_station
*
station
,
llc_find_station_trans
(
struct
llc_station
*
station
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
int
i
=
0
;
int
i
=
0
;
struct
llc_station_state_trans
*
rc
=
NULL
;
struct
llc_station_state_trans
*
rc
=
NULL
;
...
@@ -480,7 +462,7 @@ static struct llc_station_state_trans *
...
@@ -480,7 +462,7 @@ static struct llc_station_state_trans *
&
llc_station_state_table
[
station
->
state
-
1
];
&
llc_station_state_table
[
station
->
state
-
1
];
for
(
next_trans
=
curr_state
->
transitions
;
next_trans
[
i
]
->
ev
;
i
++
)
for
(
next_trans
=
curr_state
->
transitions
;
next_trans
[
i
]
->
ev
;
i
++
)
if
(
!
next_trans
[
i
]
->
ev
(
station
,
ev
))
{
if
(
!
next_trans
[
i
]
->
ev
(
station
,
skb
))
{
rc
=
next_trans
[
i
];
rc
=
next_trans
[
i
];
break
;
break
;
}
}
...
@@ -491,21 +473,20 @@ static struct llc_station_state_trans *
...
@@ -491,21 +473,20 @@ static struct llc_station_state_trans *
* llc_exec_station_trans_actions - executes actions for transition
* llc_exec_station_trans_actions - executes actions for transition
* @station: Address of the station
* @station: Address of the station
* @trans: Address of the transition
* @trans: Address of the transition
* @
ev
: Address of the event that caused the transition
* @
skb
: Address of the event that caused the transition
*
*
* Executes actions of a transition of the station state machine. Returns
* Executes actions of a transition of the station state machine. Returns
* 0 if all actions complete successfully, nonzero otherwise.
* 0 if all actions complete successfully, nonzero otherwise.
*/
*/
static
u16
llc_exec_station_trans_actions
(
struct
llc_station
*
station
,
static
u16
llc_exec_station_trans_actions
(
struct
llc_station
*
station
,
struct
llc_station_state_trans
*
trans
,
struct
llc_station_state_trans
*
trans
,
struct
llc_station_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
u16
rc
=
0
;
u16
rc
=
0
;
llc_station_action_t
*
next_action
;
llc_station_action_t
*
next_action
=
trans
->
ev_actions
;
for
(
next_action
=
trans
->
ev_actions
;
for
(;
next_action
&&
*
next_action
;
next_action
++
)
next_action
&&
*
next_action
;
next_action
++
)
if
((
*
next_action
)(
station
,
skb
))
if
((
*
next_action
)(
station
,
ev
))
rc
=
1
;
rc
=
1
;
return
rc
;
return
rc
;
}
}
...
@@ -595,21 +576,24 @@ static char llc_error_msg[] __initdata =
...
@@ -595,21 +576,24 @@ static char llc_error_msg[] __initdata =
static
int
__init
llc_init
(
void
)
static
int
__init
llc_init
(
void
)
{
{
u16
rc
=
0
;
u16
rc
=
0
;
struct
sk_buff
*
skb
;
struct
llc_station_state_ev
*
ev
;
struct
llc_station_state_ev
*
ev
;
printk
(
llc_banner
);
printk
(
llc_banner
);
INIT_LIST_HEAD
(
&
llc_main_station
.
ev_q
.
list
);
spin_lock_init
(
&
llc_main_station
.
ev_q
.
lock
);
INIT_LIST_HEAD
(
&
llc_main_station
.
sap_list
.
list
);
INIT_LIST_HEAD
(
&
llc_main_station
.
sap_list
.
list
);
spin_lock_init
(
&
llc_main_station
.
sap_list
.
lock
);
spin_lock_init
(
&
llc_main_station
.
sap_list
.
lock
);
skb_queue_head_init
(
&
llc_main_station
.
mac_pdu_q
);
skb_queue_head_init
(
&
llc_main_station
.
mac_pdu_q
);
ev
=
kmalloc
(
sizeof
(
*
ev
),
GFP_ATOMIC
);
skb_queue_head_init
(
&
llc_main_station
.
ev_q
.
list
);
if
(
!
ev
)
spin_lock_init
(
&
llc_main_station
.
ev_q
.
lock
);
skb
=
alloc_skb
(
1
,
GFP_ATOMIC
);
if
(
!
skb
)
goto
err
;
goto
err
;
llc_build_offset_table
();
llc_build_offset_table
();
ev
=
llc_station_ev
(
skb
);
memset
(
ev
,
0
,
sizeof
(
*
ev
));
memset
(
ev
,
0
,
sizeof
(
*
ev
));
if
(
dev_base
->
next
)
if
(
dev_base
->
next
)
memcpy
(
llc_main_station
.
mac_sa
,
dev_base
->
next
->
dev_addr
,
ETH_ALEN
);
memcpy
(
llc_main_station
.
mac_sa
,
dev_base
->
next
->
dev_addr
,
ETH_ALEN
);
else
else
memset
(
llc_main_station
.
mac_sa
,
0
,
ETH_ALEN
);
memset
(
llc_main_station
.
mac_sa
,
0
,
ETH_ALEN
);
llc_main_station
.
ack_timer
.
expires
=
jiffies
+
3
*
HZ
;
llc_main_station
.
ack_timer
.
expires
=
jiffies
+
3
*
HZ
;
...
@@ -617,7 +601,7 @@ static int __init llc_init(void)
...
@@ -617,7 +601,7 @@ static int __init llc_init(void)
llc_main_station
.
state
=
LLC_STATION_STATE_DOWN
;
llc_main_station
.
state
=
LLC_STATION_STATE_DOWN
;
ev
->
type
=
LLC_STATION_EV_TYPE_SIMPLE
;
ev
->
type
=
LLC_STATION_EV_TYPE_SIMPLE
;
ev
->
data
.
a
.
ev
=
LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK
;
ev
->
data
.
a
.
ev
=
LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK
;
rc
=
llc_station_next_state
(
&
llc_main_station
,
ev
);
rc
=
llc_station_next_state
(
&
llc_main_station
,
skb
);
proc_net_create
(
"802.2"
,
0
,
llc_proc_get_info
);
proc_net_create
(
"802.2"
,
0
,
llc_proc_get_info
);
llc_ui_init
();
llc_ui_init
();
dev_add_pack
(
&
llc_packet_type
);
dev_add_pack
(
&
llc_packet_type
);
...
...
net/llc/llc_s_ac.c
View file @
649cbf21
...
@@ -28,32 +28,31 @@
...
@@ -28,32 +28,31 @@
/**
/**
* llc_sap_action_unit_data_ind - forward UI PDU to network layer
* llc_sap_action_unit_data_ind - forward UI PDU to network layer
* @sap: SAP
* @sap: SAP
* @
ev
: the event to forward
* @
skb
: the event to forward
*
*
* Received a UI PDU from MAC layer; forward to network layer as a
* Received a UI PDU from MAC layer; forward to network layer as a
* UNITDATA INDICATION; verify our event is the kind we expect
* UNITDATA INDICATION; verify our event is the kind we expect
*/
*/
int
llc_sap_action_unitdata_ind
(
struct
llc_sap
*
sap
,
int
llc_sap_action_unitdata_ind
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
struct
llc_sap_state_ev
*
ev
)
{
{
llc_sap_rtn_pdu
(
sap
,
ev
->
data
.
pdu
.
skb
,
ev
);
llc_sap_rtn_pdu
(
sap
,
skb
);
return
0
;
return
0
;
}
}
/**
/**
* llc_sap_action_send_ui - sends UI PDU resp to UNITDATA REQ to MAC layer
* llc_sap_action_send_ui - sends UI PDU resp to UNITDATA REQ to MAC layer
* @sap: SAP
* @sap: SAP
* @
ev
: the event to send
* @
skb
: the event to send
*
*
* Sends a UI PDU to the MAC layer in response to a UNITDATA REQUEST
* Sends a UI PDU to the MAC layer in response to a UNITDATA REQUEST
* primitive from the network layer. Verifies event is a primitive type of
* primitive from the network layer. Verifies event is a primitive type of
* event. Verify the primitive is a UNITDATA REQUEST.
* event. Verify the primitive is a UNITDATA REQUEST.
*/
*/
int
llc_sap_action_send_ui
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_action_send_ui
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
struct
llc_prim_if_block
*
prim
=
ev
->
data
.
prim
.
data
;
struct
llc_prim_if_block
*
prim
=
ev
->
data
.
prim
.
data
;
struct
llc_prim_unit_data
*
prim_data
=
&
prim
->
data
->
udata
;
struct
llc_prim_unit_data
*
prim_data
=
&
prim
->
data
->
udata
;
struct
sk_buff
*
skb
=
prim
->
data
->
udata
.
skb
;
int
rc
;
int
rc
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
prim_data
->
saddr
.
lsap
,
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
prim_data
->
saddr
.
lsap
,
...
@@ -71,17 +70,17 @@ int llc_sap_action_send_ui(struct llc_sap *sap, struct llc_sap_state_ev *ev)
...
@@ -71,17 +70,17 @@ int llc_sap_action_send_ui(struct llc_sap *sap, struct llc_sap_state_ev *ev)
/**
/**
* llc_sap_action_send_xid_c - send XID PDU as response to XID REQ
* llc_sap_action_send_xid_c - send XID PDU as response to XID REQ
* @sap: SAP
* @sap: SAP
* @
ev
: the event to send
* @
skb
: the event to send
*
*
* Send a XID command PDU to MAC layer in response to a XID REQUEST
* Send a XID command PDU to MAC layer in response to a XID REQUEST
* primitive from the network layer. Verify event is a primitive type
* primitive from the network layer. Verify event is a primitive type
* event. Verify the primitive is a XID REQUEST.
* event. Verify the primitive is a XID REQUEST.
*/
*/
int
llc_sap_action_send_xid_c
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_action_send_xid_c
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
struct
llc_prim_if_block
*
prim
=
ev
->
data
.
prim
.
data
;
struct
llc_prim_if_block
*
prim
=
ev
->
data
.
prim
.
data
;
struct
llc_prim_xid
*
prim_data
=
&
prim
->
data
->
xid
;
struct
llc_prim_xid
*
prim_data
=
&
prim
->
data
->
xid
;
struct
sk_buff
*
skb
=
prim_data
->
skb
;
int
rc
;
int
rc
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
prim_data
->
saddr
.
lsap
,
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
prim_data
->
saddr
.
lsap
,
...
@@ -99,33 +98,32 @@ int llc_sap_action_send_xid_c(struct llc_sap *sap, struct llc_sap_state_ev *ev)
...
@@ -99,33 +98,32 @@ int llc_sap_action_send_xid_c(struct llc_sap *sap, struct llc_sap_state_ev *ev)
/**
/**
* llc_sap_action_send_xid_r - send XID PDU resp to MAC for received XID
* llc_sap_action_send_xid_r - send XID PDU resp to MAC for received XID
* @sap: SAP
* @sap: SAP
* @
ev
: the event to send
* @
skb
: the event to send
*
*
* Send XID response PDU to MAC in response to an earlier received XID
* Send XID response PDU to MAC in response to an earlier received XID
* command PDU. Verify event is a PDU type event
* command PDU. Verify event is a PDU type event
*/
*/
int
llc_sap_action_send_xid_r
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_action_send_xid_r
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
u8
mac_da
[
ETH_ALEN
],
mac_sa
[
ETH_ALEN
],
dsap
;
u8
mac_da
[
ETH_ALEN
],
mac_sa
[
ETH_ALEN
],
dsap
;
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
ev_skb
=
ev
->
data
.
pdu
.
skb
;
struct
sk_buff
*
nskb
;
struct
sk_buff
*
skb
;
llc_pdu_decode_sa
(
ev_
skb
,
mac_da
);
llc_pdu_decode_sa
(
skb
,
mac_da
);
llc_pdu_decode_da
(
ev_
skb
,
mac_sa
);
llc_pdu_decode_da
(
skb
,
mac_sa
);
llc_pdu_decode_ssap
(
ev_
skb
,
&
dsap
);
llc_pdu_decode_ssap
(
skb
,
&
dsap
);
skb
=
llc_alloc_frame
();
n
skb
=
llc_alloc_frame
();
if
(
!
skb
)
if
(
!
n
skb
)
goto
out
;
goto
out
;
skb
->
dev
=
ev_
skb
->
dev
;
nskb
->
dev
=
skb
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
dsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
dsap
,
LLC_PDU_RSP
);
LLC_PDU_RSP
);
rc
=
llc_pdu_init_as_xid_rsp
(
skb
,
LLC_XID_NULL_CLASS_2
,
0
);
rc
=
llc_pdu_init_as_xid_rsp
(
n
skb
,
LLC_XID_NULL_CLASS_2
,
0
);
if
(
rc
)
if
(
rc
)
goto
out
;
goto
out
;
rc
=
lan_hdrs_init
(
skb
,
mac_sa
,
mac_da
);
rc
=
lan_hdrs_init
(
n
skb
,
mac_sa
,
mac_da
);
if
(
!
rc
)
if
(
!
rc
)
llc_sap_send_pdu
(
sap
,
skb
);
llc_sap_send_pdu
(
sap
,
n
skb
);
out:
out:
return
rc
;
return
rc
;
}
}
...
@@ -133,17 +131,17 @@ int llc_sap_action_send_xid_r(struct llc_sap *sap, struct llc_sap_state_ev *ev)
...
@@ -133,17 +131,17 @@ int llc_sap_action_send_xid_r(struct llc_sap *sap, struct llc_sap_state_ev *ev)
/**
/**
* llc_sap_action_send_test_c - send TEST PDU to MAC in resp to TEST REQ
* llc_sap_action_send_test_c - send TEST PDU to MAC in resp to TEST REQ
* @sap: SAP
* @sap: SAP
* @
ev
: the event to send
* @
skb
: the event to send
*
*
* Send a TEST command PDU to the MAC layer in response to a TEST REQUEST
* Send a TEST command PDU to the MAC layer in response to a TEST REQUEST
* primitive from the network layer. Verify event is a primitive type
* primitive from the network layer. Verify event is a primitive type
* event; verify the primitive is a TEST REQUEST.
* event; verify the primitive is a TEST REQUEST.
*/
*/
int
llc_sap_action_send_test_c
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_action_send_test_c
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
struct
llc_prim_if_block
*
prim
=
ev
->
data
.
prim
.
data
;
struct
llc_prim_if_block
*
prim
=
ev
->
data
.
prim
.
data
;
struct
llc_prim_test
*
prim_data
=
&
prim
->
data
->
test
;
struct
llc_prim_test
*
prim_data
=
&
prim
->
data
->
test
;
struct
sk_buff
*
skb
=
prim_data
->
skb
;
int
rc
;
int
rc
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
prim_data
->
saddr
.
lsap
,
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
prim_data
->
saddr
.
lsap
,
...
@@ -158,28 +156,27 @@ int llc_sap_action_send_test_c(struct llc_sap *sap, struct llc_sap_state_ev *ev)
...
@@ -158,28 +156,27 @@ int llc_sap_action_send_test_c(struct llc_sap *sap, struct llc_sap_state_ev *ev)
return
rc
;
return
rc
;
}
}
int
llc_sap_action_send_test_r
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_action_send_test_r
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
u8
mac_da
[
ETH_ALEN
],
mac_sa
[
ETH_ALEN
],
dsap
;
u8
mac_da
[
ETH_ALEN
],
mac_sa
[
ETH_ALEN
],
dsap
;
struct
sk_buff
*
nskb
;
int
rc
=
1
;
int
rc
=
1
;
struct
sk_buff
*
ev_skb
=
ev
->
data
.
pdu
.
skb
;
struct
sk_buff
*
skb
;
llc_pdu_decode_sa
(
ev_
skb
,
mac_da
);
llc_pdu_decode_sa
(
skb
,
mac_da
);
llc_pdu_decode_da
(
ev_
skb
,
mac_sa
);
llc_pdu_decode_da
(
skb
,
mac_sa
);
llc_pdu_decode_ssap
(
ev_
skb
,
&
dsap
);
llc_pdu_decode_ssap
(
skb
,
&
dsap
);
skb
=
llc_alloc_frame
();
n
skb
=
llc_alloc_frame
();
if
(
!
skb
)
if
(
!
n
skb
)
goto
out
;
goto
out
;
skb
->
dev
=
ev_
skb
->
dev
;
nskb
->
dev
=
skb
->
dev
;
llc_pdu_header_init
(
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
dsap
,
llc_pdu_header_init
(
n
skb
,
LLC_PDU_TYPE_U
,
sap
->
laddr
.
lsap
,
dsap
,
LLC_PDU_RSP
);
LLC_PDU_RSP
);
rc
=
llc_pdu_init_as_test_rsp
(
skb
,
ev_
skb
);
rc
=
llc_pdu_init_as_test_rsp
(
nskb
,
skb
);
if
(
rc
)
if
(
rc
)
goto
out
;
goto
out
;
rc
=
lan_hdrs_init
(
skb
,
mac_sa
,
mac_da
);
rc
=
lan_hdrs_init
(
n
skb
,
mac_sa
,
mac_da
);
if
(
!
rc
)
if
(
!
rc
)
llc_sap_send_pdu
(
sap
,
skb
);
llc_sap_send_pdu
(
sap
,
n
skb
);
out:
out:
return
rc
;
return
rc
;
}
}
...
@@ -187,13 +184,12 @@ int llc_sap_action_send_test_r(struct llc_sap *sap, struct llc_sap_state_ev *ev)
...
@@ -187,13 +184,12 @@ int llc_sap_action_send_test_r(struct llc_sap *sap, struct llc_sap_state_ev *ev)
/**
/**
* llc_sap_action_report_status - report data link status to layer mgmt
* llc_sap_action_report_status - report data link status to layer mgmt
* @sap: SAP
* @sap: SAP
* @
ev
: the event to send
* @
skb
: the event to send
*
*
* Report data link status to layer management. Verify our event is the
* Report data link status to layer management. Verify our event is the
* kind we expect.
* kind we expect.
*/
*/
int
llc_sap_action_report_status
(
struct
llc_sap
*
sap
,
int
llc_sap_action_report_status
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
struct
llc_sap_state_ev
*
ev
)
{
{
return
0
;
return
0
;
}
}
...
@@ -201,27 +197,27 @@ int llc_sap_action_report_status(struct llc_sap *sap,
...
@@ -201,27 +197,27 @@ int llc_sap_action_report_status(struct llc_sap *sap,
/**
/**
* llc_sap_action_xid_ind - send XID PDU resp to net layer via XID IND
* llc_sap_action_xid_ind - send XID PDU resp to net layer via XID IND
* @sap: SAP
* @sap: SAP
* @
ev
: the event to send
* @
skb
: the event to send
*
*
* Send a XID response PDU to the network layer via a XID INDICATION
* Send a XID response PDU to the network layer via a XID INDICATION
* primitive.
* primitive.
*/
*/
int
llc_sap_action_xid_ind
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_action_xid_ind
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
llc_sap_rtn_pdu
(
sap
,
ev
->
data
.
pdu
.
skb
,
ev
);
llc_sap_rtn_pdu
(
sap
,
skb
);
return
0
;
return
0
;
}
}
/**
/**
* llc_sap_action_test_ind - send TEST PDU to net layer via TEST IND
* llc_sap_action_test_ind - send TEST PDU to net layer via TEST IND
* @sap: SAP
* @sap: SAP
* @
ev
: the event to send
* @
skb
: the event to send
*
*
* Send a TEST response PDU to the network layer via a TEST INDICATION
* Send a TEST response PDU to the network layer via a TEST INDICATION
* primitive. Verify our event is a PDU type event.
* primitive. Verify our event is a PDU type event.
*/
*/
int
llc_sap_action_test_ind
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_action_test_ind
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
llc_sap_rtn_pdu
(
sap
,
ev
->
data
.
pdu
.
skb
,
ev
);
llc_sap_rtn_pdu
(
sap
,
skb
);
return
0
;
return
0
;
}
}
net/llc/llc_s_ev.c
View file @
649cbf21
...
@@ -20,82 +20,96 @@
...
@@ -20,82 +20,96 @@
#include <net/llc_s_ev.h>
#include <net/llc_s_ev.h>
#include <net/llc_pdu.h>
#include <net/llc_pdu.h>
int
llc_sap_ev_activation_req
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_ev_activation_req
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
return
ev
->
type
==
LLC_SAP_EV_TYPE_SIMPLE
&&
return
ev
->
type
==
LLC_SAP_EV_TYPE_SIMPLE
&&
ev
->
data
.
a
.
ev
==
LLC_SAP_EV_ACTIVATION_REQ
?
0
:
1
;
ev
->
data
.
a
.
ev
==
LLC_SAP_EV_ACTIVATION_REQ
?
0
:
1
;
}
}
int
llc_sap_ev_rx_ui
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_ev_rx_ui
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
ev
->
type
==
LLC_SAP_EV_TYPE_PDU
&&
!
LLC_PDU_IS_CMD
(
pdu
)
&&
return
ev
->
type
==
LLC_SAP_EV_TYPE_PDU
&&
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
LLC_U_PDU_CMD
(
pdu
)
==
LLC_1_PDU_CMD_UI
?
0
:
1
;
LLC_U_PDU_CMD
(
pdu
)
==
LLC_1_PDU_CMD_UI
?
0
:
1
;
}
}
int
llc_sap_ev_unitdata_req
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_ev_unitdata_req
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
return
ev
->
type
==
LLC_SAP_EV_TYPE_PRIM
&&
return
ev
->
type
==
LLC_SAP_EV_TYPE_PRIM
&&
ev
->
data
.
prim
.
prim
==
LLC_DATAUNIT_PRIM
&&
ev
->
data
.
prim
.
prim
==
LLC_DATAUNIT_PRIM
&&
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
}
}
int
llc_sap_ev_xid_req
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_ev_xid_req
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
return
ev
->
type
==
LLC_SAP_EV_TYPE_PRIM
&&
return
ev
->
type
==
LLC_SAP_EV_TYPE_PRIM
&&
ev
->
data
.
prim
.
prim
==
LLC_XID_PRIM
&&
ev
->
data
.
prim
.
prim
==
LLC_XID_PRIM
&&
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
}
}
int
llc_sap_ev_rx_xid_c
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_ev_rx_xid_c
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
ev
->
type
==
LLC_SAP_EV_TYPE_PDU
&&
!
LLC_PDU_IS_CMD
(
pdu
)
&&
return
ev
->
type
==
LLC_SAP_EV_TYPE_PDU
&&
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
LLC_U_PDU_CMD
(
pdu
)
==
LLC_1_PDU_CMD_XID
?
0
:
1
;
LLC_U_PDU_CMD
(
pdu
)
==
LLC_1_PDU_CMD_XID
?
0
:
1
;
}
}
int
llc_sap_ev_rx_xid_r
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_ev_rx_xid_r
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
ev
->
type
==
LLC_SAP_EV_TYPE_PDU
&&
!
LLC_PDU_IS_RSP
(
pdu
)
&&
return
ev
->
type
==
LLC_SAP_EV_TYPE_PDU
&&
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
LLC_U_PDU_RSP
(
pdu
)
==
LLC_1_PDU_CMD_XID
?
0
:
1
;
LLC_U_PDU_RSP
(
pdu
)
==
LLC_1_PDU_CMD_XID
?
0
:
1
;
}
}
int
llc_sap_ev_test_req
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_ev_test_req
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
return
ev
->
type
==
LLC_SAP_EV_TYPE_PRIM
&&
return
ev
->
type
==
LLC_SAP_EV_TYPE_PRIM
&&
ev
->
data
.
prim
.
prim
==
LLC_TEST_PRIM
&&
ev
->
data
.
prim
.
prim
==
LLC_TEST_PRIM
&&
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
ev
->
data
.
prim
.
type
==
LLC_PRIM_TYPE_REQ
?
0
:
1
;
}
}
int
llc_sap_ev_rx_test_c
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_ev_rx_test_c
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
ev
->
type
==
LLC_SAP_EV_TYPE_PDU
&&
!
LLC_PDU_IS_CMD
(
pdu
)
&&
return
ev
->
type
==
LLC_SAP_EV_TYPE_PDU
&&
!
LLC_PDU_IS_CMD
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
LLC_U_PDU_CMD
(
pdu
)
==
LLC_1_PDU_CMD_TEST
?
0
:
1
;
LLC_U_PDU_CMD
(
pdu
)
==
LLC_1_PDU_CMD_TEST
?
0
:
1
;
}
}
int
llc_sap_ev_rx_test_r
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
int
llc_sap_ev_rx_test_r
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
ev
->
data
.
pdu
.
skb
);
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
struct
llc_pdu_un
*
pdu
=
llc_pdu_un_hdr
(
skb
);
return
ev
->
type
==
LLC_SAP_EV_TYPE_PDU
&&
!
LLC_PDU_IS_RSP
(
pdu
)
&&
return
ev
->
type
==
LLC_SAP_EV_TYPE_PDU
&&
!
LLC_PDU_IS_RSP
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
!
LLC_PDU_TYPE_IS_U
(
pdu
)
&&
LLC_U_PDU_RSP
(
pdu
)
==
LLC_1_PDU_CMD_TEST
?
0
:
1
;
LLC_U_PDU_RSP
(
pdu
)
==
LLC_1_PDU_CMD_TEST
?
0
:
1
;
}
}
int
llc_sap_ev_deactivation_req
(
struct
llc_sap
*
sap
,
int
llc_sap_ev_deactivation_req
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
struct
llc_sap_state_ev
*
ev
)
{
{
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
return
ev
->
type
==
LLC_SAP_EV_TYPE_SIMPLE
&&
return
ev
->
type
==
LLC_SAP_EV_TYPE_SIMPLE
&&
ev
->
data
.
a
.
ev
==
LLC_SAP_EV_DEACTIVATION_REQ
?
0
:
1
;
ev
->
data
.
a
.
ev
==
LLC_SAP_EV_DEACTIVATION_REQ
?
0
:
1
;
}
}
net/llc/llc_s_st.c
View file @
649cbf21
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
* last entry for this state
* last entry for this state
* all members are zeros, .bss zeroes it
* all members are zeros, .bss zeroes it
*/
*/
static
struct
llc_sap_state_trans
llc_sap_state_trans_
n
;
static
struct
llc_sap_state_trans
llc_sap_state_trans_
end
;
/* state LLC_SAP_STATE_INACTIVE transition for
/* state LLC_SAP_STATE_INACTIVE transition for
* LLC_SAP_EV_ACTIVATION_REQ event
* LLC_SAP_EV_ACTIVATION_REQ event
...
@@ -43,7 +43,7 @@ static struct llc_sap_state_trans llc_sap_inactive_state_trans_1 = {
...
@@ -43,7 +43,7 @@ static struct llc_sap_state_trans llc_sap_inactive_state_trans_1 = {
/* array of pointers; one to each transition */
/* array of pointers; one to each transition */
static
struct
llc_sap_state_trans
*
llc_sap_inactive_state_transitions
[]
=
{
static
struct
llc_sap_state_trans
*
llc_sap_inactive_state_transitions
[]
=
{
[
0
]
=
&
llc_sap_inactive_state_trans_1
,
[
0
]
=
&
llc_sap_inactive_state_trans_1
,
[
1
]
=
&
llc_sap_state_trans_
n
,
[
1
]
=
&
llc_sap_state_trans_
end
,
};
};
/* state LLC_SAP_STATE_ACTIVE transition for LLC_SAP_EV_RX_UI event */
/* state LLC_SAP_STATE_ACTIVE transition for LLC_SAP_EV_RX_UI event */
...
@@ -167,17 +167,17 @@ static struct llc_sap_state_trans *llc_sap_active_state_transitions[] = {
...
@@ -167,17 +167,17 @@ static struct llc_sap_state_trans *llc_sap_active_state_transitions[] = {
[
6
]
=
&
llc_sap_active_state_trans_7
,
[
6
]
=
&
llc_sap_active_state_trans_7
,
[
7
]
=
&
llc_sap_active_state_trans_8
,
[
7
]
=
&
llc_sap_active_state_trans_8
,
[
8
]
=
&
llc_sap_active_state_trans_9
,
[
8
]
=
&
llc_sap_active_state_trans_9
,
[
9
]
=
&
llc_sap_state_trans_
n
,
[
9
]
=
&
llc_sap_state_trans_
end
,
};
};
/* SAP state transition table */
/* SAP state transition table */
struct
llc_sap_state
llc_sap_state_table
[]
=
{
struct
llc_sap_state
llc_sap_state_table
[
LLC_NR_SAP_STATES
]
=
{
{
[
LLC_SAP_STATE_INACTIVE
-
1
]
=
{
.
curr_state
=
LLC_SAP_STATE_INACTIVE
,
.
curr_state
=
LLC_SAP_STATE_INACTIVE
,
.
transitions
=
llc_sap_inactive_state_transitions
,
.
transitions
=
llc_sap_inactive_state_transitions
,
},
},
{
[
LLC_SAP_STATE_ACTIVE
-
1
]
=
{
.
curr_state
=
LLC_SAP_STATE_ACTIVE
,
.
curr_state
=
LLC_SAP_STATE_ACTIVE
,
.
transitions
=
llc_sap_active_state_transitions
,
.
transitions
=
llc_sap_active_state_transitions
,
},
},
};
};
net/llc/llc_sap.c
View file @
649cbf21
...
@@ -23,13 +23,13 @@
...
@@ -23,13 +23,13 @@
#include <net/llc_pdu.h>
#include <net/llc_pdu.h>
#include <linux/if_tr.h>
#include <linux/if_tr.h>
static
void
llc_sap_free_ev
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
static
void
llc_sap_free_ev
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
static
int
llc_sap_next_state
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
static
int
llc_sap_next_state
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
);
static
int
llc_exec_sap_trans_actions
(
struct
llc_sap
*
sap
,
static
int
llc_exec_sap_trans_actions
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_trans
*
trans
,
struct
llc_sap_state_trans
*
trans
,
struct
llc_sap_state_ev
*
ev
);
struct
sk_buff
*
skb
);
static
struct
llc_sap_state_trans
*
llc_find_sap_trans
(
struct
llc_sap
*
sap
,
static
struct
llc_sap_state_trans
*
llc_find_sap_trans
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
);
struct
sk_buff
*
skb
);
/**
/**
* llc_sap_assign_sock - adds a connection to a SAP
* llc_sap_assign_sock - adds a connection to a SAP
...
@@ -63,50 +63,35 @@ void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk)
...
@@ -63,50 +63,35 @@ void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk)
spin_unlock_bh
(
&
sap
->
sk_list
.
lock
);
spin_unlock_bh
(
&
sap
->
sk_list
.
lock
);
}
}
/**
* llc_sap_alloc_ev - allocates sap event
* @sap: pointer to SAP
* @ev: allocated event (output argument)
*
* Returns the allocated sap event or %NULL when out of memory.
*/
struct
llc_sap_state_ev
*
llc_sap_alloc_ev
(
struct
llc_sap
*
sap
)
{
struct
llc_sap_state_ev
*
ev
=
kmalloc
(
sizeof
(
*
ev
),
GFP_ATOMIC
);
if
(
ev
)
memset
(
ev
,
0
,
sizeof
(
*
ev
));
return
ev
;
}
/**
/**
* llc_sap_send_ev - sends event to SAP state machine
* llc_sap_send_ev - sends event to SAP state machine
* @sap: pointer to SAP
* @sap: pointer to SAP
* @
ev
: pointer to occurred event
* @
skb
: pointer to occurred event
*
*
* After executing actions of the event, upper layer will be indicated
* After executing actions of the event, upper layer will be indicated
* if needed(on receiving an UI frame).
* if needed(on receiving an UI frame).
*/
*/
void
llc_sap_send_ev
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
void
llc_sap_send_ev
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
llc_sap_next_state
(
sap
,
ev
);
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
llc_sap_next_state
(
sap
,
skb
);
if
(
ev
->
ind_cfm_flag
==
LLC_IND
)
{
if
(
ev
->
ind_cfm_flag
==
LLC_IND
)
{
skb_get
(
ev
->
data
.
pdu
.
skb
);
skb_get
(
skb
);
sap
->
ind
(
ev
->
prim
);
sap
->
ind
(
ev
->
prim
);
}
}
llc_sap_free_ev
(
sap
,
ev
);
llc_sap_free_ev
(
sap
,
skb
);
}
}
/**
/**
* llc_sap_rtn_pdu - Informs upper layer on rx of an UI, XID or TEST pdu.
* llc_sap_rtn_pdu - Informs upper layer on rx of an UI, XID or TEST pdu.
* @sap: pointer to SAP
* @sap: pointer to SAP
* @skb: received pdu
* @skb: received pdu
* @ev: pointer to occurred event
*/
*/
void
llc_sap_rtn_pdu
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
,
void
llc_sap_rtn_pdu
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
struct
llc_sap_state_ev
*
ev
)
{
{
struct
llc_pdu_un
*
pdu
;
struct
llc_pdu_un
*
pdu
;
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_ind_prim
;
struct
llc_prim_if_block
*
prim
=
&
sap
->
llc_ind_prim
;
union
llc_u_prim_data
*
prim_data
=
prim
->
data
;
union
llc_u_prim_data
*
prim_data
=
prim
->
data
;
u8
lfb
;
u8
lfb
;
...
@@ -160,37 +145,38 @@ void llc_sap_send_pdu(struct llc_sap *sap, struct sk_buff *skb)
...
@@ -160,37 +145,38 @@ void llc_sap_send_pdu(struct llc_sap *sap, struct sk_buff *skb)
/**
/**
* llc_sap_free_ev - frees an sap event
* llc_sap_free_ev - frees an sap event
* @sap: pointer to SAP
* @sap: pointer to SAP
* @
ev
: released event
* @
skb
: released event
*/
*/
static
void
llc_sap_free_ev
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
static
void
llc_sap_free_ev
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
struct
llc_sap_state_ev
*
ev
=
llc_sap_ev
(
skb
);
if
(
ev
->
type
==
LLC_SAP_EV_TYPE_PDU
)
if
(
ev
->
type
==
LLC_SAP_EV_TYPE_PDU
)
kfree_skb
(
ev
->
data
.
pdu
.
skb
);
kfree_skb
(
skb
);
kfree
(
ev
);
}
}
/**
/**
* llc_sap_next_state - finds transition, execs actions & change SAP state
* llc_sap_next_state - finds transition, execs actions & change SAP state
* @sap: pointer to SAP
* @sap: pointer to SAP
* @
ev
: happened event
* @
skb
: happened event
*
*
* This function finds transition that matches with happened event, then
* This function finds transition that matches with happened event, then
* executes related actions and finally changes state of SAP. It returns
* executes related actions and finally changes state of SAP. It returns
* 0 on success and 1 for failure.
* 0 on success and 1 for failure.
*/
*/
static
int
llc_sap_next_state
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
static
int
llc_sap_next_state
(
struct
llc_sap
*
sap
,
struct
sk_buff
*
skb
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
llc_sap_state_trans
*
trans
;
struct
llc_sap_state_trans
*
trans
;
if
(
sap
->
state
<=
LLC_N
B
R_SAP_STATES
)
{
if
(
sap
->
state
<=
LLC_NR_SAP_STATES
)
{
trans
=
llc_find_sap_trans
(
sap
,
ev
);
trans
=
llc_find_sap_trans
(
sap
,
skb
);
if
(
trans
)
{
if
(
trans
)
{
/* got the state to which we next transition; perform
/* got the state to which we next transition; perform
* the actions associated with this transition before
* the actions associated with this transition before
* actually transitioning to the next state
* actually transitioning to the next state
*/
*/
rc
=
llc_exec_sap_trans_actions
(
sap
,
trans
,
ev
);
rc
=
llc_exec_sap_trans_actions
(
sap
,
trans
,
skb
);
if
(
!
rc
)
if
(
!
rc
)
/* transition SAP to next state if all actions
/* transition SAP to next state if all actions
* execute successfully
* execute successfully
...
@@ -204,14 +190,14 @@ static int llc_sap_next_state(struct llc_sap *sap, struct llc_sap_state_ev *ev)
...
@@ -204,14 +190,14 @@ static int llc_sap_next_state(struct llc_sap *sap, struct llc_sap_state_ev *ev)
/**
/**
* llc_find_sap_trans - finds transition for event
* llc_find_sap_trans - finds transition for event
* @sap: pointer to SAP
* @sap: pointer to SAP
* @
ev
: happened event
* @
skb
: happened event
*
*
* This function finds transition that matches with happened event.
* This function finds transition that matches with happened event.
* Returns the pointer to found transition on success or %NULL for
* Returns the pointer to found transition on success or %NULL for
* failure.
* failure.
*/
*/
static
struct
llc_sap_state_trans
*
llc_find_sap_trans
(
struct
llc_sap
*
sap
,
static
struct
llc_sap_state_trans
*
llc_find_sap_trans
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
int
i
=
0
;
int
i
=
0
;
struct
llc_sap_state_trans
*
rc
=
NULL
;
struct
llc_sap_state_trans
*
rc
=
NULL
;
...
@@ -221,7 +207,7 @@ static struct llc_sap_state_trans *llc_find_sap_trans(struct llc_sap *sap,
...
@@ -221,7 +207,7 @@ static struct llc_sap_state_trans *llc_find_sap_trans(struct llc_sap *sap,
* its obvious the event is not valid for the current state
* its obvious the event is not valid for the current state
*/
*/
for
(
next_trans
=
curr_state
->
transitions
;
next_trans
[
i
]
->
ev
;
i
++
)
for
(
next_trans
=
curr_state
->
transitions
;
next_trans
[
i
]
->
ev
;
i
++
)
if
(
!
next_trans
[
i
]
->
ev
(
sap
,
ev
))
{
if
(
!
next_trans
[
i
]
->
ev
(
sap
,
skb
))
{
/* got event match; return it */
/* got event match; return it */
rc
=
next_trans
[
i
];
rc
=
next_trans
[
i
];
break
;
break
;
...
@@ -233,21 +219,20 @@ static struct llc_sap_state_trans *llc_find_sap_trans(struct llc_sap *sap,
...
@@ -233,21 +219,20 @@ static struct llc_sap_state_trans *llc_find_sap_trans(struct llc_sap *sap,
* llc_exec_sap_trans_actions - execute actions related to event
* llc_exec_sap_trans_actions - execute actions related to event
* @sap: pointer to SAP
* @sap: pointer to SAP
* @trans: pointer to transition that it's actions must be performed
* @trans: pointer to transition that it's actions must be performed
* @
ev
: happened event.
* @
skb
: happened event.
*
*
* This function executes actions that is related to happened event.
* This function executes actions that is related to happened event.
* Returns 0 for success and 1 for failure of at least one action.
* Returns 0 for success and 1 for failure of at least one action.
*/
*/
static
int
llc_exec_sap_trans_actions
(
struct
llc_sap
*
sap
,
static
int
llc_exec_sap_trans_actions
(
struct
llc_sap
*
sap
,
struct
llc_sap_state_trans
*
trans
,
struct
llc_sap_state_trans
*
trans
,
struct
llc_sap_state_ev
*
ev
)
struct
sk_buff
*
skb
)
{
{
int
rc
=
0
;
int
rc
=
0
;
llc_sap_action_t
*
next_action
;
llc_sap_action_t
*
next_action
=
trans
->
ev_actions
;
for
(
next_action
=
trans
->
ev_actions
;
for
(;
next_action
&&
*
next_action
;
next_action
++
)
next_action
&&
*
next_action
;
next_action
++
)
if
((
*
next_action
)(
sap
,
skb
))
if
((
*
next_action
)(
sap
,
ev
))
rc
=
1
;
rc
=
1
;
return
rc
;
return
rc
;
}
}
net/llc/llc_sock.c
View file @
649cbf21
...
@@ -1629,6 +1629,13 @@ static int llc_ui_confirm(struct llc_prim_if_block *prim)
...
@@ -1629,6 +1629,13 @@ static int llc_ui_confirm(struct llc_prim_if_block *prim)
}
}
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
#define MAC_FORMATTED_SIZE 17
static
void
llc_ui_format_mac
(
char
*
bf
,
unsigned
char
*
mac
)
{
sprintf
(
bf
,
"%02X:%02X:%02X:%02X:%02X:%02X"
,
mac
[
0
],
mac
[
1
],
mac
[
2
],
mac
[
3
],
mac
[
4
],
mac
[
5
]);
}
/**
/**
* llc_ui_get_info - return info to procfs
* llc_ui_get_info - return info to procfs
* @buffer: where to put the formatted output
* @buffer: where to put the formatted output
...
@@ -1656,41 +1663,25 @@ static int llc_ui_get_info(char *buffer, char **start, off_t offset, int length)
...
@@ -1656,41 +1663,25 @@ static int llc_ui_get_info(char *buffer, char **start, off_t offset, int length)
if
(
llc_ui
->
sap
)
{
if
(
llc_ui
->
sap
)
{
if
(
llc_ui
->
dev
&&
if
(
llc_ui
->
dev
&&
llc_ui_mac_null
(
llc_ui
->
addr
.
sllc_mmac
))
llc_ui_mac_null
(
llc_ui
->
addr
.
sllc_mmac
))
len
+=
sprintf
(
buffer
+
len
,
llc_ui_format_mac
(
buffer
+
len
,
"%02X:%02X:%02X:%02X:%02X:%02X"
,
llc_ui
->
dev
->
dev_addr
);
llc_ui
->
dev
->
dev_addr
[
0
],
llc_ui
->
dev
->
dev_addr
[
1
],
llc_ui
->
dev
->
dev_addr
[
2
],
llc_ui
->
dev
->
dev_addr
[
3
],
llc_ui
->
dev
->
dev_addr
[
4
],
llc_ui
->
dev
->
dev_addr
[
5
]);
else
{
else
{
if
(
!
llc_ui_mac_null
(
llc_ui
->
addr
.
sllc_mmac
))
if
(
!
llc_ui_mac_null
(
llc_ui
->
addr
.
sllc_mmac
))
len
+=
sprintf
(
buffer
+
len
,
llc_ui_format_mac
(
buffer
+
len
,
"%02X:%02X:%02X:%02X:%02X:%02X"
,
llc_ui
->
addr
.
sllc_mmac
);
llc_ui
->
addr
.
sllc_mmac
[
0
],
llc_ui
->
addr
.
sllc_mmac
[
1
],
llc_ui
->
addr
.
sllc_mmac
[
2
],
llc_ui
->
addr
.
sllc_mmac
[
3
],
llc_ui
->
addr
.
sllc_mmac
[
4
],
llc_ui
->
addr
.
sllc_mmac
[
5
]);
else
else
len
+=
sprintf
(
buffer
+
len
,
sprintf
(
buffer
+
len
,
"00:00:00:00:00:00"
);
"00:00:00:00:00:00"
);
}
}
len
+=
MAC_FORMATTED_SIZE
;
len
+=
sprintf
(
buffer
+
len
,
"@%02X "
,
len
+=
sprintf
(
buffer
+
len
,
"@%02X "
,
llc_ui
->
sap
->
laddr
.
lsap
);
llc_ui
->
sap
->
laddr
.
lsap
);
}
else
}
else
len
+=
sprintf
(
buffer
+
len
,
"00:00:00:00:00:00@00 "
);
len
+=
sprintf
(
buffer
+
len
,
"00:00:00:00:00:00@00 "
);
llc_ui_format_mac
(
buffer
+
len
,
llc_ui
->
addr
.
sllc_dmac
);
len
+=
MAC_FORMATTED_SIZE
;
len
+=
sprintf
(
buffer
+
len
,
len
+=
sprintf
(
buffer
+
len
,
"%02X:%02X:%02X:%02X:%02X:%02X@%02X "
"@%02X %08d:%08d %02d %-3d "
,
"%08X:%08X %02X %-3d "
,
llc_ui
->
addr
.
sllc_dmac
[
0
],
llc_ui
->
addr
.
sllc_dmac
[
1
],
llc_ui
->
addr
.
sllc_dmac
[
2
],
llc_ui
->
addr
.
sllc_dmac
[
3
],
llc_ui
->
addr
.
sllc_dmac
[
4
],
llc_ui
->
addr
.
sllc_dmac
[
5
],
llc_ui
->
addr
.
sllc_dsap
,
llc_ui
->
addr
.
sllc_dsap
,
atomic_read
(
&
s
->
wmem_alloc
),
atomic_read
(
&
s
->
wmem_alloc
),
atomic_read
(
&
s
->
rmem_alloc
),
s
->
state
,
atomic_read
(
&
s
->
rmem_alloc
),
s
->
state
,
...
...
net/llc/llc_stat.c
View file @
649cbf21
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
* last entry for this state
* last entry for this state
* all members are zeros, .bss zeroes it
* all members are zeros, .bss zeroes it
*/
*/
static
struct
llc_station_state_trans
llc_stat_state_trans_
n
;
static
struct
llc_station_state_trans
llc_stat_state_trans_
end
;
/* DOWN STATE transitions */
/* DOWN STATE transitions */
...
@@ -59,7 +59,7 @@ static struct llc_station_state_trans llc_stat_down_state_trans_2 = {
...
@@ -59,7 +59,7 @@ static struct llc_station_state_trans llc_stat_down_state_trans_2 = {
static
struct
llc_station_state_trans
*
llc_stat_dwn_state_trans
[]
=
{
static
struct
llc_station_state_trans
*
llc_stat_dwn_state_trans
[]
=
{
[
0
]
=
&
llc_stat_down_state_trans_1
,
[
0
]
=
&
llc_stat_down_state_trans_1
,
[
1
]
=
&
llc_stat_down_state_trans_2
,
[
1
]
=
&
llc_stat_down_state_trans_2
,
[
2
]
=
&
llc_stat_state_trans_
n
,
[
2
]
=
&
llc_stat_state_trans_
end
,
};
};
/* UP STATE transitions */
/* UP STATE transitions */
...
@@ -104,7 +104,7 @@ static struct llc_station_state_trans *llc_stat_up_state_trans [] = {
...
@@ -104,7 +104,7 @@ static struct llc_station_state_trans *llc_stat_up_state_trans [] = {
[
0
]
=
&
llc_stat_up_state_trans_1
,
[
0
]
=
&
llc_stat_up_state_trans_1
,
[
1
]
=
&
llc_stat_up_state_trans_2
,
[
1
]
=
&
llc_stat_up_state_trans_2
,
[
2
]
=
&
llc_stat_up_state_trans_3
,
[
2
]
=
&
llc_stat_up_state_trans_3
,
[
3
]
=
&
llc_stat_state_trans_
n
,
[
3
]
=
&
llc_stat_state_trans_
end
,
};
};
/* DUP ADDR CHK STATE transitions */
/* DUP ADDR CHK STATE transitions */
...
@@ -162,7 +162,7 @@ static llc_station_action_t llc_stat_dupaddr_state_actions_4[] = {
...
@@ -162,7 +162,7 @@ static llc_station_action_t llc_stat_dupaddr_state_actions_4[] = {
static
struct
llc_station_state_trans
llc_stat_dupaddr_state_trans_4
=
{
static
struct
llc_station_state_trans
llc_stat_dupaddr_state_trans_4
=
{
.
ev
=
llc_stat_ev_ack_tmr_exp_lt_retry_cnt_max_retry
,
.
ev
=
llc_stat_ev_ack_tmr_exp_lt_retry_cnt_max_retry
,
.
next_state
=
LLC_STATION_STATE_DUP_ADDR_CHK
,
.
next_state
=
LLC_STATION_STATE_DUP_ADDR_CHK
,
.
ev_actions
=
llc_stat_dupaddr_state_actions_4
.
ev_actions
=
llc_stat_dupaddr_state_actions_4
,
};
};
/* state transition for LLC_STATION_EV_ACK_TMR_EXP_EQ_RETRY_CNT_MAX_RETRY
/* state transition for LLC_STATION_EV_ACK_TMR_EXP_EQ_RETRY_CNT_MAX_RETRY
...
@@ -199,20 +199,20 @@ static struct llc_station_state_trans *llc_stat_dupaddr_state_trans[] = {
...
@@ -199,20 +199,20 @@ static struct llc_station_state_trans *llc_stat_dupaddr_state_trans[] = {
[
3
]
=
&
llc_stat_dupaddr_state_trans_1
,
/* Receive frame */
[
3
]
=
&
llc_stat_dupaddr_state_trans_1
,
/* Receive frame */
[
4
]
=
&
llc_stat_dupaddr_state_trans_2
,
[
4
]
=
&
llc_stat_dupaddr_state_trans_2
,
[
5
]
=
&
llc_stat_dupaddr_state_trans_3
,
[
5
]
=
&
llc_stat_dupaddr_state_trans_3
,
[
6
]
=
&
llc_stat_state_trans_
n
[
6
]
=
&
llc_stat_state_trans_
end
,
};
};
struct
llc_station_state
llc_station_state_table
[
LLC_NBR_STATION_STATES
]
=
{
struct
llc_station_state
llc_station_state_table
[
LLC_NBR_STATION_STATES
]
=
{
{
[
LLC_STATION_STATE_DOWN
-
1
]
=
{
.
curr_state
=
LLC_STATION_STATE_DOWN
,
.
curr_state
=
LLC_STATION_STATE_DOWN
,
.
transitions
=
llc_stat_dwn_state_trans
,
.
transitions
=
llc_stat_dwn_state_trans
,
},
},
{
[
LLC_STATION_STATE_DUP_ADDR_CHK
-
1
]
=
{
.
curr_state
=
LLC_STATION_STATE_DUP_ADDR_CHK
,
.
curr_state
=
LLC_STATION_STATE_DUP_ADDR_CHK
,
.
transitions
=
llc_stat_dupaddr_state_trans
,
.
transitions
=
llc_stat_dupaddr_state_trans
,
},
},
{
[
LLC_STATION_STATE_UP
-
1
]
=
{
.
curr_state
=
LLC_STATION_STATE_UP
,
.
curr_state
=
LLC_STATION_STATE_UP
,
.
transitions
=
llc_stat_up_state_trans
,
.
transitions
=
llc_stat_up_state_trans
,
}
}
,
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment