1 /* 2 * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /****************************************************************************** 20 * wlan_nlink_srv.h 21 * 22 * wlan_nlink_srv is used to RX/TX Netlink messages from user space to kernel 23 * modules and vice versa. Kernel modules must register a message handler for a 24 * message type so that the wlan_nlink_srv can invoke the corresponding msg handler 25 * whenever a Netlink message of a particular type has been received from an 26 * application. In the opposite direction, wlan_nlink_srv provides a mechanism 27 * which kernel modules can use to send Netlink messages to applications. 28 * 29 ******************************************************************************/ 30 31 #ifndef WLAN_NLINK_SRV_H 32 #define WLAN_NLINK_SRV_H 33 34 #include <linux/skbuff.h> 35 #include <net/netlink.h> 36 #include <wlan_nlink_common.h> 37 38 #define INVALID_PID -1 39 #define NLINK_MAX_CALLBACKS (WLAN_NL_MSG_MAX - WLAN_NL_MSG_BASE) 40 41 typedef int (*nl_srv_msg_callback)(struct sk_buff *skb); 42 43 int nl_srv_init(void *wiphy); 44 void nl_srv_exit(void); 45 int nl_srv_register(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler); 46 int nl_srv_unregister(tWlanNlModTypes msg_type, 47 nl_srv_msg_callback msg_handler); 48 49 #ifdef CNSS_GENL 50 int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag, 51 int app_id, int mcgroup_id); 52 int nl_srv_bcast(struct sk_buff *skb, int mcgroup_id, int app_id); 53 #else 54 int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag); 55 int nl_srv_bcast(struct sk_buff *skb); 56 #endif 57 58 int nl_srv_is_initialized(void); 59 void nl_srv_ucast_oem(struct sk_buff *skb, int dst_pid, int flag); 60 61 #endif 62