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

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * Lec arp cache
  3.  * Marko Kiiskila carnil@cs.tut.fi
  4.  *
  5.  */
  6. #ifndef _LEC_ARP_H
  7. #define _LEC_ARP_H
  8. #include <linux/atm.h>
  9. #include <linux/atmdev.h>
  10. #include <linux/if_ether.h>
  11. #include <linux/atmlec.h>
  12. struct lec_arp_table {
  13.         struct lec_arp_table *next;          /* Linked entry list */
  14.         unsigned char atm_addr[ATM_ESA_LEN]; /* Atm address */
  15.         unsigned char mac_addr[ETH_ALEN];    /* Mac address */
  16.         int is_rdesc;                        /* Mac address is a route descriptor */
  17.         struct atm_vcc *vcc;                 /* Vcc this entry is attached */
  18.         struct atm_vcc *recv_vcc;            /* Vcc we receive data from */
  19.         void (*old_push)(struct atm_vcc *vcc,struct sk_buff *skb); 
  20.                                              /* Push that leads to daemon */
  21.         void (*old_recv_push)(struct atm_vcc *vcc, struct sk_buff *skb);
  22.                                              /* Push that leads to daemon */
  23.         void (*old_close)(struct atm_vcc *vcc);
  24.                                              /* We want to see when this
  25.                                               * vcc gets closed */
  26.         unsigned long last_used;             /* For expiry */
  27.         unsigned long timestamp;             /* Used for various timestamping
  28.                                               * things:
  29.                                               * 1. FLUSH started 
  30.                                               *    (status=ESI_FLUSH_PENDING)
  31.                                               * 2. Counting to 
  32.                                               *    max_unknown_frame_time
  33.                                               *    (status=ESI_ARP_PENDING||
  34.                                               *     status=ESI_VC_PENDING)
  35.                                               */
  36.         unsigned char no_tries;              /* No of times arp retry has been 
  37.                                                 tried */
  38.         unsigned char status;                /* Status of this entry */
  39.         unsigned short flags;                /* Flags for this entry */
  40.         unsigned short packets_flooded;      /* Data packets flooded */
  41.         unsigned long flush_tran_id;         /* Transaction id in flush protocol */
  42.         struct timer_list timer;             /* Arping timer */
  43.         struct lec_priv *priv;               /* Pointer back */
  44.         u8  *tlvs;             /* LANE2: Each MAC address can have TLVs    */
  45.         u32 sizeoftlvs;        /* associated with it. sizeoftlvs tells the */
  46.                                /* the length of the tlvs array             */
  47.         struct sk_buff_head tx_wait; /* wait queue for outgoing packets    */
  48. };
  49. struct tlv {                   /* LANE2: Template tlv struct for accessing */
  50.                                /* the tlvs in the lec_arp_table->tlvs array*/
  51.         u32 type;
  52.         u8  length;
  53.         u8  value[255];
  54. };
  55. /* Status fields */
  56. #define ESI_UNKNOWN 0       /*
  57.                              * Next packet sent to this mac address
  58.                              * causes ARP-request to be sent 
  59.                              */
  60. #define ESI_ARP_PENDING 1   /*
  61.                              * There is no ATM address associated with this
  62.                              * 48-bit address.  The LE-ARP protocol is in
  63.                              * progress.
  64.                              */
  65. #define ESI_VC_PENDING 2    /*
  66.                              * There is a valid ATM address associated with 
  67.                              * this 48-bit address but there is no VC set 
  68.                              * up to that ATM address.  The signaling 
  69.                              * protocol is in process.
  70.                              */
  71. #define ESI_FLUSH_PENDING 4 /*
  72.                              * The LEC has been notified of the FLUSH_START
  73.                              * status and it is assumed that the flush 
  74.                              * protocol is in process.
  75.                              */
  76. #define ESI_FORWARD_DIRECT 5 /*
  77.                               * Either the Path Switching Delay (C22) has 
  78.                               * elapsed or the LEC has notified the Mapping 
  79.                               * that the flush protocol has completed.  In 
  80.                               * either case, it is safe to forward packets 
  81.                               * to this address via the data direct VC.
  82.                               */
  83. /* Flag values */
  84. #define LEC_REMOTE_FLAG      0x0001
  85. #define LEC_PERMANENT_FLAG   0x0002
  86. /* Protos */
  87. void lec_arp_init(struct lec_priv *priv);
  88. int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc);
  89. void lec_arp_destroy(struct lec_priv *priv);
  90. void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc);
  91. struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
  92.                                 unsigned char *mac_to_addr,
  93.                                 int is_rdesc,
  94.                                 struct lec_arp_table **ret_entry);
  95. void lec_vcc_added(struct lec_priv *dev,
  96.                    struct atmlec_ioc *ioc_data, struct atm_vcc *vcc,
  97.                    void (*old_push)(struct atm_vcc *vcc, struct sk_buff *skb));
  98. void lec_arp_check_empties(struct lec_priv *priv,
  99.                            struct atm_vcc *vcc, struct sk_buff *skb);
  100. int lec_addr_delete(struct lec_priv *priv,
  101.                     unsigned char *mac_addr, unsigned long permanent);
  102. void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id);
  103. void lec_arp_update(struct lec_priv *priv,
  104.                     unsigned char *mac_addr, unsigned char *atm_addr,
  105.                     unsigned long remoteflag, unsigned int targetless_le_arp);
  106. void lec_set_flush_tran_id(struct lec_priv *priv,
  107.                            unsigned char *mac_addr, unsigned long tran_id);
  108. #endif