summaryrefslogtreecommitdiff
path: root/usr.sbin/mrouted/defs.h
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-14 01:46:23 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-14 01:46:23 +0000
commitacfc88313dd86a33e6c0424cda0578b15a539e42 (patch)
tree8831738b9326fa2111446b81b93fee2285da3e07 /usr.sbin/mrouted/defs.h
parenta10a6913325bfa093081ff08628e32d3b0f2a565 (diff)
from netbsd; update to mrouted 3.8
Diffstat (limited to 'usr.sbin/mrouted/defs.h')
-rw-r--r--usr.sbin/mrouted/defs.h313
1 files changed, 198 insertions, 115 deletions
diff --git a/usr.sbin/mrouted/defs.h b/usr.sbin/mrouted/defs.h
index 8d5aa9c6d3a..27172d990be 100644
--- a/usr.sbin/mrouted/defs.h
+++ b/usr.sbin/mrouted/defs.h
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.5 1995/10/09 03:51:38 thorpej Exp $ */
+/* $NetBSD: defs.h,v 1.6 1995/12/10 10:06:59 mycroft Exp $ */
/*
* The mrouted program is covered by the license in the accompanying file
@@ -10,10 +10,21 @@
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <errno.h>
+#include <syslog.h>
+#include <signal.h>
+#include <string.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#ifdef SYSV
+#include <sys/sockio.h>
+#endif
#include <sys/time.h>
#include <net/if.h>
#include <netinet/in.h>
@@ -21,15 +32,21 @@
#include <netinet/ip.h>
#include <netinet/igmp.h>
#include <netinet/ip_mroute.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-#include <syslog.h>
-#include <signal.h>
#ifdef RSRR
#include <sys/un.h>
#endif /* RSRR */
+#ifndef __P
+#ifdef __STDC__
+#define __P(x) x
+#else
+#define __P(x) ()
+#endif
+#endif
+
+typedef void (*cfunc_t) __P((void *));
+typedef void (*ihfunc_t) __P((int, fd_set *));
+
#include "dvmrp.h"
#include "vif.h"
#include "route.h"
@@ -37,6 +54,7 @@
#include "pathnames.h"
#ifdef RSRR
#include "rsrr.h"
+#include "rsrr_var.h"
#endif /* RSRR */
/*
@@ -49,13 +67,17 @@
#define TIMER_INTERVAL ROUTE_MAX_REPORT_DELAY
+#define VENDOR_CODE 1 /* Get a new vendor code if you make significant
+ * changes to mrouted. */
+
#define PROTOCOL_VERSION 3 /* increment when packet format/content changes */
-#define MROUTED_VERSION 5 /* increment on local changes or bug fixes, */
+#define MROUTED_VERSION 8 /* increment on local changes or bug fixes, */
/* reset to 0 whever PROTOCOL_VERSION increments */
-#define MROUTED_LEVEL ( (MROUTED_VERSION << 8) | PROTOCOL_VERSION | \
- ((NF_PRUNE | NF_GENID | NF_MTRACE) << 16))
+#define MROUTED_LEVEL ((MROUTED_VERSION << 8) | PROTOCOL_VERSION | \
+ ((NF_PRUNE | NF_GENID | NF_MTRACE) << 16) | \
+ (VENDOR_CODE << 24))
/* for IGMP 'group' field of DVMRP messages */
#define LEAF_FLAGS (( vifs_with_neighbors == 1 ) ? 0x010000 : 0)
@@ -69,6 +91,7 @@
#define JAN_1970 2208988800UL /* 1970 - 1900 in seconds */
#else
#define JAN_1970 2208988800L /* 1970 - 1900 in seconds */
+#define const /**/
#endif
#ifdef RSRR
@@ -78,10 +101,17 @@
#define BIT_TST(X,n) ((X) & 1 << (n))
#endif /* RSRR */
+#ifdef SYSV
+#define bcopy(a, b, c) memcpy(b, a, c)
+#define bzero(s, n) memset((s), 0, (n))
+#define setlinebuf(s) setvbuf(s, NULL, _IOLBF, 0)
+#define signal(s,f) sigset(s,f)
+#endif
+
/*
* External declarations for global variables and functions.
*/
-#define RECV_BUF_SIZE MAX_IP_PACKET_LEN
+#define RECV_BUF_SIZE 8192
extern char *recv_buf;
extern char *send_buf;
extern int igmp_socket;
@@ -113,118 +143,171 @@ extern char s2[];
extern char s3[];
extern char s4[];
-extern void log();
-
-extern void init_igmp();
-extern void accept_igmp();
-extern void send_igmp();
-
-extern void init_routes();
-extern void start_route_updates();
-extern void update_route();
-extern void age_routes();
-extern void expire_all_routes();
-extern void free_all_routes();
-
-extern void accept_probe();
-extern void accept_report();
-extern void report();
-extern void report_to_all_neighbors();
-extern int report_next_chunk();
-extern void add_vif_to_routes();
-extern void delete_vif_from_routes();
-extern void delete_neighbor_from_routes();
-extern void dump_routes();
-
-extern void init_vifs();
-extern void check_vif_state();
-extern vifi_t find_vif();
-extern void age_vifs();
-extern void dump_vifs();
-extern void stop_all_vifs();
-extern struct listaddr *neighbor_info();
-
-extern void accept_group_report();
-extern void query_groups();
-extern void probe_for_neighbors();
-extern int update_neighbor();
-extern void accept_neighbor_request();
-extern void accept_neighbor_request2();
-extern void accept_neighbors();
-extern void accept_neighbors2();
-
-extern void config_vifs_from_kernel();
-extern void config_vifs_from_file();
-
-extern int inet_valid_host();
-extern int inet_valid_subnet();
-extern char * inet_fmt();
-extern char * inet_fmts();
-extern u_int32_t inet_parse();
-extern int inet_cksum();
-
-extern struct rtentry * determine_route();
-
-extern void init_ktable();
-extern void add_table_entry();
-extern void del_table_entry();
-extern void update_table_entry();
-extern void update_lclgrp();
-extern void delete_lclgrp();
+#if !(defined(BSD) && (BSD >= 199103))
+extern int errno;
+extern int sys_nerr;
+extern char * sys_errlist[];
+#endif
+
+#ifdef OLD_KERNEL
+#define MRT_INIT DVMRP_INIT
+#define MRT_DONE DVMRP_DONE
+#define MRT_ADD_VIF DVMRP_ADD_VIF
+#define MRT_DEL_VIF DVMRP_DEL_VIF
+#define MRT_ADD_MFC DVMRP_ADD_MFC
+#define MRT_DEL_MFC DVMRP_DEL_MFC
+#define IGMP_PIM 0x14
+#endif
+
+/* main.c */
+extern void log __P((int, int, char *, ...));
+extern int register_input_handler __P((int fd, ihfunc_t func));
+
+/* igmp.c */
+extern void init_igmp __P((void));
+extern void accept_igmp __P((int recvlen));
+extern void send_igmp __P((u_int32_t src, u_int32_t dst, int type,
+ int code, u_int32_t group,
+ int datalen));
+
+/* callout.c */
+extern void callout_init __P((void));
+extern void age_callout_queue __P((void));
+extern int timer_setTimer __P((int delay, cfunc_t action,
+ char *data));
+extern void timer_clearTimer __P((int timer_id));
+
+/* route.c */
+extern void init_routes __P((void));
+extern void start_route_updates __P((void));
+extern void update_route __P((u_int32_t origin, u_int32_t mask,
+ u_int metric, u_int32_t src,
+ vifi_t vifi));
+extern void age_routes __P((void));
+extern void expire_all_routes __P((void));
+extern void free_all_routes __P((void));
+extern void accept_probe __P((u_int32_t src, u_int32_t dst,
+ char *p, int datalen,
+ u_int32_t level));
+extern void accept_report __P((u_int32_t src, u_int32_t dst,
+ char *p, int datalen,
+ u_int32_t level));
+extern struct rtentry * determine_route __P((u_int32_t src));
+extern void report __P((int which_routes, vifi_t vifi,
+ u_int32_t dst));
+extern void report_to_all_neighbors __P((int which_routes));
+extern int report_next_chunk __P((void));
+extern void add_vif_to_routes __P((vifi_t vifi));
+extern void delete_vif_from_routes __P((vifi_t vifi));
+extern void delete_neighbor_from_routes __P((u_int32_t addr,
+ vifi_t vifi));
+extern void dump_routes __P((FILE *fp));
+extern void start_route_updates __P((void));
+
+/* vif.c */
+extern void init_vifs __P((void));
+extern void check_vif_state __P((void));
+extern vifi_t find_vif __P((u_int32_t src, u_int32_t dst));
+extern void age_vifs __P((void));
+extern void dump_vifs __P((FILE *fp));
+extern void stop_all_vifs __P((void));
+extern struct listaddr *neighbor_info __P((vifi_t vifi, u_int32_t addr));
+extern void accept_group_report __P((u_int32_t src, u_int32_t dst,
+ u_int32_t group, int r_type));
+extern void query_groups __P((void));
+extern void probe_for_neighbors __P((void));
+extern int update_neighbor __P((vifi_t vifi, u_int32_t addr,
+ int msgtype, char *p, int datalen,
+ u_int32_t level));
+extern void accept_neighbor_request __P((u_int32_t src, u_int32_t dst));
+extern void accept_neighbor_request2 __P((u_int32_t src,
+ u_int32_t dst));
+extern void accept_neighbors __P((u_int32_t src, u_int32_t dst,
+ u_char *p, int datalen, u_int32_t level));
+extern void accept_neighbors2 __P((u_int32_t src, u_int32_t dst,
+ u_char *p, int datalen, u_int32_t level));
+extern void accept_leave_message __P((u_int32_t src, u_int32_t dst,
+ u_int32_t group));
+extern void accept_membership_query __P((u_int32_t src, u_int32_t dst,
+ u_int32_t group, int tmo));
+
+/* config.c */
+extern void config_vifs_from_kernel __P((void));
+
+/* cfparse.y */
+extern void config_vifs_from_file __P((void));
+
+/* inet.c */
+extern int inet_valid_host __P((u_int32_t naddr));
+extern int inet_valid_subnet __P((u_int32_t nsubnet, u_int32_t nmask));
+extern char * inet_fmt __P((u_int32_t addr, char *s));
+extern char * inet_fmts __P((u_int32_t addr, u_int32_t mask, char *s));
+extern u_int32_t inet_parse __P((char *s));
+extern int inet_cksum __P((u_short *addr, u_int len));
+
+/* prune.c */
extern unsigned kroutes;
-extern void accept_prune();
-extern int no_entry_exists();
-extern int rtr_cnt();
-extern void free_all_prunes();
-extern void age_table_entry();
-extern void dump_cache();
+extern void add_table_entry __P((u_int32_t origin, u_int32_t mcastgrp));
+extern void del_table_entry __P((struct rtentry *r,
+ u_int32_t mcastgrp, u_int del_flag));
+extern void update_table_entry __P((struct rtentry *r));
+extern void init_ktable __P((void));
+extern void accept_prune __P((u_int32_t src, u_int32_t dst, char *p,
+ int datalen));
+extern void steal_sources __P((struct rtentry *rt));
+extern void reset_neighbor_state __P((vifi_t vifi, u_int32_t addr));
+extern int grplst_mem __P((vifi_t vifi, u_int32_t mcastgrp));
+extern int scoped_addr __P((vifi_t vifi, u_int32_t addr));
+extern void free_all_prunes __P((void));
+extern void age_table_entry __P((void));
+extern void dump_cache __P((FILE *fp2));
+extern void update_lclgrp __P((vifi_t vifi, u_int32_t mcastgrp));
+extern void delete_lclgrp __P((vifi_t vifi, u_int32_t mcastgrp));
+extern void chkgrp_graft __P((vifi_t vifi, u_int32_t mcastgrp));
+extern void accept_graft __P((u_int32_t src, u_int32_t dst, char *p,
+ int datalen));
+extern void accept_g_ack __P((u_int32_t src, u_int32_t dst, char *p,
+ int datalen));
+/* u_int is promoted u_char */
+extern void accept_mtrace __P((u_int32_t src, u_int32_t dst,
+ u_int32_t group, char *data, u_int no,
+ int datalen));
+
+/* kern.c */
+extern void k_set_rcvbuf __P((int bufsize));
+extern void k_hdr_include __P((int bool));
+extern void k_set_ttl __P((int t));
+extern void k_set_loop __P((int l));
+extern void k_set_if __P((u_int32_t ifa));
+extern void k_join __P((u_int32_t grp, u_int32_t ifa));
+extern void k_leave __P((u_int32_t grp, u_int32_t ifa));
+extern void k_init_dvmrp __P((void));
+extern void k_stop_dvmrp __P((void));
+extern void k_add_vif __P((vifi_t vifi, struct uvif *v));
+extern void k_del_vif __P((vifi_t vifi));
+extern void k_add_rg __P((u_int32_t origin, struct gtable *g));
+extern int k_del_rg __P((u_int32_t origin, struct gtable *g));
+extern int k_get_version __P((void));
#ifdef SNMP
-extern struct rtentry * snmp_find_route();
-extern struct gtable * find_grp();
-extern struct stable * find_grp_src();
+/* prune.c */
+extern struct rtentry * snmp_find_route __P(());
+extern struct gtable * find_grp __P(());
+extern struct stable * find_grp_src __P(());
#endif
-extern void chkgrp_graft();
-extern void accept_graft();
-extern void accept_g_ack();
-extern void accept_mtrace();
-extern void accept_leave_message();
-extern void accept_membership_query();
#ifdef RSRR
+/* prune.c */
extern struct gtable *kernel_table;
extern struct gtable *gtp;
-extern int find_src_grp();
-extern int grplst_mem();
-extern int scoped_addr();
-#endif /* RSRR */
-
-extern void k_set_rcvbuf();
-extern void k_hdr_include();
-extern void k_set_ttl();
-extern void k_set_loop();
-extern void k_set_if();
-extern void k_join();
-extern void k_leave();
-extern void k_init_dvmrp();
-extern void k_stop_dvmrp();
-extern void k_add_vif();
-extern void k_del_vif();
-extern void k_add_rg();
-extern int k_del_rg();
-extern int k_get_version();
-
-extern char * malloc();
-extern char * fgets();
-extern FILE * fopen();
-
-#if !defined(htonl) && !defined(__osf__)
-extern u_long htonl();
-extern u_long ntohl();
-#endif
-
-#ifdef RSRR
-extern void rsrr_init();
-extern void rsrr_read();
+extern int find_src_grp __P((u_int32_t src, u_int32_t mask,
+ u_int32_t grp));
+
+/* rsrr.c */
+extern void rsrr_init __P((void));
+extern void rsrr_read __P((int f, fd_set *rfd));
+extern void rsrr_clean __P((void));
+extern void rsrr_cache_send __P((struct gtable *gt, int notify));
+extern void rsrr_cache_clean __P((struct gtable *gt));
#endif /* RSRR */