Lines Matching defs:ax25

26 #include <net/ax25.h>
40 * Handling of state 0 and connection release is in ax25.c.
42 static int ax25_std_state1_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int pf, int type)
46 ax25->modulus = AX25_MODULUS;
47 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW];
48 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
52 ax25->modulus = AX25_EMODULUS;
53 ax25->window = ax25->ax25_dev->values[AX25_VALUES_EWINDOW];
54 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
58 ax25_send_control(ax25, AX25_DM, pf, AX25_RESPONSE);
63 ax25_calculate_rtt(ax25);
64 ax25_stop_t1timer(ax25);
65 ax25_start_t3timer(ax25);
66 ax25_start_idletimer(ax25);
67 ax25->vs = 0;
68 ax25->va = 0;
69 ax25->vr = 0;
70 ax25->state = AX25_STATE_3;
71 ax25->n2count = 0;
72 if (ax25->sk != NULL) {
73 bh_lock_sock(ax25->sk);
74 ax25->sk->sk_state = TCP_ESTABLISHED;
76 if (!sock_flag(ax25->sk, SOCK_DEAD))
77 ax25->sk->sk_state_change(ax25->sk);
78 bh_unlock_sock(ax25->sk);
85 if (ax25->modulus == AX25_MODULUS) {
86 ax25_disconnect(ax25, ECONNREFUSED);
88 ax25->modulus = AX25_MODULUS;
89 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW];
104 * Handling of state 0 and connection release is in ax25.c.
106 static int ax25_std_state2_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int pf, int type)
111 ax25_send_control(ax25, AX25_DM, pf, AX25_RESPONSE);
115 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
116 ax25_disconnect(ax25, 0);
122 ax25_disconnect(ax25, 0);
129 if (pf) ax25_send_control(ax25, AX25_DM, AX25_POLLON, AX25_RESPONSE);
142 * Handling of state 0 and connection release is in ax25.c.
144 static int ax25_std_state3_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int ns, int nr, int pf, int type)
152 ax25->modulus = AX25_MODULUS;
153 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW];
155 ax25->modulus = AX25_EMODULUS;
156 ax25->window = ax25->ax25_dev->values[AX25_VALUES_EWINDOW];
158 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
159 ax25_stop_t1timer(ax25);
160 ax25_stop_t2timer(ax25);
161 ax25_start_t3timer(ax25);
162 ax25_start_idletimer(ax25);
163 ax25->condition = 0x00;
164 ax25->vs = 0;
165 ax25->va = 0;
166 ax25->vr = 0;
167 ax25_requeue_frames(ax25);
171 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
172 ax25_disconnect(ax25, 0);
176 ax25_disconnect(ax25, ECONNRESET);
182 ax25->condition &= ~AX25_COND_PEER_RX_BUSY;
184 ax25->condition |= AX25_COND_PEER_RX_BUSY;
186 ax25_std_enquiry_response(ax25);
187 if (ax25_validate_nr(ax25, nr)) {
188 ax25_check_iframes_acked(ax25, nr);
190 ax25_std_nr_error_recovery(ax25);
191 ax25->state = AX25_STATE_1;
196 ax25->condition &= ~AX25_COND_PEER_RX_BUSY;
198 ax25_std_enquiry_response(ax25);
199 if (ax25_validate_nr(ax25, nr)) {
200 ax25_frames_acked(ax25, nr);
201 ax25_calculate_rtt(ax25);
202 ax25_stop_t1timer(ax25);
203 ax25_start_t3timer(ax25);
204 ax25_requeue_frames(ax25);
206 ax25_std_nr_error_recovery(ax25);
207 ax25->state = AX25_STATE_1;
212 if (!ax25_validate_nr(ax25, nr)) {
213 ax25_std_nr_error_recovery(ax25);
214 ax25->state = AX25_STATE_1;
217 if (ax25->condition & AX25_COND_PEER_RX_BUSY) {
218 ax25_frames_acked(ax25, nr);
220 ax25_check_iframes_acked(ax25, nr);
222 if (ax25->condition & AX25_COND_OWN_RX_BUSY) {
223 if (pf) ax25_std_enquiry_response(ax25);
226 if (ns == ax25->vr) {
227 ax25->vr = (ax25->vr + 1) % ax25->modulus;
228 queued = ax25_rx_iframe(ax25, skb);
229 if (ax25->condition & AX25_COND_OWN_RX_BUSY)
230 ax25->vr = ns; /* ax25->vr - 1 */
231 ax25->condition &= ~AX25_COND_REJECT;
233 ax25_std_enquiry_response(ax25);
235 if (!(ax25->condition & AX25_COND_ACK_PENDING)) {
236 ax25->condition |= AX25_COND_ACK_PENDING;
237 ax25_start_t2timer(ax25);
241 if (ax25->condition & AX25_COND_REJECT) {
242 if (pf) ax25_std_enquiry_response(ax25);
244 ax25->condition |= AX25_COND_REJECT;
245 ax25_send_control(ax25, AX25_REJ, pf, AX25_RESPONSE);
246 ax25->condition &= ~AX25_COND_ACK_PENDING;
253 ax25_std_establish_data_link(ax25);
254 ax25->state = AX25_STATE_1;
267 * Handling of state 0 and connection release is in ax25.c.
269 static int ax25_std_state4_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int ns, int nr, int pf, int type)
277 ax25->modulus = AX25_MODULUS;
278 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW];
280 ax25->modulus = AX25_EMODULUS;
281 ax25->window = ax25->ax25_dev->values[AX25_VALUES_EWINDOW];
283 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
284 ax25_stop_t1timer(ax25);
285 ax25_stop_t2timer(ax25);
286 ax25_start_t3timer(ax25);
287 ax25_start_idletimer(ax25);
288 ax25->condition = 0x00;
289 ax25->vs = 0;
290 ax25->va = 0;
291 ax25->vr = 0;
292 ax25->state = AX25_STATE_3;
293 ax25->n2count = 0;
294 ax25_requeue_frames(ax25);
298 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
299 ax25_disconnect(ax25, 0);
303 ax25_disconnect(ax25, ECONNRESET);
309 ax25->condition &= ~AX25_COND_PEER_RX_BUSY;
311 ax25->condition |= AX25_COND_PEER_RX_BUSY;
313 ax25_stop_t1timer(ax25);
314 ax25->n2count = 0;
315 if (ax25_validate_nr(ax25, nr)) {
316 ax25_frames_acked(ax25, nr);
317 if (ax25->vs == ax25->va) {
318 ax25_start_t3timer(ax25);
319 ax25->state = AX25_STATE_3;
321 ax25_requeue_frames(ax25);
324 ax25_std_nr_error_recovery(ax25);
325 ax25->state = AX25_STATE_1;
330 ax25_std_enquiry_response(ax25);
331 if (ax25_validate_nr(ax25, nr)) {
332 ax25_frames_acked(ax25, nr);
334 ax25_std_nr_error_recovery(ax25);
335 ax25->state = AX25_STATE_1;
340 ax25->condition &= ~AX25_COND_PEER_RX_BUSY;
342 ax25_stop_t1timer(ax25);
343 ax25->n2count = 0;
344 if (ax25_validate_nr(ax25, nr)) {
345 ax25_frames_acked(ax25, nr);
346 if (ax25->vs == ax25->va) {
347 ax25_start_t3timer(ax25);
348 ax25->state = AX25_STATE_3;
350 ax25_requeue_frames(ax25);
353 ax25_std_nr_error_recovery(ax25);
354 ax25->state = AX25_STATE_1;
359 ax25_std_enquiry_response(ax25);
360 if (ax25_validate_nr(ax25, nr)) {
361 ax25_frames_acked(ax25, nr);
362 ax25_requeue_frames(ax25);
364 ax25_std_nr_error_recovery(ax25);
365 ax25->state = AX25_STATE_1;
370 if (!ax25_validate_nr(ax25, nr)) {
371 ax25_std_nr_error_recovery(ax25);
372 ax25->state = AX25_STATE_1;
375 ax25_frames_acked(ax25, nr);
376 if (ax25->condition & AX25_COND_OWN_RX_BUSY) {
378 ax25_std_enquiry_response(ax25);
381 if (ns == ax25->vr) {
382 ax25->vr = (ax25->vr + 1) % ax25->modulus;
383 queued = ax25_rx_iframe(ax25, skb);
384 if (ax25->condition & AX25_COND_OWN_RX_BUSY)
385 ax25->vr = ns; /* ax25->vr - 1 */
386 ax25->condition &= ~AX25_COND_REJECT;
388 ax25_std_enquiry_response(ax25);
390 if (!(ax25->condition & AX25_COND_ACK_PENDING)) {
391 ax25->condition |= AX25_COND_ACK_PENDING;
392 ax25_start_t2timer(ax25);
396 if (ax25->condition & AX25_COND_REJECT) {
397 if (pf) ax25_std_enquiry_response(ax25);
399 ax25->condition |= AX25_COND_REJECT;
400 ax25_send_control(ax25, AX25_REJ, pf, AX25_RESPONSE);
401 ax25->condition &= ~AX25_COND_ACK_PENDING;
408 ax25_std_establish_data_link(ax25);
409 ax25->state = AX25_STATE_1;
422 int ax25_std_frame_in(ax25_cb *ax25, struct sk_buff *skb, int type)
426 frametype = ax25_decode(ax25, skb, &ns, &nr, &pf);
428 switch (ax25->state) {
430 queued = ax25_std_state1_machine(ax25, skb, frametype, pf, type);
433 queued = ax25_std_state2_machine(ax25, skb, frametype, pf, type);
436 queued = ax25_std_state3_machine(ax25, skb, frametype, ns, nr, pf, type);
439 queued = ax25_std_state4_machine(ax25, skb, frametype, ns, nr, pf, type);
443 ax25_kick(ax25);