Home | History | Annotate | Line # | Download | only in mrouted
defs.h revision 1.1
      1 /*
      2  * The mrouted program is covered by the license in the accompanying file
      3  * named "LICENSE".  Use of the mrouted program represents acceptance of
      4  * the terms and conditions listed in that file.
      5  *
      6  * The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
      7  * Leland Stanford Junior University.
      8  *
      9  *
     10  * $Id: defs.h,v 1.1 1994/01/11 20:15:50 brezak Exp $
     11  */
     12 
     13 
     14 #include <stdio.h>
     15 #include <ctype.h>
     16 #include <errno.h>
     17 #include <syslog.h>
     18 #include <signal.h>
     19 #include <sys/param.h>
     20 #include <sys/socket.h>
     21 #include <sys/ioctl.h>
     22 #include <net/if.h>
     23 #include <netinet/in.h>
     24 #include <netinet/in_systm.h>
     25 #include <netinet/ip.h>
     26 #include <netinet/igmp.h>
     27 #include <netinet/ip_mroute.h>
     28 
     29 #include "dvmrp.h"
     30 #include "vif.h"
     31 #include "route.h"
     32 #include "pathnames.h"
     33 
     34 /*
     35  * Miscellaneous constants and macros.
     36  */
     37 #define FALSE		0
     38 #define TRUE		1
     39 
     40 #define EQUAL(s1, s2)	(strcmp((s1), (s2)) == 0)
     41 
     42 #define TIMER_INTERVAL	ROUTE_MAX_REPORT_DELAY
     43 
     44 #define PROTOCOL_VERSION 2  /* increment when packet format/content changes */
     45 
     46 #define MROUTED_VERSION  0  /* increment on local changes or bug fixes, */
     47 			    /* reset to 0 whever PROTOCOL_VERSION increments */
     48 
     49 #define MROUTED_LEVEL ( (MROUTED_VERSION << 8) | PROTOCOL_VERSION )
     50 			    /* for IGMP 'group' field of DVMRP messages */
     51 
     52 /*
     53  * External declarations for global variables and functions.
     54  */
     55 extern char		recv_buf[MAX_IP_PACKET_LEN];
     56 extern char		send_buf[MAX_IP_PACKET_LEN];
     57 extern int		igmp_socket;
     58 extern u_long		allhosts_group;
     59 extern u_long		dvmrp_group;
     60 
     61 #define DEFAULT_DEBUG  2	/* default if "-d" given without value */
     62 
     63 extern int		debug;
     64 
     65 extern int		routes_changed;
     66 extern int		delay_change_reports;
     67 
     68 extern struct uvif	uvifs[MAXVIFS];
     69 extern vifi_t		numvifs;
     70 extern int		vifs_down;
     71 extern int		udp_socket;
     72 
     73 extern char		s1[];
     74 extern char		s2[];
     75 extern char		s3[];
     76 
     77 #ifndef __NetBSD__
     78 extern int		errno;
     79 extern int		sys_nerr;
     80 extern char *		sys_errlist[];
     81 #endif
     82 
     83 extern void		log();
     84 
     85 extern void		init_igmp();
     86 extern void		accept_igmp();
     87 extern void		send_igmp();
     88 
     89 extern void		init_routes();
     90 extern void		start_route_updates();
     91 extern void		update_route();
     92 extern void		age_routes();
     93 extern void		expire_all_routes();
     94 extern void		accept_probe();
     95 extern void		accept_report();
     96 extern void		report();
     97 extern void		report_to_all_neighbors();
     98 extern void		add_vif_to_routes();
     99 extern void		delete_vif_from_routes();
    100 extern void		delete_neighbor_from_routes();
    101 extern void		dump_routes();
    102 
    103 extern void		init_vifs();
    104 extern void		check_vif_state();
    105 extern vifi_t		find_vif();
    106 extern void		age_vifs();
    107 extern void		dump_vifs();
    108 extern void		accept_group_report();
    109 extern void		query_groups();
    110 extern void		probe_for_neighbors();
    111 extern int		update_neighbor();
    112 extern void		accept_neighbor_request();
    113 
    114 extern void		config_vifs_from_kernel();
    115 extern void		config_vifs_from_file();
    116 
    117 extern int		inet_valid_host();
    118 extern int		inet_valid_subnet();
    119 extern char *		inet_fmt();
    120 extern char *		inet_fmts();
    121 extern u_long		inet_parse();
    122 extern int		inet_cksum();
    123 
    124 extern char *		malloc();
    125 extern char *		fgets();
    126 extern FILE *		fopen();
    127 
    128 #ifndef htonl
    129 extern u_long		htonl();
    130 extern u_long		ntohl();
    131 #endif
    132