| 1 |
|
| 2 | #ifndef LLC_C_EV_H
|
| 3 | #define LLC_C_EV_H
|
| 4 | |
| 5 | * Copyright (c) 1997 by Procom Technology,Inc.
|
| 6 | * 2001 by Arnaldo Carvalho de Melo <[email protected]>
|
| 7 |
|
| 8 |
|
| 9 | #include <net/sock.h>
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 | #define LLC_CONN_EV_TYPE_SIMPLE 1
|
| 14 | #define LLC_CONN_EV_TYPE_CONDITION 2
|
| 15 | #define LLC_CONN_EV_TYPE_PRIM 3
|
| 16 | #define LLC_CONN_EV_TYPE_PDU 4
|
| 17 | #define LLC_CONN_EV_TYPE_ACK_TMR 5
|
| 18 | #define LLC_CONN_EV_TYPE_P_TMR 6
|
| 19 | #define LLC_CONN_EV_TYPE_REJ_TMR 7
|
| 20 | #define LLC_CONN_EV_TYPE_BUSY_TMR 8
|
| 21 | #define LLC_CONN_EV_TYPE_RPT_STATUS 9
|
| 22 | #define LLC_CONN_EV_TYPE_SENDACK_TMR 10
|
| 23 |
|
| 24 | #define NBR_CONN_EV 5
|
| 25 |
|
| 26 |
|
| 27 | #define LLC_CONN_EV_CONN_REQ 1
|
| 28 | #define LLC_CONN_EV_CONN_RESP 2
|
| 29 | #define LLC_CONN_EV_DATA_REQ 3
|
| 30 | #define LLC_CONN_EV_DISC_REQ 4
|
| 31 | #define LLC_CONN_EV_RESET_REQ 5
|
| 32 | #define LLC_CONN_EV_RESET_RESP 6
|
| 33 | #define LLC_CONN_EV_LOCAL_BUSY_DETECTED 7
|
| 34 | #define LLC_CONN_EV_LOCAL_BUSY_CLEARED 8
|
| 35 | #define LLC_CONN_EV_RX_BAD_PDU 9
|
| 36 | #define LLC_CONN_EV_RX_DISC_CMD_Pbit_SET_X 10
|
| 37 | #define LLC_CONN_EV_RX_DM_RSP_Fbit_SET_X 11
|
| 38 | #define LLC_CONN_EV_RX_FRMR_RSP_Fbit_SET_X 12
|
| 39 | #define LLC_CONN_EV_RX_I_CMD_Pbit_SET_X 13
|
| 40 | #define LLC_CONN_EV_RX_I_CMD_Pbit_SET_X_UNEXPD_Ns 14
|
| 41 | #define LLC_CONN_EV_RX_I_CMD_Pbit_SET_X_INVAL_Ns 15
|
| 42 | #define LLC_CONN_EV_RX_I_RSP_Fbit_SET_X 16
|
| 43 | #define LLC_CONN_EV_RX_I_RSP_Fbit_SET_X_UNEXPD_Ns 17
|
| 44 | #define LLC_CONN_EV_RX_I_RSP_Fbit_SET_X_INVAL_Ns 18
|
| 45 | #define LLC_CONN_EV_RX_REJ_CMD_Pbit_SET_X 19
|
| 46 | #define LLC_CONN_EV_RX_REJ_RSP_Fbit_SET_X 20
|
| 47 | #define LLC_CONN_EV_RX_RNR_CMD_Pbit_SET_X 21
|
| 48 | #define LLC_CONN_EV_RX_RNR_RSP_Fbit_SET_X 22
|
| 49 | #define LLC_CONN_EV_RX_RR_CMD_Pbit_SET_X 23
|
| 50 | #define LLC_CONN_EV_RX_RR_RSP_Fbit_SET_X 24
|
| 51 | #define LLC_CONN_EV_RX_SABME_CMD_Pbit_SET_X 25
|
| 52 | #define LLC_CONN_EV_RX_UA_RSP_Fbit_SET_X 26
|
| 53 | #define LLC_CONN_EV_RX_XXX_CMD_Pbit_SET_X 27
|
| 54 | #define LLC_CONN_EV_RX_XXX_RSP_Fbit_SET_X 28
|
| 55 | #define LLC_CONN_EV_RX_XXX_YYY 29
|
| 56 | #define LLC_CONN_EV_RX_ZZZ_CMD_Pbit_SET_X_INVAL_Nr 30
|
| 57 | #define LLC_CONN_EV_RX_ZZZ_RSP_Fbit_SET_X_INVAL_Nr 31
|
| 58 | #define LLC_CONN_EV_P_TMR_EXP 32
|
| 59 | #define LLC_CONN_EV_ACK_TMR_EXP 33
|
| 60 | #define LLC_CONN_EV_REJ_TMR_EXP 34
|
| 61 | #define LLC_CONN_EV_BUSY_TMR_EXP 35
|
| 62 | #define LLC_CONN_EV_RX_XXX_CMD_Pbit_SET_1 36
|
| 63 | #define LLC_CONN_EV_RX_XXX_CMD_Pbit_SET_0 37
|
| 64 | #define LLC_CONN_EV_RX_I_CMD_Pbit_SET_0_UNEXPD_Ns 38
|
| 65 | #define LLC_CONN_EV_RX_I_RSP_Fbit_SET_0_UNEXPD_Ns 39
|
| 66 | #define LLC_CONN_EV_RX_I_RSP_Fbit_SET_1_UNEXPD_Ns 40
|
| 67 | #define LLC_CONN_EV_RX_I_CMD_Pbit_SET_1_UNEXPD_Ns 41
|
| 68 | #define LLC_CONN_EV_RX_I_CMD_Pbit_SET_0 42
|
| 69 | #define LLC_CONN_EV_RX_I_RSP_Fbit_SET_0 43
|
| 70 | #define LLC_CONN_EV_RX_I_CMD_Pbit_SET_1 44
|
| 71 | #define LLC_CONN_EV_RX_RR_CMD_Pbit_SET_0 45
|
| 72 | #define LLC_CONN_EV_RX_RR_RSP_Fbit_SET_0 46
|
| 73 | #define LLC_CONN_EV_RX_RR_RSP_Fbit_SET_1 47
|
| 74 | #define LLC_CONN_EV_RX_RR_CMD_Pbit_SET_1 48
|
| 75 | #define LLC_CONN_EV_RX_RNR_CMD_Pbit_SET_0 49
|
| 76 | #define LLC_CONN_EV_RX_RNR_RSP_Fbit_SET_0 50
|
| 77 | #define LLC_CONN_EV_RX_RNR_RSP_Fbit_SET_1 51
|
| 78 | #define LLC_CONN_EV_RX_RNR_CMD_Pbit_SET_1 52
|
| 79 | #define LLC_CONN_EV_RX_REJ_CMD_Pbit_SET_0 53
|
| 80 | #define LLC_CONN_EV_RX_REJ_RSP_Fbit_SET_0 54
|
| 81 | #define LLC_CONN_EV_RX_REJ_CMD_Pbit_SET_1 55
|
| 82 | #define LLC_CONN_EV_RX_I_RSP_Fbit_SET_1 56
|
| 83 | #define LLC_CONN_EV_RX_REJ_RSP_Fbit_SET_1 57
|
| 84 | #define LLC_CONN_EV_RX_XXX_RSP_Fbit_SET_1 58
|
| 85 | #define LLC_CONN_EV_TX_BUFF_FULL 59
|
| 86 |
|
| 87 | #define LLC_CONN_EV_INIT_P_F_CYCLE 100
|
| 88 | |
| 89 | * Connection event qualifiers; for some events a certain combination of
|
| 90 | * these qualifiers must be TRUE before event recognized valid for state;
|
| 91 | * these constants act as indexes into the Event Qualifier function
|
| 92 | * table
|
| 93 |
|
| 94 | #define LLC_CONN_EV_QFY_DATA_FLAG_EQ_1 1
|
| 95 | #define LLC_CONN_EV_QFY_DATA_FLAG_EQ_0 2
|
| 96 | #define LLC_CONN_EV_QFY_DATA_FLAG_EQ_2 3
|
| 97 | #define LLC_CONN_EV_QFY_P_FLAG_EQ_1 4
|
| 98 | #define LLC_CONN_EV_QFY_P_FLAG_EQ_0 5
|
| 99 | #define LLC_CONN_EV_QFY_P_FLAG_EQ_Fbit 6
|
| 100 | #define LLC_CONN_EV_QFY_REMOTE_BUSY_EQ_0 7
|
| 101 | #define LLC_CONN_EV_QFY_RETRY_CNT_LT_N2 8
|
| 102 | #define LLC_CONN_EV_QFY_RETRY_CNT_GTE_N2 9
|
| 103 | #define LLC_CONN_EV_QFY_S_FLAG_EQ_1 10
|
| 104 | #define LLC_CONN_EV_QFY_S_FLAG_EQ_0 11
|
| 105 | #define LLC_CONN_EV_QFY_INIT_P_F_CYCLE 12
|
| 106 |
|
| 107 | struct llc_conn_state_ev {
|
| 108 | u8 type;
|
| 109 | u8 prim;
|
| 110 | u8 prim_type;
|
| 111 | u8 reason;
|
| 112 | u8 status;
|
| 113 | u8 ind_prim;
|
| 114 | u8 cfm_prim;
|
| 115 | };
|
| 116 |
|
| 117 | static __inline__ struct llc_conn_state_ev *llc_conn_ev(struct sk_buff *skb)
|
| 118 | {
|
| 119 | return (struct llc_conn_state_ev *)skb->cb;
|
| 120 | }
|
| 121 |
|
| 122 | typedef int (*llc_conn_ev_t)(struct sock *sk, struct sk_buff *skb);
|
| 123 | typedef int (*llc_conn_ev_qfyr_t)(struct sock *sk, struct sk_buff *skb);
|
| 124 |
|
| 125 | int llc_conn_ev_conn_req(struct sock *sk, struct sk_buff *skb);
|
| 126 | int llc_conn_ev_data_req(struct sock *sk, struct sk_buff *skb);
|
| 127 | int llc_conn_ev_disc_req(struct sock *sk, struct sk_buff *skb);
|
| 128 | int llc_conn_ev_rst_req(struct sock *sk, struct sk_buff *skb);
|
| 129 | int llc_conn_ev_local_busy_detected(struct sock *sk, struct sk_buff *skb);
|
| 130 | int llc_conn_ev_local_busy_cleared(struct sock *sk, struct sk_buff *skb);
|
| 131 | int llc_conn_ev_rx_bad_pdu(struct sock *sk, struct sk_buff *skb);
|
| 132 | int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb);
|
| 133 | int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
|
| 134 | int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
|
| 135 | int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk,
|
| 136 | struct sk_buff *skb);
|
| 137 | int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
|
| 138 | int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk,
|
| 139 | struct sk_buff *skb);
|
| 140 | int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk,
|
| 141 | struct sk_buff *skb);
|
| 142 | int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
|
| 143 | int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb);
|
| 144 | int llc_conn_ev_rx_ua_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
|
| 145 | int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb);
|
| 146 | int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
|
| 147 | int llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr(struct sock *sk,
|
| 148 | struct sk_buff *skb);
|
| 149 | int llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr(struct sock *sk,
|
| 150 | struct sk_buff *skb);
|
| 151 | int llc_conn_ev_p_tmr_exp(struct sock *sk, struct sk_buff *skb);
|
| 152 | int llc_conn_ev_ack_tmr_exp(struct sock *sk, struct sk_buff *skb);
|
| 153 | int llc_conn_ev_rej_tmr_exp(struct sock *sk, struct sk_buff *skb);
|
| 154 | int llc_conn_ev_busy_tmr_exp(struct sock *sk, struct sk_buff *skb);
|
| 155 |
|
| 156 | int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
|
| 157 | int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
|
| 158 | int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk,
|
| 159 | struct sk_buff *skb);
|
| 160 | int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk,
|
| 161 | struct sk_buff *skb);
|
| 162 | int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb);
|
| 163 | int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
|
| 164 | int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk,
|
| 165 | struct sk_buff *skb);
|
| 166 | int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk,
|
| 167 | struct sk_buff *skb);
|
| 168 | int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb);
|
| 169 | int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
|
| 170 | int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb);
|
| 171 | int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
|
| 172 | int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb);
|
| 173 | int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
|
| 174 | int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb);
|
| 175 | int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
|
| 176 | int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb);
|
| 177 | int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
|
| 178 | int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb);
|
| 179 | int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
|
| 180 | int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb);
|
| 181 | int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
|
| 182 | int llc_conn_ev_rx_any_frame(struct sock *sk, struct sk_buff *skb);
|
| 183 | int llc_conn_ev_tx_buffer_full(struct sock *sk, struct sk_buff *skb);
|
| 184 | int llc_conn_ev_init_p_f_cycle(struct sock *sk, struct sk_buff *skb);
|
| 185 |
|
| 186 |
|
| 187 | int llc_conn_ev_qlfy_data_flag_eq_1(struct sock *sk, struct sk_buff *skb);
|
| 188 | int llc_conn_ev_qlfy_data_flag_eq_0(struct sock *sk, struct sk_buff *skb);
|
| 189 | int llc_conn_ev_qlfy_data_flag_eq_2(struct sock *sk, struct sk_buff *skb);
|
| 190 | int llc_conn_ev_qlfy_p_flag_eq_1(struct sock *sk, struct sk_buff *skb);
|
| 191 | int llc_conn_ev_qlfy_last_frame_eq_1(struct sock *sk, struct sk_buff *skb);
|
| 192 | int llc_conn_ev_qlfy_last_frame_eq_0(struct sock *sk, struct sk_buff *skb);
|
| 193 | int llc_conn_ev_qlfy_p_flag_eq_0(struct sock *sk, struct sk_buff *skb);
|
| 194 | int llc_conn_ev_qlfy_p_flag_eq_f(struct sock *sk, struct sk_buff *skb);
|
| 195 | int llc_conn_ev_qlfy_remote_busy_eq_0(struct sock *sk, struct sk_buff *skb);
|
| 196 | int llc_conn_ev_qlfy_remote_busy_eq_1(struct sock *sk, struct sk_buff *skb);
|
| 197 | int llc_conn_ev_qlfy_retry_cnt_lt_n2(struct sock *sk, struct sk_buff *skb);
|
| 198 | int llc_conn_ev_qlfy_retry_cnt_gte_n2(struct sock *sk, struct sk_buff *skb);
|
| 199 | int llc_conn_ev_qlfy_s_flag_eq_1(struct sock *sk, struct sk_buff *skb);
|
| 200 | int llc_conn_ev_qlfy_s_flag_eq_0(struct sock *sk, struct sk_buff *skb);
|
| 201 | int llc_conn_ev_qlfy_cause_flag_eq_1(struct sock *sk, struct sk_buff *skb);
|
| 202 | int llc_conn_ev_qlfy_cause_flag_eq_0(struct sock *sk, struct sk_buff *skb);
|
| 203 | int llc_conn_ev_qlfy_set_status_conn(struct sock *sk, struct sk_buff *skb);
|
| 204 | int llc_conn_ev_qlfy_set_status_disc(struct sock *sk, struct sk_buff *skb);
|
| 205 | int llc_conn_ev_qlfy_set_status_failed(struct sock *sk, struct sk_buff *skb);
|
| 206 | int llc_conn_ev_qlfy_set_status_remote_busy(struct sock *sk,
|
| 207 | struct sk_buff *skb);
|
| 208 | int llc_conn_ev_qlfy_set_status_refuse(struct sock *sk, struct sk_buff *skb);
|
| 209 | int llc_conn_ev_qlfy_set_status_conflict(struct sock *sk, struct sk_buff *skb);
|
| 210 | int llc_conn_ev_qlfy_set_status_rst_done(struct sock *sk, struct sk_buff *skb);
|
| 211 |
|
| 212 | static __inline__ int llc_conn_space(struct sock *sk, struct sk_buff *skb)
|
| 213 | {
|
| 214 | return atomic_read(&sk->sk_rmem_alloc) + skb->truesize <
|
| 215 | (unsigned int)sk->sk_rcvbuf;
|
| 216 | }
|
| 217 | #endif
|