File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / quagga / ospfd / ospfd.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 17:26:12 2012 UTC (12 years, 4 months ago) by misho
Branches: quagga, MAIN
CVS tags: v0_99_21, v0_99_20_1, v0_99_20, HEAD
quagga

    1: /*
    2:  * OSPFd main header.
    3:  * Copyright (C) 1998, 99, 2000 Kunihiro Ishiguro, Toshiaki Takada
    4:  *
    5:  * This file is part of GNU Zebra.
    6:  *
    7:  * GNU Zebra is free software; you can redistribute it and/or modify it
    8:  * under the terms of the GNU General Public License as published by the
    9:  * Free Software Foundation; either version 2, or (at your option) any
   10:  * later version.
   11:  * 
   12:  * GNU Zebra 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 GNU Zebra; see the file COPYING.  If not, write to the Free
   19:  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   20:  * 02111-1307, USA.
   21:  */
   22: 
   23: #ifndef _ZEBRA_OSPFD_H
   24: #define _ZEBRA_OSPFD_H
   25: 
   26: #include <zebra.h>
   27: 
   28: #include "filter.h"
   29: #include "log.h"
   30: 
   31: #define OSPF_VERSION            2
   32: 
   33: /* Default protocol, port number. */
   34: #ifndef IPPROTO_OSPFIGP
   35: #define IPPROTO_OSPFIGP         89
   36: #endif /* IPPROTO_OSPFIGP */
   37: 
   38: /* IP precedence. */
   39: #ifndef IPTOS_PREC_INTERNETCONTROL
   40: #define IPTOS_PREC_INTERNETCONTROL	0xC0
   41: #endif /* IPTOS_PREC_INTERNETCONTROL */
   42: 
   43: /* VTY port number. */
   44: #define OSPF_VTY_PORT          2604
   45: 
   46: /* IP TTL for OSPF protocol. */
   47: #define OSPF_IP_TTL             1
   48: #define OSPF_VL_IP_TTL          100
   49: 
   50: /* Default configuration file name for ospfd. */
   51: #define OSPF_DEFAULT_CONFIG   "ospfd.conf"
   52: 
   53: /* Architectual Constants */
   54: #ifdef DEBUG
   55: #define OSPF_LS_REFRESH_TIME                    60
   56: #else
   57: #define OSPF_LS_REFRESH_TIME                  1800
   58: #endif
   59: #define OSPF_MIN_LS_INTERVAL                     5
   60: #define OSPF_MIN_LS_ARRIVAL                      1
   61: #define OSPF_LSA_INITIAL_AGE                     0	/* useful for debug */
   62: #define OSPF_LSA_MAXAGE                       3600
   63: #define OSPF_CHECK_AGE                         300
   64: #define OSPF_LSA_MAXAGE_DIFF                   900
   65: #define OSPF_LS_INFINITY                  0xffffff
   66: #define OSPF_DEFAULT_DESTINATION        0x00000000      /* 0.0.0.0 */
   67: #define OSPF_INITIAL_SEQUENCE_NUMBER    0x80000001
   68: #define OSPF_MAX_SEQUENCE_NUMBER        0x7fffffff
   69: 
   70: #define OSPF_NSSA_TRANS_STABLE_DEFAULT		40
   71: 
   72: #define OSPF_ALLSPFROUTERS              0xe0000005      /* 224.0.0.5 */
   73: #define OSPF_ALLDROUTERS                0xe0000006      /* 224.0.0.6 */
   74: 
   75: #define OSPF_AREA_BACKBONE              0x00000000      /* 0.0.0.0 */
   76: 
   77: /* OSPF Authentication Type. */
   78: #define OSPF_AUTH_NULL                      0
   79: #define OSPF_AUTH_SIMPLE                    1
   80: #define OSPF_AUTH_CRYPTOGRAPHIC             2
   81: /* For Interface authentication setting default */
   82: #define OSPF_AUTH_NOTSET                   -1
   83: /* For the consumption and sanity of the command handler */ 
   84: /* DO NIOT REMOVE!!! Need to detect whether a value has
   85:    been given or not in VLink command handlers */
   86: #define OSPF_AUTH_CMD_NOTSEEN              -2
   87: 
   88: /* OSPF SPF timer values. */
   89: #define OSPF_SPF_DELAY_DEFAULT              200
   90: #define OSPF_SPF_HOLDTIME_DEFAULT           1000
   91: #define OSPF_SPF_MAX_HOLDTIME_DEFAULT	    10000
   92: 
   93: /* OSPF interface default values. */
   94: #define OSPF_OUTPUT_COST_DEFAULT           10
   95: #define OSPF_OUTPUT_COST_INFINITE	   UINT16_MAX
   96: #define OSPF_ROUTER_DEAD_INTERVAL_DEFAULT  40
   97: #define OSPF_ROUTER_DEAD_INTERVAL_MINIMAL   1
   98: #define OSPF_HELLO_INTERVAL_DEFAULT        10
   99: #define OSPF_ROUTER_PRIORITY_DEFAULT        1
  100: #define OSPF_RETRANSMIT_INTERVAL_DEFAULT    5
  101: #define OSPF_TRANSMIT_DELAY_DEFAULT         1
  102: #define OSPF_DEFAULT_BANDWIDTH		 10000	/* Kbps */
  103: 
  104: #define OSPF_DEFAULT_REF_BANDWIDTH	100000  /* Kbps */
  105: 
  106: #define OSPF_POLL_INTERVAL_DEFAULT         60
  107: #define OSPF_NEIGHBOR_PRIORITY_DEFAULT      0
  108: 
  109: #define OSPF_MTU_IGNORE_DEFAULT             0
  110: #define OSPF_FAST_HELLO_DEFAULT             0
  111: 
  112: /* OSPF options. */
  113: #define OSPF_OPTION_T                    0x01  /* TOS. */
  114: #define OSPF_OPTION_E                    0x02
  115: #define OSPF_OPTION_MC                   0x04
  116: #define OSPF_OPTION_NP                   0x08
  117: #define OSPF_OPTION_EA                   0x10
  118: #define OSPF_OPTION_DC                   0x20
  119: #define OSPF_OPTION_O                    0x40
  120: 
  121: /* OSPF Database Description flags. */
  122: #define OSPF_DD_FLAG_MS                  0x01
  123: #define OSPF_DD_FLAG_M                   0x02
  124: #define OSPF_DD_FLAG_I                   0x04
  125: #define OSPF_DD_FLAG_ALL                 0x07
  126: 
  127: #define OSPF_LS_REFRESH_SHIFT       (60 * 15)
  128: #define OSPF_LS_REFRESH_JITTER      60
  129: 
  130: /* OSPF master for system wide configuration and variables. */
  131: struct ospf_master
  132: {
  133:   /* OSPF instance. */
  134:   struct list *ospf;
  135: 
  136:   /* OSPF thread master. */
  137:   struct thread_master *master;
  138: 
  139:   /* Zebra interface list. */
  140:   struct list *iflist;
  141: 
  142:   /* Redistributed external information. */
  143:   struct route_table *external_info[ZEBRA_ROUTE_MAX + 1];
  144: #define EXTERNAL_INFO(T)      om->external_info[T]
  145: 
  146:   /* OSPF start time. */
  147:   time_t start_time;
  148: 
  149:   /* Various OSPF global configuration. */
  150:   u_char options;
  151: #define OSPF_MASTER_SHUTDOWN (1 << 0) /* deferred-shutdown */  
  152: };
  153: 
  154: /* OSPF instance structure. */
  155: struct ospf
  156: {
  157:   /* OSPF Router ID. */
  158:   struct in_addr router_id;		/* Configured automatically. */
  159:   struct in_addr router_id_static;	/* Configured manually. */
  160: 
  161:   /* ABR/ASBR internal flags. */
  162:   u_char flags;
  163: #define OSPF_FLAG_ABR           0x0001
  164: #define OSPF_FLAG_ASBR          0x0002
  165: 
  166:   /* ABR type. */
  167:   u_char abr_type;
  168: #define OSPF_ABR_UNKNOWN	0
  169: #define OSPF_ABR_STAND          1
  170: #define OSPF_ABR_IBM            2
  171: #define OSPF_ABR_CISCO          3
  172: #define OSPF_ABR_SHORTCUT       4
  173: #define OSPF_ABR_DEFAULT	OSPF_ABR_CISCO
  174: 
  175:   /* NSSA ABR */
  176:   u_char anyNSSA;		/* Bump for every NSSA attached. */
  177: 
  178:   /* Configured variables. */
  179:   u_char config;
  180: #define OSPF_RFC1583_COMPATIBLE         (1 << 0)
  181: #define OSPF_OPAQUE_CAPABLE		(1 << 2)
  182: #define OSPF_LOG_ADJACENCY_CHANGES	(1 << 3)
  183: #define OSPF_LOG_ADJACENCY_DETAIL	(1 << 4)
  184: 
  185: #ifdef HAVE_OPAQUE_LSA
  186:   /* Opaque-LSA administrative flags. */
  187:   u_char opaque;
  188: #define OPAQUE_OPERATION_READY_BIT	(1 << 0)
  189: #define OPAQUE_BLOCK_TYPE_09_LSA_BIT	(1 << 1)
  190: #define OPAQUE_BLOCK_TYPE_10_LSA_BIT	(1 << 2)
  191: #define OPAQUE_BLOCK_TYPE_11_LSA_BIT	(1 << 3)
  192: #endif /* HAVE_OPAQUE_LSA */
  193: 
  194:   /* RFC3137 stub router. Configured time to stay stub / max-metric */
  195:   unsigned int stub_router_startup_time;	/* seconds */
  196:   unsigned int stub_router_shutdown_time;	/* seconds */
  197: #define OSPF_STUB_ROUTER_UNCONFIGURED	  0
  198: 
  199:   /* SPF parameters */
  200:   unsigned int spf_delay;		/* SPF delay time. */
  201:   unsigned int spf_holdtime;		/* SPF hold time. */
  202:   unsigned int spf_max_holdtime;	/* SPF maximum-holdtime */
  203:   unsigned int spf_hold_multiplier;	/* Adaptive multiplier for hold time */
  204:   
  205:   int default_originate;		/* Default information originate. */
  206: #define DEFAULT_ORIGINATE_NONE		0
  207: #define DEFAULT_ORIGINATE_ZEBRA		1
  208: #define DEFAULT_ORIGINATE_ALWAYS	2
  209:   u_int32_t ref_bandwidth;		/* Reference Bandwidth (Kbps). */
  210:   struct route_table *networks;         /* OSPF config networks. */
  211:   struct list *vlinks;                  /* Configured Virtual-Links. */
  212:   struct list *areas;                   /* OSPF areas. */
  213:   struct route_table *nbr_nbma;
  214:   struct ospf_area *backbone;           /* Pointer to the Backbone Area. */
  215: 
  216:   struct list *oiflist;                 /* ospf interfaces */
  217:   u_char passive_interface_default;	/* passive-interface default */
  218: 
  219:   /* LSDB of AS-external-LSAs. */
  220:   struct ospf_lsdb *lsdb;
  221:   
  222:   /* Flags. */
  223:   int external_origin;			/* AS-external-LSA origin flag. */
  224:   int ase_calc;				/* ASE calculation flag. */
  225: 
  226: #ifdef HAVE_OPAQUE_LSA
  227:   struct list *opaque_lsa_self;		/* Type-11 Opaque-LSAs */
  228: #endif /* HAVE_OPAQUE_LSA */
  229: 
  230:   /* Routing tables. */
  231:   struct route_table *old_table;        /* Old routing table. */
  232:   struct route_table *new_table;        /* Current routing table. */
  233: 
  234:   struct route_table *old_rtrs;         /* Old ABR/ASBR RT. */
  235:   struct route_table *new_rtrs;         /* New ABR/ASBR RT. */
  236: 
  237:   struct route_table *new_external_route;   /* New External Route. */
  238:   struct route_table *old_external_route;   /* Old External Route. */
  239:   
  240:   struct route_table *external_lsas;    /* Database of external LSAs,
  241: 					   prefix is LSA's adv. network*/
  242: 
  243:   /* Time stamps. */
  244:   struct timeval ts_spf;		/* SPF calculation time stamp. */
  245: 
  246:   struct list *maxage_lsa;              /* List of MaxAge LSA for deletion. */
  247:   int redistribute;                     /* Num of redistributed protocols. */
  248: 
  249:   /* Threads. */
  250:   struct thread *t_abr_task;            /* ABR task timer. */
  251:   struct thread *t_asbr_check;          /* ASBR check timer. */
  252:   struct thread *t_distribute_update;   /* Distirbute list update timer. */
  253:   struct thread *t_spf_calc;	        /* SPF calculation timer. */
  254:   struct thread *t_ase_calc;		/* ASE calculation timer. */
  255:   struct thread *t_external_lsa;	/* AS-external-LSA origin timer. */
  256: #ifdef HAVE_OPAQUE_LSA
  257:   struct thread *t_opaque_lsa_self;	/* Type-11 Opaque-LSAs origin event. */
  258: #endif /* HAVE_OPAQUE_LSA */
  259: 
  260: #define OSFP_LSA_MAXAGE_REMOVE_DELAY_DEFAULT	60
  261:   unsigned int maxage_delay;		/* Delay on Maxage remover timer, sec */
  262:   struct thread *t_maxage;              /* MaxAge LSA remover timer. */
  263: #define OSPF_LSA_MAXAGE_CHECK_INTERVAL		30
  264:   struct thread *t_maxage_walker;       /* MaxAge LSA checking timer. */
  265: 
  266:   struct thread *t_deferred_shutdown;	/* deferred/stub-router shutdown timer*/
  267: 
  268:   struct thread *t_write;
  269:   struct thread *t_read;
  270:   int fd;
  271:   int maxsndbuflen;
  272:   struct stream *ibuf;
  273:   struct list *oi_write_q;
  274:   
  275:   /* Distribute lists out of other route sources. */
  276:   struct 
  277:   {
  278:     char *name;
  279:     struct access_list *list;
  280:   } dlist[ZEBRA_ROUTE_MAX];
  281: #define DISTRIBUTE_NAME(O,T)    (O)->dlist[T].name
  282: #define DISTRIBUTE_LIST(O,T)    (O)->dlist[T].list
  283: 
  284:   /* Redistribute metric info. */
  285:   struct 
  286:   {
  287:     int type;                   /* External metric type (E1 or E2).  */
  288:     int value;		        /* Value for static metric (24-bit).
  289: 				   -1 means metric value is not set. */
  290:   } dmetric [ZEBRA_ROUTE_MAX + 1];
  291: 
  292:   /* For redistribute route map. */
  293:   struct
  294:   {
  295:     char *name;
  296:     struct route_map *map;
  297:   } route_map [ZEBRA_ROUTE_MAX + 1]; /* +1 is for default-information */
  298: #define ROUTEMAP_NAME(O,T)   (O)->route_map[T].name
  299: #define ROUTEMAP(O,T)        (O)->route_map[T].map
  300:   
  301:   int default_metric;		/* Default metric for redistribute. */
  302: 
  303: #define OSPF_LSA_REFRESHER_GRANULARITY 10
  304: #define OSPF_LSA_REFRESHER_SLOTS ((OSPF_LS_REFRESH_TIME + \
  305:                                   OSPF_LS_REFRESH_SHIFT)/10 + 1)
  306:   struct
  307:   {
  308:     u_int16_t index;
  309:     struct list *qs[OSPF_LSA_REFRESHER_SLOTS];
  310:   } lsa_refresh_queue;
  311:   
  312:   struct thread *t_lsa_refresher;
  313:   time_t lsa_refresher_started;
  314: #define OSPF_LSA_REFRESH_INTERVAL_DEFAULT 10
  315:   u_int16_t lsa_refresh_interval;
  316:   
  317:   /* Distance parameter. */
  318:   u_char distance_all;
  319:   u_char distance_intra;
  320:   u_char distance_inter;
  321:   u_char distance_external;
  322: 
  323:   /* Statistics for LSA origination. */
  324:   u_int32_t lsa_originate_count;
  325: 
  326:   /* Statistics for LSA used for new instantiation. */
  327:   u_int32_t rx_lsa_count;
  328:  
  329:   struct route_table *distance_table;
  330: };
  331: 
  332: /* OSPF area structure. */
  333: struct ospf_area
  334: {
  335:   /* OSPF instance. */
  336:   struct ospf *ospf;
  337: 
  338:   /* Zebra interface list belonging to the area. */
  339:   struct list *oiflist;
  340: 
  341:   /* Area ID. */
  342:   struct in_addr area_id;
  343: 
  344:   /* Area ID format. */
  345:   char format;
  346: #define OSPF_AREA_ID_FORMAT_ADDRESS         1
  347: #define OSPF_AREA_ID_FORMAT_DECIMAL         2
  348: 
  349:   /* Address range. */
  350:   struct list *address_range;
  351: 
  352:   /* Configured variables. */
  353:   int external_routing;                 /* ExternalRoutingCapability. */
  354: #define OSPF_AREA_DEFAULT       0
  355: #define OSPF_AREA_STUB          1
  356: #define OSPF_AREA_NSSA          2
  357: #define OSPF_AREA_TYPE_MAX	3
  358:   int no_summary;                       /* Don't inject summaries into stub.*/
  359:   int shortcut_configured;              /* Area configured as shortcut. */
  360: #define OSPF_SHORTCUT_DEFAULT	0
  361: #define OSPF_SHORTCUT_ENABLE	1
  362: #define OSPF_SHORTCUT_DISABLE	2
  363:   int shortcut_capability;              /* Other ABRs agree on S-bit */
  364:   u_int32_t default_cost;               /* StubDefaultCost. */
  365:   int auth_type;                        /* Authentication type. */
  366:   
  367: 
  368:   u_char NSSATranslatorRole;          /* NSSA configured role */
  369: #define OSPF_NSSA_ROLE_NEVER     0
  370: #define OSPF_NSSA_ROLE_CANDIDATE 1
  371: #define OSPF_NSSA_ROLE_ALWAYS    2
  372:   u_char NSSATranslatorState;              /* NSSA operational role */
  373: #define OSPF_NSSA_TRANSLATE_DISABLED 0
  374: #define OSPF_NSSA_TRANSLATE_ENABLED  1
  375:   int NSSATranslatorStabilityInterval;
  376:   
  377:   u_char transit;			/* TransitCapability. */
  378: #define OSPF_TRANSIT_FALSE      0
  379: #define OSPF_TRANSIT_TRUE       1
  380:   struct route_table *ranges;		/* Configured Area Ranges. */
  381:   
  382:   /* RFC3137 stub router state flags for area */
  383:   u_char stub_router_state;
  384: #define OSPF_AREA_ADMIN_STUB_ROUTED	(1 << 0) /* admin stub-router set */
  385: #define OSPF_AREA_IS_STUB_ROUTED	(1 << 1) /* stub-router active */
  386: #define OSPF_AREA_WAS_START_STUB_ROUTED	(1 << 2) /* startup SR was done */
  387:   
  388:   /* Area related LSDBs[Type1-4]. */
  389:   struct ospf_lsdb *lsdb;
  390: 
  391:   /* Self-originated LSAs. */
  392:   struct ospf_lsa *router_lsa_self;
  393: #ifdef HAVE_OPAQUE_LSA
  394:   struct list *opaque_lsa_self;		/* Type-10 Opaque-LSAs */
  395: #endif /* HAVE_OPAQUE_LSA */
  396: 
  397:   /* Area announce list. */
  398:   struct 
  399:   {
  400:     char *name;
  401:     struct access_list *list;
  402:   } _export;
  403: #define EXPORT_NAME(A)  (A)->_export.name
  404: #define EXPORT_LIST(A)  (A)->_export.list
  405: 
  406:   /* Area acceptance list. */
  407:   struct 
  408:   {
  409:     char *name;
  410:     struct access_list *list;
  411:   } import;
  412: #define IMPORT_NAME(A)  (A)->import.name
  413: #define IMPORT_LIST(A)  (A)->import.list
  414: 
  415:   /* Type 3 LSA Area prefix-list. */
  416:   struct 
  417:   {
  418:     char *name;
  419:     struct prefix_list *list;
  420:   } plist_in;
  421: #define PREFIX_LIST_IN(A)   (A)->plist_in.list
  422: #define PREFIX_NAME_IN(A)   (A)->plist_in.name
  423: 
  424:   struct
  425:   {
  426:     char *name;
  427:     struct prefix_list *list;
  428:   } plist_out;
  429: #define PREFIX_LIST_OUT(A)  (A)->plist_out.list
  430: #define PREFIX_NAME_OUT(A)  (A)->plist_out.name
  431: 
  432:   /* Shortest Path Tree. */
  433:   struct vertex *spf;
  434: 
  435:   /* Threads. */
  436:   struct thread *t_stub_router;    /* Stub-router timer */
  437: #ifdef HAVE_OPAQUE_LSA
  438:   struct thread *t_opaque_lsa_self;	/* Type-10 Opaque-LSAs origin. */
  439: #endif /* HAVE_OPAQUE_LSA */
  440: 
  441:   /* Statistics field. */
  442:   u_int32_t spf_calculation;	/* SPF Calculation Count. */
  443: 
  444:   /* Router count. */
  445:   u_int32_t abr_count;		/* ABR router in this area. */
  446:   u_int32_t asbr_count;		/* ASBR router in this area. */
  447: 
  448:   /* Counters. */
  449:   u_int32_t act_ints;		/* Active interfaces. */
  450:   u_int32_t full_nbrs;		/* Fully adjacent neighbors. */
  451:   u_int32_t full_vls;		/* Fully adjacent virtual neighbors. */
  452: };
  453: 
  454: /* OSPF config network structure. */
  455: struct ospf_network
  456: {
  457:   /* Area ID. */
  458:   struct in_addr area_id;
  459:   int format;
  460: };
  461: 
  462: /* OSPF NBMA neighbor structure. */
  463: struct ospf_nbr_nbma
  464: {
  465:   /* Neighbor IP address. */
  466:   struct in_addr addr;
  467: 
  468:   /* OSPF interface. */
  469:   struct ospf_interface *oi;
  470: 
  471:   /* OSPF neighbor structure. */
  472:   struct ospf_neighbor *nbr;
  473: 
  474:   /* Neighbor priority. */
  475:   u_char priority;
  476: 
  477:   /* Poll timer value. */
  478:   u_int32_t v_poll;
  479: 
  480:   /* Poll timer thread. */
  481:   struct thread *t_poll;
  482: 
  483:   /* State change. */
  484:   u_int32_t state_change;
  485: };
  486: 
  487: /* Macro. */
  488: #define OSPF_AREA_SAME(X,Y) \
  489:         (memcmp ((X->area_id), (Y->area_id), IPV4_MAX_BYTELEN) == 0)
  490: 
  491: #define IS_OSPF_ABR(O)		((O)->flags & OSPF_FLAG_ABR)
  492: #define IS_OSPF_ASBR(O)		((O)->flags & OSPF_FLAG_ASBR)
  493: 
  494: #define OSPF_IS_AREA_ID_BACKBONE(I) ((I).s_addr == OSPF_AREA_BACKBONE)
  495: #define OSPF_IS_AREA_BACKBONE(A) OSPF_IS_AREA_ID_BACKBONE ((A)->area_id)
  496: 
  497: #ifdef roundup
  498: #  define ROUNDUP(val, gran)	roundup(val, gran)
  499: #else /* roundup */
  500: #  define ROUNDUP(val, gran)	(((val) - 1 | (gran) - 1) + 1)
  501: #endif /* roundup */
  502: 
  503: #define LSA_OPTIONS_GET(area) \
  504:         (((area)->external_routing == OSPF_AREA_DEFAULT) ? OSPF_OPTION_E : 0)
  505: #define LSA_OPTIONS_NSSA_GET(area) \
  506:         (((area)->external_routing == OSPF_AREA_NSSA)  ? OSPF_OPTION_NP : 0)
  507: 
  508: #define OSPF_TIMER_ON(T,F,V)                                                  \
  509:     do {                                                                      \
  510:       if (!(T))                                                               \
  511: 	(T) = thread_add_timer (master, (F), ospf, (V));                      \
  512:     } while (0)
  513: 
  514: #define OSPF_AREA_TIMER_ON(T,F,V)                                             \
  515:     do {                                                                      \
  516:       if (!(T))                                                               \
  517:         (T) = thread_add_timer (master, (F), area, (V));                      \
  518:     } while (0)
  519: 
  520: #define OSPF_POLL_TIMER_ON(T,F,V)                                             \
  521:     do {                                                                      \
  522:       if (!(T))                                                               \
  523:         (T) = thread_add_timer (master, (F), nbr_nbma, (V));                  \
  524:     } while (0)
  525: 
  526: #define OSPF_POLL_TIMER_OFF(X)		OSPF_TIMER_OFF((X))
  527: 
  528: #define OSPF_TIMER_OFF(X)                                                     \
  529:     do {                                                                      \
  530:       if (X)                                                                  \
  531:         {                                                                     \
  532:           thread_cancel (X);                                                  \
  533:           (X) = NULL;                                                         \
  534:         }                                                                     \
  535:     } while (0)
  536: 
  537: /* Extern variables. */
  538: extern struct ospf_master *om;
  539: extern const struct message ospf_ism_state_msg[];
  540: extern const struct message ospf_nsm_state_msg[];
  541: extern const struct message ospf_lsa_type_msg[];
  542: extern const struct message ospf_link_state_id_type_msg[];
  543: extern const struct message ospf_network_type_msg[];
  544: extern const int ospf_ism_state_msg_max;
  545: extern const int ospf_nsm_state_msg_max;
  546: extern const int ospf_lsa_type_msg_max;
  547: extern const int ospf_link_state_id_type_msg_max;
  548: extern const int ospf_redistributed_proto_max;
  549: extern const int ospf_network_type_msg_max;
  550: extern struct zclient *zclient;
  551: extern struct thread_master *master;
  552: extern int ospf_zlog;
  553: 
  554: /* Prototypes. */
  555: extern const char *ospf_redist_string(u_int route_type);
  556: extern struct ospf *ospf_lookup (void);
  557: extern struct ospf *ospf_get (void);
  558: extern void ospf_finish (struct ospf *);
  559: extern void ospf_router_id_update (struct ospf *ospf);
  560: extern int ospf_network_set (struct ospf *, struct prefix_ipv4 *,
  561: 			     struct in_addr);
  562: extern int ospf_network_unset (struct ospf *, struct prefix_ipv4 *,
  563: 			       struct in_addr);
  564: extern int ospf_area_stub_set (struct ospf *, struct in_addr);
  565: extern int ospf_area_stub_unset (struct ospf *, struct in_addr);
  566: extern int ospf_area_no_summary_set (struct ospf *, struct in_addr);
  567: extern int ospf_area_no_summary_unset (struct ospf *, struct in_addr);
  568: extern int ospf_area_nssa_set (struct ospf *, struct in_addr);
  569: extern int ospf_area_nssa_unset (struct ospf *, struct in_addr);
  570: extern int ospf_area_nssa_translator_role_set (struct ospf *, struct in_addr,
  571: 					       int);
  572: extern int ospf_area_export_list_set (struct ospf *, struct ospf_area *,
  573: 				      const char *);
  574: extern int ospf_area_export_list_unset (struct ospf *, struct ospf_area *);
  575: extern int ospf_area_import_list_set (struct ospf *, struct ospf_area *,
  576: 				      const char *);
  577: extern int ospf_area_import_list_unset (struct ospf *, struct ospf_area *);
  578: extern int ospf_area_shortcut_set (struct ospf *, struct ospf_area *, int);
  579: extern int ospf_area_shortcut_unset (struct ospf *, struct ospf_area *);
  580: extern int ospf_timers_refresh_set (struct ospf *, int);
  581: extern int ospf_timers_refresh_unset (struct ospf *);
  582: extern int ospf_nbr_nbma_set (struct ospf *, struct in_addr);
  583: extern int ospf_nbr_nbma_unset (struct ospf *, struct in_addr);
  584: extern int ospf_nbr_nbma_priority_set (struct ospf *, struct in_addr, u_char);
  585: extern int ospf_nbr_nbma_priority_unset (struct ospf *, struct in_addr);
  586: extern int ospf_nbr_nbma_poll_interval_set (struct ospf *, struct in_addr,
  587: 					    unsigned int);
  588: extern int ospf_nbr_nbma_poll_interval_unset (struct ospf *, struct in_addr);
  589: extern void ospf_prefix_list_update (struct prefix_list *);
  590: extern void ospf_init (void);
  591: extern void ospf_if_update (struct ospf *, struct interface *);
  592: extern void ospf_ls_upd_queue_empty (struct ospf_interface *);
  593: extern void ospf_terminate (void);
  594: extern void ospf_nbr_nbma_if_update (struct ospf *, struct ospf_interface *);
  595: extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup (struct ospf *,
  596: 						   struct in_addr);
  597: extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next (struct ospf *,
  598: 							struct in_addr *,
  599: 							int);
  600: extern int ospf_oi_count (struct interface *);
  601: 
  602: extern struct ospf_area *ospf_area_get (struct ospf *, struct in_addr, int);
  603: extern void ospf_area_check_free (struct ospf *, struct in_addr);
  604: extern struct ospf_area *ospf_area_lookup_by_area_id (struct ospf *,
  605: 						      struct in_addr);
  606: extern void ospf_area_add_if (struct ospf_area *, struct ospf_interface *);
  607: extern void ospf_area_del_if (struct ospf_area *, struct ospf_interface *);
  608: 
  609: extern void ospf_route_map_init (void);
  610: extern void ospf_snmp_init (void);
  611: 
  612: extern void ospf_master_init (void);
  613: 
  614: #endif /* _ZEBRA_OSPFD_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>