26 #include <linux/slab.h>
27 #include <linux/errno.h>
28 #include <linux/kernel.h>
29 #include <linux/string.h>
35 static int x25_queue_rx_frame(
struct sock *
sk,
struct sk_buff *
skb,
int more)
43 skb_set_owner_r(skb, sk);
47 if (!more && x25->
fraglen > 0) {
57 skb_reset_transport_header(skbn);
60 skb_copy_from_linear_data(skbo,
skb_put(skbn, skbo->
len),
68 skb_copy_from_linear_data(skbo,
77 skb_set_owner_r(skbn, sk);
90 static int x25_state1_machine(
struct sock *sk,
struct sk_buff *skb,
int frametype)
169 static int x25_state2_machine(
struct sock *sk,
struct sk_buff *skb,
int frametype)
202 static int x25_state3_machine(
struct sock *sk,
struct sk_buff *skb,
int frametype,
int ns,
int nr,
int q,
int d,
int m)
269 if (x25_queue_rx_frame(sk, skb, m) == 0) {
270 x25->
vr = (x25->
vr + 1) % modulus;
293 if (((x25->
vl + x25->
facilities.winsize_in) % modulus) == x25->
vr) {
311 skb_set_owner_r(skb, sk);
338 static int x25_state4_machine(
struct sock *sk,
struct sk_buff *skb,
int frametype)
382 int queued = 0, frametype,
ns,
nr,
q,
d,
m;
387 frametype =
x25_decode(sk, skb, &ns, &nr, &q, &d, &m);
389 switch (x25->
state) {
391 queued = x25_state1_machine(sk, skb, frametype);
394 queued = x25_state2_machine(sk, skb, frametype);
397 queued = x25_state3_machine(sk, skb, frametype, ns, nr, q, d, m);
400 queued = x25_state4_machine(sk, skb, frametype);