Remi Denis-Courmont | f8ff602 | 2008-09-22 20:03:44 -0700 | [diff] [blame] | 1 | /* |
| 2 | * File: pn_dev.h |
| 3 | * |
| 4 | * Phonet network device |
| 5 | * |
| 6 | * Copyright (C) 2008 Nokia Corporation. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License |
| 10 | * version 2 as published by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 20 | * 02110-1301 USA |
| 21 | */ |
| 22 | |
| 23 | #ifndef PN_DEV_H |
| 24 | #define PN_DEV_H |
| 25 | |
| 26 | struct phonet_device_list { |
| 27 | struct list_head list; |
Rémi Denis-Courmont | eeb74a9 | 2009-11-18 10:08:26 -0800 | [diff] [blame] | 28 | struct mutex lock; |
Remi Denis-Courmont | f8ff602 | 2008-09-22 20:03:44 -0700 | [diff] [blame] | 29 | }; |
| 30 | |
remi.denis-courmont@nokia | 9a3b7a4 | 2009-01-23 03:00:30 +0000 | [diff] [blame] | 31 | struct phonet_device_list *phonet_device_list(struct net *net); |
Remi Denis-Courmont | f8ff602 | 2008-09-22 20:03:44 -0700 | [diff] [blame] | 32 | |
| 33 | struct phonet_device { |
| 34 | struct list_head list; |
| 35 | struct net_device *netdev; |
| 36 | DECLARE_BITMAP(addrs, 64); |
Jiri Pirko | 88e7594 | 2010-06-07 03:27:39 +0000 | [diff] [blame] | 37 | struct rcu_head rcu; |
Remi Denis-Courmont | f8ff602 | 2008-09-22 20:03:44 -0700 | [diff] [blame] | 38 | }; |
| 39 | |
remi.denis-courmont@nokia | 76e02cf | 2009-01-23 03:00:27 +0000 | [diff] [blame] | 40 | int phonet_device_init(void); |
Remi Denis-Courmont | f8ff602 | 2008-09-22 20:03:44 -0700 | [diff] [blame] | 41 | void phonet_device_exit(void); |
remi.denis-courmont@nokia | 660f706 | 2009-01-23 03:00:28 +0000 | [diff] [blame] | 42 | int phonet_netlink_register(void); |
Remi Denis-Courmont | f8ff602 | 2008-09-22 20:03:44 -0700 | [diff] [blame] | 43 | struct net_device *phonet_device_get(struct net *net); |
| 44 | |
| 45 | int phonet_address_add(struct net_device *dev, u8 addr); |
| 46 | int phonet_address_del(struct net_device *dev, u8 addr); |
| 47 | u8 phonet_address_get(struct net_device *dev, u8 addr); |
Rémi Denis-Courmont | 5240488 | 2008-12-03 15:42:56 -0800 | [diff] [blame] | 48 | int phonet_address_lookup(struct net *net, u8 addr); |
Rémi Denis-Courmont | c7a1a4c | 2009-06-24 01:07:44 +0000 | [diff] [blame] | 49 | void phonet_address_notify(int event, struct net_device *dev, u8 addr); |
Remi Denis-Courmont | f8ff602 | 2008-09-22 20:03:44 -0700 | [diff] [blame] | 50 | |
Rémi Denis-Courmont | 55748ac | 2009-10-14 00:48:28 +0000 | [diff] [blame] | 51 | int phonet_route_add(struct net_device *dev, u8 daddr); |
| 52 | int phonet_route_del(struct net_device *dev, u8 daddr); |
Rémi Denis-Courmont | f062f41 | 2009-10-14 00:48:29 +0000 | [diff] [blame] | 53 | void rtm_phonet_notify(int event, struct net_device *dev, u8 dst); |
Eric Dumazet | e67f88d | 2011-04-27 22:56:07 +0000 | [diff] [blame] | 54 | struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr); |
Rémi Denis-Courmont | 55748ac | 2009-10-14 00:48:28 +0000 | [diff] [blame] | 55 | struct net_device *phonet_route_output(struct net *net, u8 daddr); |
| 56 | |
Remi Denis-Courmont | f8ff602 | 2008-09-22 20:03:44 -0700 | [diff] [blame] | 57 | #define PN_NO_ADDR 0xff |
| 58 | |
Rémi Denis-Courmont | c1dc13e | 2009-07-21 01:57:57 +0000 | [diff] [blame] | 59 | extern const struct file_operations pn_sock_seq_fops; |
Rémi Denis-Courmont | 507215f | 2010-09-15 12:30:14 +0000 | [diff] [blame] | 60 | extern const struct file_operations pn_res_seq_fops; |
Rémi Denis-Courmont | c1dc13e | 2009-07-21 01:57:57 +0000 | [diff] [blame] | 61 | |
Remi Denis-Courmont | f8ff602 | 2008-09-22 20:03:44 -0700 | [diff] [blame] | 62 | #endif |