/* A collection of stuff heavily dependent on the configuration info * in config.h. The idea is that configuration-dependent tables should * be located here to avoid having to pepper lots of .c files with #ifdefs, * requiring them to include config.h and be recompiled each time config.h * is modified. * * Copyright 1991 Phil Karn, KA9Q */ /* Mods by PA0GRI */ #include #include #include "global.h" #include "config.h" #include "mbuf.h" #include "timer.h" #include "proc.h" #include "iface.h" #include "ip.h" #include "tcp.h" #include "udp.h" #ifdef ARCNET #include "arcnet.h" #endif #include "lapb.h" #include "ax25.h" #include "enet.h" #include "kiss.h" #include "netrom.h" #include "nr4.h" #include "pktdrvr.h" #include "ppp.h" #include "slip.h" #include "arp.h" #include "icmp.h" #include "hardware.h" /***/ #include "usock.h" #include "cmdparse.h" #include "commands.h" #include "mailbox.h" #include "ax25mail.h" #include "nr4mail.h" #include "tipmail.h" #include "bootp.h" #include "daemon.h" #include "slhc.h" #include "rspf.h" int dotest __ARGS((int argc,char *argv[],void *p)); /**/ static int dostart __ARGS((int argc,char *argv[],void *p)); static int dostop __ARGS((int argc,char *argv[],void *p)); #ifdef AX25 #ifdef AXIP static void axip __ARGS((struct iface *iface,struct ax25_cb *axp,char *src, char *dest,struct mbuf *bp,int mcast)); #endif static void axarp __ARGS((struct iface *iface,struct ax25_cb *axp,char *src, char *dest,struct mbuf *bp,int mcast)); static void axrarp __ARGS((struct iface *iface,struct ax25_cb *axp,char *src, char *dest,struct mbuf *bp,int mcast)); static void axnr __ARGS((struct iface *iface,struct ax25_cb *axp,char *src, char *dest,struct mbuf *bp,int mcast)); #endif struct mbuf *Hopper; unsigned Nsessions = NSESSIONS; /* Free memory threshold, below which things start to happen to conserve * memory, like garbage collection, source quenching and refusing connects */ int32 Memthresh = MTHRESH; int Nibufs = NIBUFS; /* Number of interrupt buffers */ unsigned Ibufsize = IBUFSIZE; /* Size of each interrupt buffer */ /* Transport protocols atop IP */ struct iplink Iplink[] = { TCP_PTCL, tcp_input, UDP_PTCL, udp_input, ICMP_PTCL, icmp_input, IP_PTCL, ipip_recv, #ifdef AXIP AX25_PTCL, axip_input, #endif #ifdef RSPF RSPF_PTCL, rspf_input, #endif /* RSPF */ 0, 0 }; /* Transport protocols atop ICMP */ struct icmplink Icmplink[] = { TCP_PTCL, tcp_icmp, 0, 0 }; /* ARP protocol linkages */ struct arp_type Arp_type[NHWTYPES] = { #ifdef NETROM AXALEN, 0, 0, 0, 0, NULLCHAR, pax25, setcall, /* ARP_NETROM */ #else 0, 0, 0, 0, 0, NULLCHAR,NULL,NULL, #endif #ifdef ETHER EADDR_LEN,IP_TYPE,ARP_TYPE,REVARP_TYPE,1,Ether_bdcst,pether,gether, /* ARP_ETHER */ #else 0, 0, 0, 0, 0, NULLCHAR,NULL,NULL, #endif 0, 0, 0, 0, 0, NULLCHAR,NULL,NULL, /* ARP_EETHER */ #ifdef AX25 AXALEN, PID_IP, PID_ARP, PID_RARP, 10, Ax25multi[0], pax25, setcall, #else 0, 0, 0, 0, 0, NULLCHAR,NULL,NULL, /* ARP_AX25 */ #endif 0, 0, 0, 0, 0, NULLCHAR,NULL,NULL, /* ARP_PRONET */ 0, 0, 0, 0, 0, NULLCHAR,NULL,NULL, /* ARP_CHAOS */ 0, 0, 0, 0, 0, NULLCHAR,NULL,NULL, /* ARP_IEEE802 */ #ifdef ARCNET AADDR_LEN, ARC_IP, ARC_ARP, 0, 1, ARC_bdcst, parc, garc, /* ARP_ARCNET */ #else 0, 0, 0, 0, 0, NULLCHAR,NULL,NULL, #endif 0, 0, 0, 0, 0, NULLCHAR,NULL,NULL, /* ARP_APPLETALK */ }; #ifdef AX25 /* Linkage to network protocols atop ax25 */ struct axlink Axlink[] = { #ifdef AXIP PID_IP, axip, #endif PID_ARP, axarp, PID_RARP, axrarp, #ifdef NETROM PID_NETROM, axnr, #endif PID_NO_L3, axnl3, 0, NULL, }; #endif #ifndef BOOTP int WantBootp = 0; bootp_validPacket(ip,bpp) struct ip *ip; struct mbuf **bpp; { return 0; } #endif #ifdef MAILBOX void (*Listusers) __ARGS((int s)) = listusers; #else void (*Listusers) __ARGS((int s)) = NULL; #endif /* daemons to be run at startup time */ struct daemon Daemons[] = { "killer", 1024, killer, "timer", 2048, timerproc, "network", 2048, network, "keyboard", 256, keyboard, NULLCHAR, 0, NULLVFP }; struct iftype Iftypes[] = { /* This entry must be first, since Loopback refers to it */ "None", NULL, NULL, NULL, NULL, CL_NONE, 0, #ifdef AX25 "AX25", ax_send, ax_output, pax25, setcall, CL_AX25, AXALEN, #endif #ifdef SLIP "SLIP", slip_send, NULL, NULL, NULL, CL_NONE, 0, #endif #ifdef ETHER /* Note: NULL is specified for the scan function even though * gether() exists because the packet drivers don't support * address setting. */ "Ethernet", enet_send, enet_output, pether, NULL, CL_ETHERNET, EADDR_LEN, #endif #ifdef NETROM "NETROM", nr_send, NULL, pax25, setcall, CL_NETROM, AXALEN, #endif #ifdef SLFP "SLFP", pk_send, NULL, NULL, NULL, CL_NONE, 0, #endif #ifdef PPP "PPP", ppp_send, ppp_output, NULL, NULL, CL_PPP, 0, #endif NULLCHAR }; /* Command lookup and branch tables */ struct cmds Cmds[] = { /* The "go" command must be first */ "", go, 0, 0, NULLCHAR, #ifndef AMIGA "!", doshell, 0, 0, NULLCHAR, #endif "abort", doabort, 0, 0, NULLCHAR, #ifdef AMIGA "amiga", doamiga, 0, 0, NULLCHAR, #endif #if (defined(MAC) && defined(APPLETALK)) "applestat", doatstat, 0, 0, NULLCHAR, #endif #if (defined(AX25) || defined(ETHER) || defined(APPLETALK)) "arp", doarp, 0, 0, NULLCHAR, #endif #ifdef ASY "asystat", doasystat, 0, 0, NULLCHAR, #endif "attach", doattach, 0, 2, "attach ", "attended", doattended, 0, 0, NULLCHAR, #ifdef AX25 "ax25", doax25, 0, 0, NULLCHAR, #endif #ifdef MAILBOX "bbs", dobbs, 1024, 0, NULLCHAR, #endif #ifdef BOOTP "bootp", dobootp, 0, 0, NULLCHAR, "bootpd", bootpdcmd, 0, 0, NULLCHAR, #endif /* This one is out of alpabetical order to allow abbreviation to "c" */ #ifdef AX25 "connect", doconnect, 1024, 3, "connect ", #endif #if !defined(UNIX) && !defined(AMIGA) "cd", docd, 0, 0, NULLCHAR, #endif "close", doclose, 0, 0, NULLCHAR, "comm", doasycomm, 0, 3,"comm ", /* This one is out of alpabetical order to allow abbreviation to "d" */ "disconnect", doclose, 0, 0, NULLCHAR, #ifndef AMIGA "dir", dodir, 512, 0, NULLCHAR, /* note sequence */ #endif "delete", dodelete, 0, 2, "delete ", "detach", dodetach, 0, 2, "detach ", #ifdef DIALER "dialer", dodialer, 512, 3, "dialer [ [ [ []]]]", #endif "domain", dodomain, 0, 0, NULLCHAR, #ifdef DRSI "drsistat", dodrstat, 0, 0, NULLCHAR, #endif "dump", domdump, 0, 0, NULLCHAR, #ifdef HS "hs", dohs, 0, 0, NULLCHAR, #endif #ifdef EAGLE "eaglestat", doegstat, 0, 0, NULLCHAR, #endif "echo", doecho, 0, 0, NULLCHAR, "eol", doeol, 0, 0, NULLCHAR, #if (!defined(MSDOS) || defined(ESCAPE)) "escape", doescape, 0, 0, NULLCHAR, #endif #ifdef PC_EC "etherstat", doetherstat, 0, 0, NULLCHAR, #endif "exit", doexit, 0, 0, NULLCHAR, "finger", dofinger, 1024, 2, "finger name@host", "fkey", dofkey, 0, 0, NULLCHAR, "ftp", doftp, 2048, 2, "ftp
", "ftype", doftype, 0, 0, NULLCHAR, #ifdef HAPN "hapnstat", dohapnstat, 0, 0, NULLCHAR, #endif "help", dohelp, 0, 0, NULLCHAR, #ifdef HOPCHECK "hop", dohop, 0, 0, NULLCHAR, #endif "hostname", dohostname, 0, 0, NULLCHAR, #ifdef HS "hs", dohs, 0, 0, NULLCHAR, #endif "icmp", doicmp, 0, 0, NULLCHAR, "ifconfig", doifconfig, 0, 0, NULLCHAR, "info", doinfo, 0, 0, NULLCHAR, "ip", doip, 0, 0, NULLCHAR, #ifdef MSDOS "isat", doisat, 0, 0, NULLCHAR, #endif "kick", dokick, 0, 0, NULLCHAR, "log", dolog, 0, 0, NULLCHAR, "mail", dobmail, 0, 0, NULLCHAR, #ifdef MAILBOX "mbox", dombox, 0, 0, NULLCHAR, #endif #ifndef UNIX "memory", domem, 0, 0, NULLCHAR, #endif "mkdir", domkd, 0, 2, "mkdir ", #ifdef AX25 "mode", domode, 0, 2, "mode ", #endif "more", domore, 512, 2, "more ", "motd", domotd, 0, 0, NULLCHAR, #ifdef MSDOS "multitask", dobackg, 0, 0, NULLCHAR, #endif #ifdef NETROM "netrom", donetrom, 0, 0, NULLCHAR, #endif /* NETROM */ #ifdef NNTP "nntp", donntp, 0, 0, NULLCHAR, #endif #if (defined(NETROM) || defined(NRS)) "nrstat", donrstat, 0, 0, NULLCHAR, #endif /* NETROM && NRS */ "param", doparam, 0, 2, "param ", "ping", doping, 512, 2, "ping [ [ [incflag]]]", #ifdef PI "pistatus", dopistat, 0, 0, NULLCHAR, #endif #ifdef POP "pop", dopop, 0, 0, NULLCHAR, #endif #ifdef PPP "ppp", doppp_commands, 0, 0, NULLCHAR, #endif "ps", ps, 0, 0, NULLCHAR, #if !defined(UNIX) && !defined(AMIGA) "pwd", docd, 0, 0, NULLCHAR, #endif #if (defined(AX25) || defined(ETHER)) "rarp", dorarp, 0, 0, NULLCHAR, #endif "record", dorecord, 0, 0, NULLCHAR, "remote", doremote, 0, 3, "remote [-p port] [-k key] [-a kickaddr]
exit|reset|kick", "rename", dorename, 0, 3, "rename ", "reset", doreset, 0, 0, NULLCHAR, #ifdef RIP "rip", dorip, 0, 0, NULLCHAR, #endif #ifdef RLOGINCLI "rlogin", dorlogin, 2048, 2, "rlogin
", #endif "rmdir", dormd, 0, 2, "rmdir ", "route", doroute, 0, 0, NULLCHAR, #ifdef RSPF "rspf", dorspf, 0, 0, NULLCHAR, #endif /* RSPF */ "session", dosession, 0, 0, NULLCHAR, #ifdef SCC "sccstat", dosccstat, 0, 0, NULLCHAR, #endif #if !defined(AMIGA) "shell", doshell, 0, 0, NULLCHAR, #endif "smtp", dosmtp, 0, 0, NULLCHAR, "socket", dosock, 0, 0, NULLCHAR, "source", dosource, 0, 2, "source ", #ifdef SERVERS "start", dostart, 0, 2, "start ", "stop", dostop, 0, 2, "stop ", #endif "status", dostatus, 0, 0, NULLCHAR, "tcp", dotcp, 0, 0, NULLCHAR, "tail", dotail, 0, 2, "tail ", "telnet", dotelnet, 1024, 2, "telnet
", "test", dotest, 0, 0, NULLCHAR, "ttylink", dottylink, 1024, 2, "ttylink
", #ifdef MAILBOX "third-party", dothirdparty, 0, 0, NULLCHAR, #endif "tip", dotip, 256, 2, "tip ", #ifdef TRACE "trace", dotrace, 0, 0, NULLCHAR, #endif "udp", doudp, 0, 0, NULLCHAR, "upload", doupload, 0, 0, NULLCHAR, #ifdef MSDOS "watch", doswatch, 0, 0, NULLCHAR, "watchdog", dowatchdog, 0, 0, NULLCHAR, #endif "?", dohelp, 0, 0, NULLCHAR, NULLCHAR, NULLFP, 0, 0, "Unknown command; type \"?\" for list", }; /* List of supported hardware devices */ struct cmds Attab[] = { #ifdef PC_EC /* 3-Com Ethernet interface */ "3c500", ec_attach, 0, 7, "attach 3c500
arpa