arm64: pass a task parameter to unwind_frame()
[linux-2.6/btrfs-unstable.git] / include / linux / sock_diag.h
blobfddebc6174697a311be8aa06d1e30ed90135d41b
1 #ifndef __SOCK_DIAG_H__
2 #define __SOCK_DIAG_H__
4 #include <linux/netlink.h>
5 #include <linux/user_namespace.h>
6 #include <net/net_namespace.h>
7 #include <net/sock.h>
8 #include <uapi/linux/sock_diag.h>
10 struct sk_buff;
11 struct nlmsghdr;
12 struct sock;
14 struct sock_diag_handler {
15 __u8 family;
16 int (*dump)(struct sk_buff *skb, struct nlmsghdr *nlh);
17 int (*get_info)(struct sk_buff *skb, struct sock *sk);
20 int sock_diag_register(const struct sock_diag_handler *h);
21 void sock_diag_unregister(const struct sock_diag_handler *h);
23 void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
24 void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
26 int sock_diag_check_cookie(struct sock *sk, const __u32 *cookie);
27 void sock_diag_save_cookie(struct sock *sk, __u32 *cookie);
29 int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr);
30 int sock_diag_put_filterinfo(bool may_report_filterinfo, struct sock *sk,
31 struct sk_buff *skb, int attrtype);
33 static inline
34 enum sknetlink_groups sock_diag_destroy_group(const struct sock *sk)
36 switch (sk->sk_family) {
37 case AF_INET:
38 switch (sk->sk_protocol) {
39 case IPPROTO_TCP:
40 return SKNLGRP_INET_TCP_DESTROY;
41 case IPPROTO_UDP:
42 return SKNLGRP_INET_UDP_DESTROY;
43 default:
44 return SKNLGRP_NONE;
46 case AF_INET6:
47 switch (sk->sk_protocol) {
48 case IPPROTO_TCP:
49 return SKNLGRP_INET6_TCP_DESTROY;
50 case IPPROTO_UDP:
51 return SKNLGRP_INET6_UDP_DESTROY;
52 default:
53 return SKNLGRP_NONE;
55 default:
56 return SKNLGRP_NONE;
60 static inline
61 bool sock_diag_has_destroy_listeners(const struct sock *sk)
63 const struct net *n = sock_net(sk);
64 const enum sknetlink_groups group = sock_diag_destroy_group(sk);
66 return group != SKNLGRP_NONE && n->diag_nlsk &&
67 netlink_has_listeners(n->diag_nlsk, group);
69 void sock_diag_broadcast_destroy(struct sock *sk);
71 #endif