fed up with those stupid warnings
[mmotm.git] / net / llc / llc_s_ev.c
bloba74d2a1d658135ede739363b66e2b6883865e09b
1 /*
2 * llc_s_ev.c - Defines SAP component events
4 * The followed event functions are SAP component events which are described
5 * in 802.2 LLC protocol standard document.
7 * Copyright (c) 1997 by Procom Technology, Inc.
8 * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
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.
15 * See the GNU General Public License for more details.
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>
23 int llc_sap_ev_activation_req(struct llc_sap *sap, struct sk_buff *skb)
25 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
27 return ev->type == LLC_SAP_EV_TYPE_SIMPLE &&
28 ev->prim_type == LLC_SAP_EV_ACTIVATION_REQ ? 0 : 1;
31 int llc_sap_ev_rx_ui(struct llc_sap *sap, struct sk_buff *skb)
33 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
34 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
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;
41 int llc_sap_ev_unitdata_req(struct llc_sap *sap, struct sk_buff *skb)
43 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
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;
51 int llc_sap_ev_xid_req(struct llc_sap *sap, struct sk_buff *skb)
53 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
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;
60 int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct sk_buff *skb)
62 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
63 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
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;
70 int llc_sap_ev_rx_xid_r(struct llc_sap *sap, struct sk_buff *skb)
72 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
73 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
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;
80 int llc_sap_ev_test_req(struct llc_sap *sap, struct sk_buff *skb)
82 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
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;
89 int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct sk_buff *skb)
91 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
92 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
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;
99 int llc_sap_ev_rx_test_r(struct llc_sap *sap, struct sk_buff *skb)
101 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
102 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
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;
109 int llc_sap_ev_deactivation_req(struct llc_sap *sap, struct sk_buff *skb)
111 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
113 return ev->type == LLC_SAP_EV_TYPE_SIMPLE &&
114 ev->prim_type == LLC_SAP_EV_DEACTIVATION_REQ ? 0 : 1;