diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /net/llc/llc_s_ev.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'net/llc/llc_s_ev.c')
-rw-r--r-- | net/llc/llc_s_ev.c | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/net/llc/llc_s_ev.c b/net/llc/llc_s_ev.c new file mode 100644 index 000000000000..a74d2a1d6581 --- /dev/null +++ b/net/llc/llc_s_ev.c | |||
@@ -0,0 +1,115 @@ | |||
1 | /* | ||
2 | * llc_s_ev.c - Defines SAP component events | ||
3 | * | ||
4 | * The followed event functions are SAP component events which are described | ||
5 | * in 802.2 LLC protocol standard document. | ||
6 | * | ||
7 | * Copyright (c) 1997 by Procom Technology, Inc. | ||
8 | * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> | ||
9 | * | ||
10 | * This program can be redistributed or modified under the terms of the | ||
11 | * GNU General Public License as published by the Free Software Foundation. | ||
12 | * This program is distributed without any warranty or implied warranty | ||
13 | * of merchantability or fitness for a particular purpose. | ||
14 | * | ||
15 | * See the GNU General Public License for more details. | ||
16 | */ | ||
17 | #include <linux/socket.h> | ||
18 | #include <net/sock.h> | ||
19 | #include <net/llc_if.h> | ||
20 | #include <net/llc_s_ev.h> | ||
21 | #include <net/llc_pdu.h> | ||
22 | |||
23 | int llc_sap_ev_activation_req(struct llc_sap *sap, struct sk_buff *skb) | ||
24 | { | ||
25 | struct llc_sap_state_ev *ev = llc_sap_ev(skb); | ||
26 | |||
27 | return ev->type == LLC_SAP_EV_TYPE_SIMPLE && | ||
28 | ev->prim_type == LLC_SAP_EV_ACTIVATION_REQ ? 0 : 1; | ||
29 | } | ||
30 | |||
31 | int llc_sap_ev_rx_ui(struct llc_sap *sap, struct sk_buff *skb) | ||
32 | { | ||
33 | struct llc_sap_state_ev *ev = llc_sap_ev(skb); | ||
34 | struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); | ||
35 | |||
36 | return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_CMD(pdu) && | ||
37 | LLC_PDU_TYPE_IS_U(pdu) && | ||
38 | LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_UI ? 0 : 1; | ||
39 | } | ||
40 | |||
41 | int llc_sap_ev_unitdata_req(struct llc_sap *sap, struct sk_buff *skb) | ||
42 | { | ||
43 | struct llc_sap_state_ev *ev = llc_sap_ev(skb); | ||
44 | |||
45 | return ev->type == LLC_SAP_EV_TYPE_PRIM && | ||
46 | ev->prim == LLC_DATAUNIT_PRIM && | ||
47 | ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; | ||
48 | |||
49 | } | ||
50 | |||
51 | int llc_sap_ev_xid_req(struct llc_sap *sap, struct sk_buff *skb) | ||
52 | { | ||
53 | struct llc_sap_state_ev *ev = llc_sap_ev(skb); | ||
54 | |||
55 | return ev->type == LLC_SAP_EV_TYPE_PRIM && | ||
56 | ev->prim == LLC_XID_PRIM && | ||
57 | ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; | ||
58 | } | ||
59 | |||
60 | int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct sk_buff *skb) | ||
61 | { | ||
62 | struct llc_sap_state_ev *ev = llc_sap_ev(skb); | ||
63 | struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); | ||
64 | |||
65 | return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_CMD(pdu) && | ||
66 | LLC_PDU_TYPE_IS_U(pdu) && | ||
67 | LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_XID ? 0 : 1; | ||
68 | } | ||
69 | |||
70 | int llc_sap_ev_rx_xid_r(struct llc_sap *sap, struct sk_buff *skb) | ||
71 | { | ||
72 | struct llc_sap_state_ev *ev = llc_sap_ev(skb); | ||
73 | struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); | ||
74 | |||
75 | return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_RSP(pdu) && | ||
76 | LLC_PDU_TYPE_IS_U(pdu) && | ||
77 | LLC_U_PDU_RSP(pdu) == LLC_1_PDU_CMD_XID ? 0 : 1; | ||
78 | } | ||
79 | |||
80 | int llc_sap_ev_test_req(struct llc_sap *sap, struct sk_buff *skb) | ||
81 | { | ||
82 | struct llc_sap_state_ev *ev = llc_sap_ev(skb); | ||
83 | |||
84 | return ev->type == LLC_SAP_EV_TYPE_PRIM && | ||
85 | ev->prim == LLC_TEST_PRIM && | ||
86 | ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; | ||
87 | } | ||
88 | |||
89 | int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct sk_buff *skb) | ||
90 | { | ||
91 | struct llc_sap_state_ev *ev = llc_sap_ev(skb); | ||
92 | struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); | ||
93 | |||
94 | return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_CMD(pdu) && | ||
95 | LLC_PDU_TYPE_IS_U(pdu) && | ||
96 | LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_TEST ? 0 : 1; | ||
97 | } | ||
98 | |||
99 | int llc_sap_ev_rx_test_r(struct llc_sap *sap, struct sk_buff *skb) | ||
100 | { | ||
101 | struct llc_sap_state_ev *ev = llc_sap_ev(skb); | ||
102 | struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); | ||
103 | |||
104 | return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_RSP(pdu) && | ||
105 | LLC_PDU_TYPE_IS_U(pdu) && | ||
106 | LLC_U_PDU_RSP(pdu) == LLC_1_PDU_CMD_TEST ? 0 : 1; | ||
107 | } | ||
108 | |||
109 | int llc_sap_ev_deactivation_req(struct llc_sap *sap, struct sk_buff *skb) | ||
110 | { | ||
111 | struct llc_sap_state_ev *ev = llc_sap_ev(skb); | ||
112 | |||
113 | return ev->type == LLC_SAP_EV_TYPE_SIMPLE && | ||
114 | ev->prim_type == LLC_SAP_EV_DEACTIVATION_REQ ? 0 : 1; | ||
115 | } | ||