]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - include/net/irda/discovery.h
Merge tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee139...
[mirror_ubuntu-zesty-kernel.git] / include / net / irda / discovery.h
1 /*********************************************************************
2 *
3 * Filename: discovery.h
4 * Version:
5 * Description:
6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Tue Apr 6 16:53:53 1999
9 * Modified at: Tue Oct 5 10:05:10 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 *
12 * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
13 * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see <http://www.gnu.org/licenses/>.
27 *
28 ********************************************************************/
29
30 #ifndef DISCOVERY_H
31 #define DISCOVERY_H
32
33 #include <asm/param.h>
34
35 #include <net/irda/irda.h>
36 #include <net/irda/irqueue.h> /* irda_queue_t */
37 #include <net/irda/irlap_event.h> /* LAP_REASON */
38
39 #define DISCOVERY_EXPIRE_TIMEOUT (2*sysctl_discovery_timeout*HZ)
40 #define DISCOVERY_DEFAULT_SLOTS 0
41
42 /*
43 * This type is used by the protocols that transmit 16 bits words in
44 * little endian format. A little endian machine stores MSB of word in
45 * byte[1] and LSB in byte[0]. A big endian machine stores MSB in byte[0]
46 * and LSB in byte[1].
47 *
48 * This structure is used in the code for things that are endian neutral
49 * but that fit in a word so that we can manipulate them efficiently.
50 * By endian neutral, I mean things that are really an array of bytes,
51 * and always used as such, for example the hint bits. Jean II
52 */
53 typedef union {
54 __u16 word;
55 __u8 byte[2];
56 } __u16_host_order;
57
58 /* Types of discovery */
59 typedef enum {
60 DISCOVERY_LOG, /* What's in our discovery log */
61 DISCOVERY_ACTIVE, /* Doing our own discovery on the medium */
62 DISCOVERY_PASSIVE, /* Peer doing discovery on the medium */
63 EXPIRY_TIMEOUT, /* Entry expired due to timeout */
64 } DISCOVERY_MODE;
65
66 #define NICKNAME_MAX_LEN 21
67
68 /* Basic discovery information about a peer */
69 typedef struct irda_device_info discinfo_t; /* linux/irda.h */
70
71 /*
72 * The DISCOVERY structure is used for both discovery requests and responses
73 */
74 typedef struct discovery_t {
75 irda_queue_t q; /* Must be first! */
76
77 discinfo_t data; /* Basic discovery information */
78 int name_len; /* Length of nickname */
79
80 LAP_REASON condition; /* More info about the discovery */
81 int gen_addr_bit; /* Need to generate a new device
82 * address? */
83 int nslots; /* Number of slots to use when
84 * discovering */
85 unsigned long timestamp; /* Last time discovered */
86 unsigned long firststamp; /* First time discovered */
87 } discovery_t;
88
89 void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *discovery);
90 void irlmp_add_discovery_log(hashbin_t *cachelog, hashbin_t *log);
91 void irlmp_expire_discoveries(hashbin_t *log, __u32 saddr, int force);
92 struct irda_device_info *irlmp_copy_discoveries(hashbin_t *log, int *pn,
93 __u16 mask, int old_entries);
94
95 #endif