-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.c
1151 lines (1072 loc) · 26.9 KB
/
config.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* 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
*/
#include "top.h"
#include "lib/std/stdio.h"
#if defined(MSDOS)
#include <dos.h>
#endif
#include <time.h>
#include "global.h"
#include "config.h"
#include "net/core/mbuf.h"
#include "core/timer.h"
#include "core/proc.h"
#include "net/core/iface.h"
#include "net/inet/ip.h"
#ifdef IPSEC
#include "ipsec.h"
#include "photuris.h"
#endif
#include "net/inet/tcp.h"
#include "net/inet/udp.h"
#include "service/smtp/smtp.h"
#ifdef ARCNET
#include "msdos/arcnet.h"
#endif
#ifdef AX25
#include "net/ax25/lapb.h"
#include "net/ax25/ax25.h"
#include "net/ax25/kiss.h"
#endif /* AX25 */
#include "net/enet/enet.h"
#include "net/netrom/nr4.h"
#include "net/netrom/nrs.h"
#include "net/netrom/netrom.h"
#ifdef HAVE_NET_IF_TAP_H
#include "net/tap/tapdrvr.h"
#endif /* HAVE_NET_IF_TAP_H */
#ifdef HAVE_NET_IF_TUN_H
#include "net/tun/tundrvr.h"
#endif /* HAVE_NET_IF_TUN_H */
#ifdef MSDOS
#include "msdos/pktdrvr.h"
#endif
#include "net/ppp/ppp.h"
#include "net/slip/slip.h"
#include "net/arp/arp.h"
#include "net/inet/icmp.h"
#include "hardware.h" /***/
#include "core/usock.h"
#include "lib/util/cmdparse.h"
#include "commands.h"
#include "mailbox.h"
#ifdef AX25
#include "net/ax25/ax25mail.h"
#endif /* AX25 */
#include "net/netrom/nr4mail.h"
#include "tipmail.h"
#include "core/daemon.h"
#include "service/bootp/bootp.h"
#include "core/asy.h"
#include "core/trace.h"
#include "core/session.h"
#ifdef SPPP
#include "net/sppp/sppp.h"
#endif
#include "core/dialer.h"
#ifdef KSP
#include "ksp.h"
#endif
#ifdef SOUND
#include "msdos/sb.h"
#endif
#ifdef AX25
#include "net/ax25/axip.h"
#endif /* AX25 */
static int dostart(int argc,char *argv[],void *p);
static int dostop(int argc,char *argv[],void *p);
#ifdef AX25
static void axip(struct iface *iface,struct ax25_cb *axp,uint8 *src,
uint8 *dest,struct mbuf **bp,int mcast);
static void axarp(struct iface *iface,struct ax25_cb *axp,uint8 *src,
uint8 *dest,struct mbuf **bp,int mcast);
static void axnr(struct iface *iface,struct ax25_cb *axp,uint8 *src,
uint8 *dest,struct mbuf **bp,int mcast);
#endif /* AX25 */
struct mbuf *Hopper; /* Queue of incoming packets */
unsigned Nsessions = NSESSIONS;
unsigned Nsock = DEFNSOCK; /* Number of socket entries */
/* Free memory threshold, below which things start to happen to conserve
* memory, like garbage collection, source quenching and refusing connects
*/
int32 Memthresh = MTHRESH;
unsigned Nfiles = DEFNFILES;
int32 Sfsize = 1000; /* Default size of session scrollback file */
/* Command lookup and branch tables */
struct cmds Cmds[] = {
/* The "go" command must be first */
{ "", go, 0, 0, NULL },
#if (defined(MAC) && defined(APPLETALK))
{ "applestat", doatstat, 0, 0, NULL },
#endif
#if (defined(AX25) || defined(ETHER) || defined(APPLETALK))
{ "arp", doarp, 0, 0, NULL },
#endif
#ifdef ASY
{ "asystat", doasystat, 0, 0, NULL },
#endif
{ "attach", doattach, 0, 2, "attach <hardware> <hw specific options>" },
#ifdef AX25
{ "ax25", doax25, 0, 0, NULL },
#endif
#ifdef AXIP
{ "axudp", doaxudp, 0, 2, "axudp <interface> <subcmd> ..." },
#endif
#ifdef BOOTP
{ "bootp", dobootp, 0, 0, NULL },
{ "bootpd", bootpdcmd, 0, 0, NULL },
#endif
/* This one is out of alpabetical order to allow abbreviation to "c" */
#ifdef AX25
{ "connect", doconnect, 1024, 3, "connect <interface> <callsign> [<digipeater path>]" },
{ "unproto_connect", do_unproto_connect, 1024, 3, "unproto_connect <interface> <callsign> [<digipeater path>]" },
#endif
#if !defined(AMIGA)
{ "cd", docd, 0, 0, NULL },
#endif
{ "close", doclose, 0, 0, NULL },
/* This one is out of alpabetical order to allow abbreviation to "d" */
{ "disconnect", doclose, 0, 0, NULL },
{ "delete", dodelete, 0, 2, "delete <file>" },
{ "detach", dodetach, 0, 2, "detach <interface>" },
{ "debug", dodebug, 0, 1, "debug [on|off]" },
#ifdef DIALER
{ "dialer", dodialer, 0, 2, "dialer <iface> <timeout> [device-dependent args]" },
#endif
#ifndef AMIGA
{ "dir", dodir, 0, 0, NULL },/* note sequence */
#endif
{ "domain", dodomain, 0, 0, NULL },
#ifdef DRSI
{ "drsistat", dodrstat, 0, 0, NULL },
#endif
#ifdef EAGLE
{ "eaglestat", doegstat, 0, 0, NULL },
#endif
{ "echo", doecho, 0, 0, NULL },
{ "eol", doeol, 0, 0, NULL },
#if !defined(MSDOS) && !defined(UNIX)
{ "escape", doescape, 0, 0, NULL },
#endif
{ "exit", doexit, 0, 0, NULL },
{ "files", dofiles, 0, 0, NULL },
{ "finger", dofinger, 1024, 2, "finger name@host" },
{ "ftp", doftp, 2048, 2, "ftp <address>" },
#ifdef HAPN
{ "hapnstat", dohapnstat, 0, 0, NULL },
#endif
{ "help", dohelp, 0, 0, NULL },
#ifdef HOPCHECK
{ "hop", dohop, 0, 0, NULL },
#endif
{ "hostname", dohostname, 0, 0, NULL },
#ifdef HS
{ "hs", dohs, 0, 0, NULL },
#endif
{ "icmp", doicmp, 0, 0, NULL },
{ "ifconfig", doifconfig, 0, 0, NULL },
{ "ip", doip, 0, 0, NULL },
{ "kick", dokick, 0, 0, NULL },
#ifdef KSP
{ "ksp", doksp, 0, 0, NULL },
#endif
{ "log", dolog, 0, 0, NULL },
#ifdef LTERM
{ "lterm", dolterm, 512, 3, "lterm <iface> <address> [<port>]" },
#endif
#ifdef MAILBOX
{ "mbox", dombox, 0, 0, NULL },
#endif
#ifndef UNIX
{ "memory", domem, 0, 0, NULL },
#endif
{ "mkdir", domkd, 0, 2, "mkdir <directory>" },
#ifndef UNIX /* Not yet */
{ "more", doview, 0, 2, "more <filename>" },
#endif
#ifdef NETROM
{ "netrom", donetrom, 0, 0, NULL },
#endif /* NETROM */
#ifdef NNTP
{ "nntp", donntp, 0, 0, NULL },
#endif /* NNTP */
#ifdef NRS
{ "nrstat", donrstat, 0, 0, NULL },
#endif /* NRS */
#ifndef UNIX
{ "page", dopage, 0, 2, "page <command> [args...]" },
#endif
{ "param", doparam, 0, 2, "param <interface>" },
{ "ping", doping, 512, 2, "ping <hostid> [<length> [<interval> [incflag]]]" },
#ifdef PI
{ "pistatus", dopistat, 0, 0, NULL },
#endif
#ifdef POP
{ "pop", dopop, 0, 0, NULL },
#endif
#ifdef PPP
{ "ppp", doppp_commands, 0, 0, NULL },
#endif
{ "ps", ps, 0, 0, NULL },
#if !defined(AMIGA)
{ "pwd", docd, 0, 0, NULL },
#endif
{ "record", dorecord, 0, 0, NULL },
{ "rename", dorename, 0, 3, "rename <oldfile> <newfile>" },
{ "repeat", dorepeat, 1024, 3, "repeat <interval> <command> [args...]" },
{ "reset", doreset, 0, 0, NULL },
{ "reboot", doreboot, 0, 0, NULL },
#ifdef RIP
{ "rip", dorip, 0, 0, NULL },
#endif
{ "rmdir", dormd, 0, 2, "rmdir <directory>" },
{ "route", doroute, 0, 0, NULL },
{ "session", dosession, 0, 0, NULL },
#ifdef IPSEC
{ "secure", dosec, 0, 0, "secure [[add|delete] <host>]" },
#endif
{ "scrollback", dosfsize, 0, 0, NULL },
#ifdef SCC
{ "sccstat", dosccstat, 0, 0, NULL },
#endif
{ "sim", dosim, 0, 0, NULL },
#if defined(SMTP)
{ "smtp", dosmtp, 0, 0, NULL },
#endif
{ "socket", dosock, 0, 0, NULL },
#ifdef SOUND
{ "sound", dosound, 0, 2, "sound attach|detach|listen ..." },
#endif
#ifdef SERVERS
{ "start", dostart, 0, 2, "start <servername>" },
{ "stop", dostop, 0, 2, "stop <servername>" },
#endif
{ "tcp", dotcp, 0, 0, NULL },
{ "telnet", dotelnet, 1024, 2, "telnet <address>" },
#ifdef notdef
{ "test", dotest, 1024, 0, NULL },
#endif
{ "tip", dotip, 256, 2, "tip <iface>" },
{ "topt", dotopt, 0, 0, NULL },
#ifdef TRACE
{ "trace", dotrace, 512, 0, NULL },
#endif
{ "udp", doudp, 0, 0, NULL },
{ "upload", doupload, 0, 0, NULL },
#ifndef UNIX /* not yet */
{ "view", doview, 0, 2, "view <filename>" },
#endif
{ "wipe", dowipe, 0, 0, NULL },
{ "?", dohelp, 0, 0, NULL },
{ NULL, NULL, 0, 0, "Unknown command; type \"?\" for list" },
};
/* Remote command lookup and branch tables */
struct cmds Remcmds[] = {
{ "", donothing, 0, 0, NULL },
#if (defined(MAC) && defined(APPLETALK))
{ "applestat", doatstat, 0, 0, NULL },
#endif
#if (defined(AX25) || defined(ETHER) || defined(APPLETALK))
{ "arp", doarp, 0, 0, NULL },
#endif
#ifdef ASY
{ "asystat", doasystat, 0, 0, NULL },
#endif
{ "attach", doattach, 0, 2, "attach <hardware> <hw specific options>" },
#ifdef AX25
{ "ax25", doax25, 0, 0, NULL },
#endif
#ifdef AXIP
{ "axudp", doaxudp, 0, 2, "axudp <interface> <subcmd> ..." },
#endif
#ifdef BOOTP
{ "bootp", dobootp, 0, 0, NULL },
{ "bootpd", bootpdcmd, 0, 0, NULL },
#endif
#if !defined(AMIGA)
{ "cd", docd, 0, 0, NULL },
#endif
{ "delete", dodelete, 0, 2, "delete <file>" },
{ "detach", dodetach, 0, 2, "detach <interface>" },
#ifdef DIALER
{ "dialer", dodialer, 0, 2, "dialer <iface> <timeout> [device-dependent args]" },
#endif
#ifdef notdef /* hangs system - must fix this */
#ifndef AMIGA
{ "dir", dodir, 0, 0, NULL }, /* note sequence */
#endif
#endif
{ "domain", dodomain, 0, 0, NULL },
#ifdef DRSI
{ "drsistat", dodrstat, 0, 0, NULL },
#endif
#ifdef EAGLE
{ "eaglestat", doegstat, 0, 0, NULL },
#endif
{ "files", dofiles, 0, 0, NULL },
#ifdef HAPN
{ "hapnstat", dohapnstat, 0, 0, NULL },
#endif
{ "help", dorhelp, 0, 0, NULL },
{ "hostname", dohostname, 0, 0, NULL },
#ifdef HS
{ "hs", dohs, 0, 0, NULL },
#endif
{ "icmp", doicmp, 0, 0, NULL },
{ "ifconfig", doifconfig, 0, 0, NULL },
{ "ip", doip, 0, 0, NULL },
{ "kick", dokick, 0, 0, NULL },
#ifdef KSP
{ "ksp", doksp, 0, 0, NULL },
#endif
{ "log", dolog, 0, 0, NULL },
#ifndef UNIX
{ "memory", domem, 0, 0, NULL },
#endif
{ "mkdir", domkd, 0, 2, "mkdir <directory>" },
#ifdef NETROM
{ "netrom", donetrom, 0, 0, NULL },
#endif /* NETROM */
#ifdef NNTP
{ "nntp", donntp, 0, 0, NULL },
#endif /* NNTP */
#ifdef NRS
{ "nrstat", donrstat, 0, 0, NULL },
#endif /* NRS */
{ "param", doparam, 0, 2, "param <interface>" },
#ifdef PI
{ "pistatus", dopistat, 0, 0, NULL },
#endif
#ifdef POP
{ "pop", dopop, 0, 0, NULL },
#endif
#ifdef PPP
{ "ppp", doppp_commands, 0, 0, NULL },
#endif
{ "ps", ps, 0, 0, NULL },
#if !defined(AMIGA)
{ "pwd", docd, 0, 0, NULL },
#endif
{ "rename", dorename, 0, 3, "rename <oldfile> <newfile>" },
{ "reset", doreset, 0, 0, NULL },
{ "reboot", doreboot, 0, 0, NULL },
#ifdef RIP
{ "rip", dorip, 0, 0, NULL },
#endif
{ "rmdir", dormd, 0, 2, "rmdir <directory>" },
{ "route", doroute, 0, 0, NULL },
#ifdef IPSEC
{ "secure", dosec, 0, 0, "secure [[add|delete] <host>]" },
#endif
#ifdef SCC
{ "sccstat", dosccstat, 0, 0, NULL },
#endif
#if defined(SMTP)
{ "smtp", dosmtp, 0, 0, NULL },
#endif
{ "socket", dosock, 0, 0, NULL },
#ifdef SOUND
{ "sound", dosound, 0, 2, "sound attach|detach|listen ..." },
#endif
#ifdef SERVERS
{ "start", dostart, 0, 2, "start <servername>" },
{ "stop", dostop, 0, 2, "stop <servername>" },
#endif
{ "tcp", dotcp, 0, 0, NULL },
{ "udp", doudp, 0, 0, NULL },
{ "wipe", dowipe, 0, 0, NULL },
{ "?", dorhelp, 0, 0, NULL },
{ NULL, NULL, 0, 0, "Unknown command; type \"?\" for list" },
};
/* List of supported hardware devices */
struct cmds Attab[] = {
#if defined(ASY)
/* Ordinary PC asynchronous adaptor */
#if defined(MSDOS)
{ "asy", asy_attach, 0, 8, "attach asy <address> <vector> slip|vjslip|ax25ui|ax25i|nrs|ppp <label> <buffers> <mtu> <speed> [ip_addr]" },
#elif defined(UNIX)
{ "asy", asy_attach, 0, 7, "attach asy <device> slip|vjslip|ax25ui|ax25i|kissui|kissi|nrs|ppp <label> <buffers> <mtu> <speed> [ip_addr]" },
#else
{ "asy", asy_attach, 0, 8, "attach asy <driver> <unit> slip|vjslip|ax25ui|ax25i|nrs|ppp <label> <buffers> <mtu> <speed> [ip_addr]" },
#endif /* rest (AMIGA?) */
#endif /* ASY */
#ifdef PC100
/* PACCOMM PC-100 8530 HDLC adaptor */
{ "pc100", pc_attach, 0, 8,"attach pc100 <address> <vector> ax25ui|ax25i <label> <buffers> <mtu> <speed> [ip_addra] [ip_addrb]" },
#endif
#ifdef DRSI
/* DRSI PCPA card in low speed mode */
{ "drsi", dr_attach, 0, 8, "attach drsi <address> <vector> ax25ui|ax25i <label> <bufsize> <mtu> <chan a speed> <chan b speed> [ip addr a] [ip addr b]" },
#endif
#ifdef EAGLE
/* EAGLE RS-232C 8530 HDLC adaptor */
{ "eagle", eg_attach, 0, 8, "attach eagle <address> <vector> ax25ui|ax25i <label> <buffers> <mtu> <speed> [ip_addra] [ip_addrb]" },
#endif
#ifdef PI
/* PI 8530 HDLC adaptor */
{ "pi", pi_attach, 0, 8, "attach pi <address> <vector> <dmachannel> ax25ui|ax25i <label> <buffers> <mtu> <speed> [ip_addra] [ip_addrb]" },
#endif
#ifdef HAPN
/* Hamilton Area Packet Radio (HAPN) 8273 HDLC adaptor */
{ "hapn", hapn_attach, 0, 8, "attach hapn <address> <vector> ax25ui|ax25i <label> <rx bufsize> <mtu> csma|full [ip_addr]" },
#endif
#ifdef APPLETALK
/* Macintosh AppleTalk */
{ "0", at_attach, 0, 7, "attach 0 <protocol type> <device> arpa <label> <rx bufsize> <mtu> [ip_addr]" },
#endif
#ifdef NETROM
/* fake netrom interface */
{ "netrom", nr_attach, 0, 1, "attach netrom [ip_addr]" },
#endif
#ifdef PACKET
#ifdef MSDOS
/* FTP Software's packet driver spec */
{ "packet", pk_attach, 0, 4, "attach packet <int#> <label> <buffers> <mtu> [ip_addr]" },
#endif
#ifdef HAVE_NET_IF_TAP_H
/* BSD Ethernet TAP device */
{ "tap", tap_attach, 0, 4, "attach tap <path> <label> <ethaddr> <mtu>" },
#endif /* HAVE_NET_IF_TAP_H */
#ifdef HAVE_NET_IF_TUN_H
/* BSD IP TUN device */
{ "tun", tun_attach, 0, 4, "attach tun <path> <label> <mtu>" },
#endif /* HAVE_NET_IF_TUN_H */
#endif
#ifdef HS
/* Special high speed driver for DRSI PCPA or Eagle cards */
{ "hs", hs_attach, 0, 7, "attach hs <address> <vector> ax25ui|ax25i <label> <buffers> <mtu> <txdelay> <persistence> [ip_addra] [ip_addrb]" },
#endif
#ifdef SCC
{ "scc", scc_attach, 0, 7,
"attach scc <devices> init <addr> <spacing> <Aoff> <Boff> <Dataoff>\n"
" <intack> <vec> [p]<clock> [hdwe] [param]\n"
"attach scc <chan> slip|kiss|nrs|ax25ui|ax25i <label> <mtu> <speed> <bufsize> [call] " },
#endif
#if defined(ASY) && !defined(UNIX)
{ "4port",fp_attach, 0, 3, "attach 4port <base> <irq>" },
#endif
#ifdef KSP
{ "ksp", ksp_attach, 0, 5, "attach ksp <base> <irq> <label> <mtu>" },
#endif
#ifdef AXIP
{ "axudp", axudp_attach, 0, 4, "attach axudp <listenip> <port> <label> [automap] [autobroadcast]" },
#endif
{ NULL },
};
#ifdef SERVERS
/* "start" and "stop" subcommands */
static struct cmds Startcmds[] = {
#if defined(AX25) && defined(MAILBOX)
{ "ax25", ax25start, 256, 0, NULL },
#endif
{ "discard", dis1, 256, 0, NULL },
{ "echo", echo1, 256, 0, NULL },
{ "finger", finstart, 256, 0, NULL },
{ "ftp", ftpstart, 256, 0, NULL },
#if defined(NETROM) && defined(MAILBOX)
{ "netrom", nr4start, 256, 0, NULL },
#endif
#ifdef POP
{ "pop", pop1, 256, 0, NULL },
#endif
#ifdef RIP
{ "rip", doripinit, 0, 0, NULL },
#endif
#ifdef SMTP
{ "smtp", smtp1, 256, 0, NULL },
#endif
#if defined(MAILBOX)
{ "telnet", telnet1, 256, 0, NULL },
{ "tip", tipstart, 256, 2, "start tip <interface>" },
#endif
{ "telnet", tnstart, 256, 0, NULL },
{ "ttylink", ttylstart, 256, 0, NULL },
{ NULL },
};
static struct cmds Stopcmds[] = {
#if defined(AX25) && defined(MAILBOX)
{ "ax25", ax250, 0, 0, NULL },
#endif
{ "discard", dis0, 0, 0, NULL },
{ "echo", echo0, 0, 0, NULL },
{ "finger", fin0, 0, 0, NULL },
{ "ftp", ftp0, 0, 0, NULL },
#if defined(NETROM) && defined(MAILBOX)
{ "netrom", nr40, 0, 0, NULL },
#endif
#ifdef POP
{ "pop", pop0, 0, 0, NULL },
#endif
#ifdef RIP
{ "rip", doripstop, 0, 0, NULL },
#endif
#ifdef SMTP
{ "smtp", smtp0, 0, 0, NULL },
#endif
#ifdef MAILBOX
{ "telnet", telnet0, 0, 0, NULL },
{ "tip", tip0, 0, 2, "stop tip <interface>" },
#endif
{ "ttylink", ttyl0, 0, 0, NULL },
{ NULL },
};
#endif /* SERVERS */
/* Socket-protocol interface table */
struct socklink Socklink[] = {
/* type,
* socket, bind, listen, connect,
* accept, recv, send, qlen,
* kick, shut, close, check,
* error, state, status, eol_seq
*/
{ TYPE_TCP,
so_tcp, NULL, so_tcp_listen, so_tcp_conn,
TRUE, so_tcp_recv, so_tcp_send, so_tcp_qlen,
so_tcp_kick, so_tcp_shut, so_tcp_close, checkipaddr,
Tcpreasons, tcpstate, so_tcp_stat, Inet_eol },
{ TYPE_UDP,
so_udp, so_udp_bind, NULL, so_udp_conn,
FALSE, so_udp_recv, so_udp_send, so_udp_qlen,
NULL, NULL, so_udp_close, checkipaddr,
NULL, NULL, so_udp_stat, Inet_eol },
#ifdef AX25
{ TYPE_AX25I,
so_ax_sock, NULL, so_ax_listen, so_ax_conn,
TRUE, so_ax_recv, so_ax_send, so_ax_qlen,
so_ax_kick, so_ax_shut, so_ax_close, checkaxaddr,
Axreasons, axstate, so_ax_stat, Ax25_eol },
{ TYPE_AX25UI,
so_axui_sock, so_axui_bind, NULL, so_axui_conn,
FALSE, so_axui_recv, so_axui_send, so_axui_qlen,
NULL, NULL, so_axui_close, checkaxaddr,
NULL, NULL, NULL, Ax25_eol },
#endif /* AX25 */
{ TYPE_RAW,
so_ip_sock, NULL, NULL, so_ip_conn,
FALSE, so_ip_recv, so_ip_send, so_ip_qlen,
NULL, NULL, so_ip_close, checkipaddr,
NULL, NULL, NULL, Inet_eol },
#ifdef NETROM
{ TYPE_NETROML3,
so_n3_sock, NULL, NULL, so_n3_conn,
FALSE, so_n3_recv, so_n3_send, so_n3_qlen,
NULL, NULL, so_n3_close, checknraddr,
NULL, NULL, NULL, Ax25_eol },
{ TYPE_NETROML4,
so_n4_sock, NULL, so_n4_listen, so_n4_conn,
TRUE, so_n4_recv, so_n4_send, so_n4_qlen,
so_n4_kick, so_n4_shut, so_n4_close, checknraddr,
Nr4reasons, nrstate, so_n4_stat, Ax25_eol },
#endif /* NETROM */
#ifdef LOCSOCK
{ TYPE_LOCAL_STREAM,
so_los, NULL, NULL, NULL,
TRUE, so_lo_recv, so_los_send, so_los_qlen,
NULL, so_loc_shut, so_loc_close, NULL,
NULL, NULL, so_loc_stat, Eol },
{ TYPE_LOCAL_DGRAM,
so_lod, NULL, NULL, NULL,
FALSE, so_lo_recv, so_lod_send, so_lod_qlen,
NULL, so_loc_shut, so_loc_close, NULL,
NULL, NULL, so_loc_stat, Eol },
#endif
{ -1 },
};
/* Table of functions for printing socket addresses */
char * (*Psock[]) () = {
ippsocket,
#ifdef AX25
axpsocket,
#else
NULL,
#endif
#ifdef NETROM
nrpsocket,
#else
NULL,
#endif
#ifdef LOCSOCK
lopsocket,
#else
NULL,
#endif
};
/* TCP port numbers to be considered "interactive" by the IP routing
* code and given priority in queueing
*/
int Tcp_interact[] = {
IPPORT_FTP, /* FTP control (not data!) */
IPPORT_TELNET, /* Telnet */
6000, /* X server 0 */
IPPORT_LOGIN, /* BSD rlogin */
IPPORT_MTP, /* Secondary telnet */
-1
};
int (*Kicklist[])() = {
kick,
#ifdef SMTP
smtptick,
#endif
NULL
};
/* Transport protocols atop IP */
struct iplink Iplink[] = {
{ TCP_PTCL, "TCP", tcp_input, tcp_dump },
{ UDP_PTCL, "UDP", udp_input, udp_dump },
{ ICMP_PTCL, "ICMP", icmp_input, icmp_dump },
{ IP_PTCL, "IP", ipip_recv, ipip_dump },
{ IP4_PTCL, "IP", ipip_recv, ipip_dump },
#ifdef IPSEC
{ ESP_PTCL, "ESP", esp_input, esp_dump },
{ AH_PTCL, "AH", ah_input, ah_dump },
#endif
{ 0, NULL, NULL, NULL },
};
/* Transport protocols atop ICMP */
struct icmplink Icmplink[] = {
{ TCP_PTCL, tcp_icmp },
#ifdef IPSEC
{ ESP_PTCL, esp_icmp },
/* { AH_PTCL, ah_icmp }, */
#endif
{ 0, 0 },
};
#ifdef AX25
/* Linkage to network protocols atop ax25 */
struct axlink Axlink[] = {
{ PID_IP, axip },
{ PID_ARP, axarp },
#ifdef NETROM
{ PID_NETROM, axnr },
#endif
{ PID_NO_L3, axnl3 },
{ 0, NULL },
};
#endif /* AX25 */
/* ARP protocol linkages, indexed by arp's hardware type */
struct arp_type Arp_type[NHWTYPES] = {
#ifdef NETROM
{ AXALEN, 0, 0, 0, NULL, pax25, setcall }, /* ARP_NETROM */
#else
{ 0, 0, 0, 0, NULL,NULL,NULL },
#endif
#ifdef ETHER
{ EADDR_LEN,IP_TYPE,ARP_TYPE,1,Ether_bdcst,pether,gether }, /* ARP_ETHER */
#else
{ 0, 0, 0, 0, NULL,NULL,NULL },
#endif
{ 0, 0, 0, 0, NULL,NULL,NULL }, /* ARP_EETHER */
#ifdef AX25
{ AXALEN, PID_IP, PID_ARP, 10, Ax25multi[0], pax25, setcall },
#else
{ 0, 0, 0, 0, NULL,NULL,NULL }, /* ARP_AX25 */
#endif
{ 0, 0, 0, 0, NULL,NULL,NULL }, /* ARP_PRONET */
{ 0, 0, 0, 0, NULL,NULL,NULL }, /* ARP_CHAOS */
{ 0, 0, 0, 0, NULL,NULL,NULL }, /* ARP_IEEE802 */
#ifdef ARCNET
{ AADDR_LEN, ARC_IP, ARC_ARP, 1, ARC_bdcst, parc, garc }, /* ARP_ARCNET */
#else
{ 0, 0, 0, 0, NULL,NULL,NULL },
#endif
{ 0, 0, 0, 0, NULL,NULL,NULL } /* ARP_APPLETALK */
};
/* Get rid of trace references in Iftypes[] if TRACE is turned off */
#ifndef TRACE
#define ip_dump NULL
#define ax25_dump NULL
#define ki_dump NULL
#define sl_dump NULL
#define ether_dump NULL
#define ppp_dump NULL
#define arc_dump NULL
#endif /* TRACE */
/* Table of interface types. Contains most device- and encapsulation-
* dependent info
*/
struct iftype Iftypes[] = {
/* This entry must be first, since Loopback refers to it */
{ "None", nu_send, nu_output, NULL,
NULL, CL_NONE, 0, ip_proc,
NULL, ip_dump, NULL, NULL },
#ifdef AX25
{ "AX25UI", axui_send, ax_output, pax25,
setcall, CL_AX25, AXALEN, ax_recv,
ax_forus, ax25_dump, NULL, NULL },
{ "AX25I", axi_send, ax_output, pax25,
setcall, CL_AX25, AXALEN, ax_recv,
ax_forus, ax25_dump, NULL, NULL },
#endif /* AX25 */
#ifdef KISS
{ "KISSUI", axui_send, ax_output, pax25,
setcall, CL_AX25, AXALEN, kiss_recv,
ki_forus, ki_dump, NULL, NULL },
{ "KISSI", axi_send, ax_output, pax25,
setcall, CL_AX25, AXALEN, kiss_recv,
ki_forus, ki_dump, NULL, NULL },
#endif /* KISS */
#ifdef SLIP
{ "SLIP", slip_send, NULL, NULL,
NULL, CL_NONE, 0, ip_proc,
NULL, ip_dump,
#ifdef DIALER
sd_init, sd_stat },
#else
NULL, NULL },
#endif
#endif /* SLIP */
#ifdef VJCOMPRESS
{ "VJSLIP", vjslip_send, NULL, NULL,
NULL, CL_NONE, 0, ip_proc,
NULL, sl_dump,
#ifdef DIALER
sd_init, sd_stat },
#else
NULL, NULL },
#endif
#endif /* VJCOMPRESS */
#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, eproc,
ether_forus, ether_dump, NULL, NULL },
#endif /* ETHER */
#ifdef NETROM
{ "NETROM", nr_send, NULL, pax25,
setcall, CL_NETROM, AXALEN, NULL,
NULL, NULL, NULL, NULL },
#endif /* NETROM */
#ifdef SLFP
{ "SLFP", pk_send, NULL, NULL,
NULL, CL_NONE, 0, ip_proc,
NULL, ip_dump, NULL, NULL },
#endif /* SLFP */
#ifdef PPP
{ "PPP", ppp_send, ppp_output, NULL,
NULL, CL_PPP, 0, ppp_proc,
NULL, ppp_dump, NULL, NULL },
#endif /* PPP */
#ifdef SPPP
{ "sppp", sppp_send, NULL, NULL,
NULL, CL_NONE, 0, ip_proc,
NULL, ip_dump, NULL, NULL },
#endif /* SPPP */
#ifdef ARCNET
{ "Arcnet", anet_send, anet_output, parc,
garc, CL_ARCNET, 1, aproc,
arc_forus, arc_dump, NULL, NULL },
#endif /* ARCNET */
#ifdef QTSO
{ "QTSO", qtso_send, NULL, NULL,
NULL, CL_NONE, 0, ip_proc,
NULL, NULL, NULL, NULL },
#endif /* QTSO */
#ifdef CDMA_DM
"CDMA", rlp_send, NULL, NULL,
NULL, CL_NONE, 0, ip_proc,
NULL, ip_dump, dd_init, dd_stat,
#endif
#ifdef DMLITE
{ "DMLITE", rlp_send, NULL, NULL,
NULL, CL_NONE, 0, ip_proc,
NULL, ip_dump, dl_init, dl_stat },
#endif
{ NULL, NULL, NULL, NULL,
NULL, -1, 0, NULL,
NULL, NULL, NULL, NULL },
};
/* Asynchronous interface mode table */
#ifdef ASY
struct asymode Asymode[] = {
#ifdef SLIP
{ "SLIP", FR_END, slip_init, slip_free },
{ "VJSLIP", FR_END, slip_init, slip_free },
#endif
#ifdef KISS
{ "AX25UI", FR_END, kiss_init, kiss_free },
{ "AX25I", FR_END, kiss_init, kiss_free },
{ "KISSUI", FR_END, kiss_init, kiss_free },
{ "KISSI", FR_END, kiss_init, kiss_free },
#endif
#ifdef NRS
{ "NRS", ETX, nrs_init, nrs_free },
#endif
#ifdef PPP
{ "PPP", HDLC_FLAG, ppp_init, ppp_free },
#endif
#ifdef SPPP
{ "SPPP", HDLC_FLAG, sppp_init, sppp_free },
#endif
#ifdef QTSO
{ "QTSO", HDLC_FLAG, qtso_init, qtso_free },
#endif
#ifdef DMLITE
{ "DMLITE", HDLC_FLAG, dml_init, dml_stop },
#endif
{ NULL },
};
#else /* not ASY */
/* Stubs for refs to asy I/O in stdio when ASY not configured */
int
asy_open(char *name)
{
return -1;
}
asy_write(int dev,const void *buf,unsigned short cnt)
{
return -1;
}
int
asy_read(int dev,void *buf,unsigned short cnt)
{
return -1;
}
int
asy_close(int dev)
{
return -1;
}
int32
asy_ioctl(struct iface *ifp,int cmd,int set,int32 val)
{
return -1;
}
#endif /* ASY */
/* daemons to be run at startup time */
struct daemon Daemons[] = {
{ "killer", 512, killer },
#ifndef USE_SYSTEM_MALLOC
{ "gcollect", 256, gcollect },
#endif
{ "timer", 1024, timerproc },
{ "network", 1536, network },
{ "keyboard", 250, keyboard },
#ifndef UNIX
{ "random init", 650, rand_init },
#endif
#ifdef PHOTURIS
{ "keygen", 2048, gendh },
{ "key mgmt", 2048, phot_proc },
#endif
{ NULL, 0, NULL }
};
/* Functions to be called on each clock tick */
void (*Cfunc[])() = {
#ifdef MSDOS
pctick, /* Call PC-specific stuff to keep time */
#endif
sesflush, /* Flush current session output */
#ifdef ASY
#ifndef UNIX
asytimer,
#endif
#endif
#ifdef SCC
scctimer,
#endif
#ifndef UNIX
kbint, /* gdb 4.12 doesn't pass kb interrupts */
#endif
NULL,
};
#ifndef USE_SYSTEM_MALLOC
/* Entry points for garbage collection */
void (*Gcollect[])() = {
tcp_garbage,
ip_garbage,
udp_garbage,
st_garbage,
mbuf_garbage,
#ifdef AX25
lapb_garbage,
#endif
#ifdef NETROM
nr_garbage,
#endif
NULL
};
#endif
/* Functions to be called at shutdown */
void (*Shutdown[])() = {
#ifdef ASY
#ifdef MSDOS
fp_stop,
#endif
#endif
#ifdef SCC
sccstop,
#endif
#ifdef SOUND
sbshut,
#endif
NULL,
};
#ifdef MAILBOX
void (*Listusers)(kFILE *network) = listusers;
#else
void (*Listusers)(kFILE *network) = NULL;
#endif /* MAILBOX */
#ifndef BOOTP
int WantBootp = 0;
int
bootp_validPacket(ip,bp)
struct ip *ip;
struct mbuf *bp;
{
return 0;
}
#endif /* BOOTP */
/* Packet tracing stuff */
#ifdef TRACE
#include "core/trace.h"
#else /* TRACE */
/* Stub for packet dump function */