~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/llc/llc_s_ev.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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 }
116 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php