/*
 * IS-IS Rout(e)ing protocol - isis_adjacency.h   
 *                             IS-IS adjacency handling
 *
 * Copyright (C) 2001,2002   Sampo Saaristo
 *                           Tampere University of Technology      
 *                           Institute of Communications Engineering
 *
 *
 * This program is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU General Public Licenseas published by the Free 
 * Software Foundation; either version 2 of the License, or (at your option) 
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
 * more details.

 * You should have received a copy of the GNU General Public License along 
 * with this program; if not, write to the Free Software Foundation, Inc., 
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#ifndef _ZEBRA_ISIS_ADJACENCY_H
#define _ZEBRA_ISIS_ADJACENCY_H

enum isis_adj_usage
{
  ISIS_ADJ_NONE,
  ISIS_ADJ_LEVEL1,
  ISIS_ADJ_LEVEL2,
  ISIS_ADJ_LEVEL1AND2
};

enum isis_system_type 
{
  ISIS_SYSTYPE_UNKNOWN,
  ISIS_SYSTYPE_ES,
  ISIS_SYSTYPE_IS,
  ISIS_SYSTYPE_L1_IS,
  ISIS_SYSTYPE_L2_IS
};

enum isis_adj_state 
{
  ISIS_ADJ_INITIALIZING,
  ISIS_ADJ_UP,
  ISIS_ADJ_DOWN
};

/*
 * we use the following codes to give an indication _why_
 * a specific adjacency is up or down
 */
enum isis_adj_updown_reason
{
  ISIS_ADJ_REASON_SEENSELF,
  ISIS_ADJ_REASON_AREA_MISMATCH,
  ISIS_ADJ_REASON_HOLDTIMER_EXPIRED,
  ISIS_ADJ_REASON_AUTH_FAILED,
  ISIS_ADJ_REASON_CHECKSUM_FAILED
};

#define DIS_RECORDS 8 /* keep the last 8 DIS state changes on record */

struct isis_dis_record {
  int                              dis; /* is our neighbor the DIS ? */          time_t               last_dis_change; /* timestamp for last dis change */
};

struct isis_adjacency{
  u_char snpa[ETH_ALEN];           /* NeighbourSNPAAddress */ 
  u_char sysid[ISIS_SYS_ID_LEN];   /* neighbourSystemIdentifier */
  u_char lanid[ISIS_SYS_ID_LEN+1]; /* LAN id on bcast circuits */
  int dischanges[ISIS_LEVELS];     /* how many DIS changes ?*/ 
  /* an array of N levels for M records */
  struct isis_dis_record  dis_record[DIS_RECORDS * ISIS_LEVELS]; 
  enum isis_adj_state adj_state;  /* adjacencyState */
  enum isis_adj_usage adj_usage;  /* adjacencyUsage */
  struct list *area_addrs;        /* areaAdressesOfNeighbour */
  struct nlpids nlpids;           /* protocols spoken ... */
  struct list *ipv4_addrs;
#ifdef HAVE_IPV6
  struct list *ipv6_addrs;
#endif /* HAVE_IPV6 */
  u_char prio[ISIS_LEVELS];        /* priorityOfNeighbour for DIS*/
  int circuit_t;                   /* from hello PDU hdr */
  int level;                       /* level (1 or 2) */
  enum  isis_system_type sys_type; /* neighbourSystemType */
  u_int16_t hold_time;             /* entryRemainingTime */
  u_int32_t last_upd;
  u_int32_t last_flap;             /* last time the adj flapped */
  int flaps;                       /* number of adjacency flaps  */
  struct thread *t_expire;         /* expire after hold_time  */
  struct isis_circuit *circuit;    /* back pointer */     
};


struct isis_adjacency *isis_adj_lookup (u_char *sysid, struct list *adjdb);
struct isis_adjacency *isis_adj_lookup_snpa (u_char *ssnpa, 
					     struct list *adjdb);
struct isis_adjacency *isis_new_adj (u_char *id, u_char *snpa, int level, 
                                     struct isis_circuit *circuit); 
void isis_delete_adj (struct isis_adjacency *adj, struct list *adjdb); 
void isis_adj_state_change (struct isis_adjacency *adj, 
                            enum isis_adj_state state, char *reason); 
void isis_adj_print (struct isis_adjacency *adj); 
int  isis_adj_expire (struct thread *thread);
void isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty);
void isis_adj_print_vty_detail (struct isis_adjacency *adj, struct vty *vty);
void isis_adj_print_vty_extensive (struct isis_adjacency *adj, 
                                   struct vty *vty);
void isis_adj_p2p_print_vty (struct isis_adjacency *adj, struct vty *vty);
void isis_adj_p2p_print_vty_detail (struct isis_adjacency *adj, 
                                    struct vty *vty);
void isis_adj_p2p_print_vty_extensive (struct isis_adjacency *adj, 
                                       struct vty *vty);

void isis_adj_build_neigh_list (struct list *adjdb, struct list *list);
void isis_adj_build_up_list (struct list *adjdb, struct list *list);
void isis_adjdb_iterate (struct list *adjdb, 
                         void (*func)(struct isis_adjacency*, 
                                      void *), void *arg);

#endif /* ISIS_ADJACENCY_H */

