discovery.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  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.  *     
  14.  *     This program is free software; you can redistribute it and/or 
  15.  *     modify it under the terms of the GNU General Public License as 
  16.  *     published by the Free Software Foundation; either version 2 of 
  17.  *     the License, or (at your option) any later version.
  18.  * 
  19.  *     This program is distributed in the hope that it will be useful,
  20.  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
  21.  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22.  *     GNU General Public License for more details.
  23.  * 
  24.  *     You should have received a copy of the GNU General Public License 
  25.  *     along with this program; if not, write to the Free Software 
  26.  *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
  27.  *     MA 02111-1307 USA
  28.  *     
  29.  ********************************************************************/
  30. #ifndef DISCOVERY_H
  31. #define DISCOVERY_H
  32. #include <asm/param.h>
  33. #include <net/irda/irda.h>
  34. #include <net/irda/irqueue.h>
  35. #define DISCOVERY_EXPIRE_TIMEOUT (2*sysctl_discovery_timeout*HZ)
  36. #define DISCOVERY_DEFAULT_SLOTS  0
  37. /* Types of discovery */
  38. typedef enum {
  39. DISCOVERY_LOG, /* What's in our discovery log */
  40. DISCOVERY_ACTIVE, /* Doing our own discovery on the medium */
  41. DISCOVERY_PASSIVE, /* Peer doing discovery on the medium */
  42. EXPIRY_TIMEOUT, /* Entry expired due to timeout */
  43. } DISCOVERY_MODE;
  44. #define NICKNAME_MAX_LEN 21
  45. /*
  46.  * The DISCOVERY structure is used for both discovery requests and responses
  47.  */
  48. typedef struct discovery_t {
  49. irda_queue_t q;          /* Must be first! */
  50. __u32      saddr;        /* Which link the device was discovered */
  51. __u32      daddr;        /* Remote device address */
  52. LAP_REASON condition;    /* More info about the discovery */
  53. __u16_host_order hints;  /* Discovery hint bits */
  54. __u8       charset;      /* Encoding of nickname */
  55. char       nickname[22]; /* The name of the device (21 bytes + ) */
  56. int        name_len;     /* Lenght of nickname */
  57. int        gen_addr_bit; /* Need to generate a new device address? */
  58. int        nslots;       /* Number of slots to use when discovering */
  59. unsigned long timestamp; /* Time discovered */
  60. unsigned long first_timestamp; /* First time discovered */
  61. } discovery_t;
  62. void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *discovery);
  63. void irlmp_add_discovery_log(hashbin_t *cachelog, hashbin_t *log);
  64. void irlmp_expire_discoveries(hashbin_t *log, __u32 saddr, int force);
  65. struct irda_device_info *irlmp_copy_discoveries(hashbin_t *log, int *pn, __u16 mask);
  66. #endif