0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include <linux/socket.h>
0018 #include <net/sock.h>
0019 #include <net/llc_if.h>
0020 #include <net/llc_s_ev.h>
0021 #include <net/llc_pdu.h>
0022
0023 int llc_sap_ev_activation_req(struct llc_sap *sap, struct sk_buff *skb)
0024 {
0025 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
0026
0027 return ev->type == LLC_SAP_EV_TYPE_SIMPLE &&
0028 ev->prim_type == LLC_SAP_EV_ACTIVATION_REQ ? 0 : 1;
0029 }
0030
0031 int llc_sap_ev_rx_ui(struct llc_sap *sap, struct sk_buff *skb)
0032 {
0033 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
0034 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
0035
0036 return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_CMD(pdu) &&
0037 LLC_PDU_TYPE_IS_U(pdu) &&
0038 LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_UI ? 0 : 1;
0039 }
0040
0041 int llc_sap_ev_unitdata_req(struct llc_sap *sap, struct sk_buff *skb)
0042 {
0043 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
0044
0045 return ev->type == LLC_SAP_EV_TYPE_PRIM &&
0046 ev->prim == LLC_DATAUNIT_PRIM &&
0047 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1;
0048
0049 }
0050
0051 int llc_sap_ev_xid_req(struct llc_sap *sap, struct sk_buff *skb)
0052 {
0053 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
0054
0055 return ev->type == LLC_SAP_EV_TYPE_PRIM &&
0056 ev->prim == LLC_XID_PRIM &&
0057 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1;
0058 }
0059
0060 int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct sk_buff *skb)
0061 {
0062 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
0063 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
0064
0065 return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_CMD(pdu) &&
0066 LLC_PDU_TYPE_IS_U(pdu) &&
0067 LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_XID ? 0 : 1;
0068 }
0069
0070 int llc_sap_ev_rx_xid_r(struct llc_sap *sap, struct sk_buff *skb)
0071 {
0072 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
0073 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
0074
0075 return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_RSP(pdu) &&
0076 LLC_PDU_TYPE_IS_U(pdu) &&
0077 LLC_U_PDU_RSP(pdu) == LLC_1_PDU_CMD_XID ? 0 : 1;
0078 }
0079
0080 int llc_sap_ev_test_req(struct llc_sap *sap, struct sk_buff *skb)
0081 {
0082 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
0083
0084 return ev->type == LLC_SAP_EV_TYPE_PRIM &&
0085 ev->prim == LLC_TEST_PRIM &&
0086 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1;
0087 }
0088
0089 int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct sk_buff *skb)
0090 {
0091 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
0092 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
0093
0094 return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_CMD(pdu) &&
0095 LLC_PDU_TYPE_IS_U(pdu) &&
0096 LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_TEST ? 0 : 1;
0097 }
0098
0099 int llc_sap_ev_rx_test_r(struct llc_sap *sap, struct sk_buff *skb)
0100 {
0101 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
0102 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
0103
0104 return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_RSP(pdu) &&
0105 LLC_PDU_TYPE_IS_U(pdu) &&
0106 LLC_U_PDU_RSP(pdu) == LLC_1_PDU_CMD_TEST ? 0 : 1;
0107 }
0108
0109 int llc_sap_ev_deactivation_req(struct llc_sap *sap, struct sk_buff *skb)
0110 {
0111 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
0112
0113 return ev->type == LLC_SAP_EV_TYPE_SIMPLE &&
0114 ev->prim_type == LLC_SAP_EV_DEACTIVATION_REQ ? 0 : 1;
0115 }