?? config.c
字號:
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(name)
char *name;
{
return -1;
}
int
asy_close(dev)
int dev;
{
}
asy_write(dev,buf,cnt)
int dev;
char *buf;
int cnt;
{
return -1;
}
int
asy_read(dev,buf,cnt);
int dev;
char *buf;
int cnt;
{
return -1;
}
int
asy_close(dev)
int dev;
{
return -1;
}
#endif /* ASY */
#ifndef IPSEC
void
rtype(uint16 c)
{
}
#endif
/* daemons to be run at startup time */
struct daemon Daemons[] = {
"killer", 512, killer,
"gcollect", 256, gcollect,
"timer", 1024, timerproc,
"network", 1536, network,
"keyboard", 250, keyboard,
"random init", 650, rand_init,
#ifdef PHOTURIS
"keygen", 2048, gendh,
"key mgmt", 2048, phot_proc,
#endif
NULL, 0, NULL
};
/* Functions to be called on each clock tick */
void (*Cfunc[])() = {
pctick, /* Call PC-specific stuff to keep time */
sesflush, /* Flush current session output */
#ifdef ASY
asytimer,
#endif
#ifdef SCC
scctimer,
#endif
NULL,
};
/* 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
};
/* Functions to be called at shutdown */
void (*Shutdown[])() = {
#ifdef ASY
fp_stop,
#endif
#ifdef SCC
sccstop,
#endif
#ifdef SOUND
sbshut,
#endif
uchtimer, /* Unlink timer handler from timer chain */
NULL,
};
#ifdef MAILBOX
void (*Listusers)(FILE *network) = listusers;
#else
void (*Listusers)(FILE *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 "trace.h"
#else /* TRACE */
/* Stub for packet dump function */
void
dump(iface,direction,type,bp)
struct iface *iface;
int direction;
unsigned type;
struct mbuf *bp;
{
}
void
raw_dump(iface,direction,bp)
struct iface *iface;
int direction;
struct mbuf *bp;
{
}
#endif /* TRACE */
#ifndef TRACEBACK
void
stktrace()
{
}
#endif
#ifndef LZW
void
lzwfree(up)
struct usock *up;
{
}
#endif
#ifdef AX25
/* Hooks for passing incoming AX.25 data frames to network protocols */
static void
axip(
struct iface *iface,
struct ax25_cb *axp,
uint8 *src,
uint8 *dest,
struct mbuf **bpp,
int mcast
){
(void)ip_route(iface,bpp,mcast);
}
static void
axarp(
struct iface *iface,
struct ax25_cb *axp,
uint8 *src,
uint8 *dest,
struct mbuf **bpp,
int mcast
){
(void)arp_input(iface,bpp);
}
#ifdef NETROM
static void
axnr(
struct iface *iface,
struct ax25_cb *axp,
uint8 *src,
uint8 *dest,
struct mbuf **bpp,
int mcast
){
if(!mcast)
nr_route(bpp,axp);
else
nr_nodercv(iface,src,bpp);
}
#endif /* NETROM */
#endif /* AX25 */
#ifndef RIP
/* Stub for routing timeout when RIP is not configured -- just remove entry */
void
rt_timeout(s)
void *s;
{
struct route *stale = (struct route *)s;
rt_drop(stale->target,stale->bits);
}
#endif
/* Stubs for demand dialer */
#ifndef DIALER
void
dialer_kick(asyp)
struct asy *asyp;
{
}
#endif
/* Stubs for Van Jacobsen header compression */
#if !defined(VJCOMPRESS) && defined(ASY)
struct slcompress *
slhc_init(rslots,tslots)
int rslots;
int tslots;
{
return NULLSLCOMPR;
}
int
slhc_compress(comp, bpp, compress_cid)
struct slcompress *comp;
struct mbuf **bpp;
int compress_cid;
{
return SL_TYPE_IP;
}
int
slhc_uncompress(comp, bpp)
struct slcompress *comp;
struct mbuf **bpp;
{
return -1; /* Can't decompress */
}
void
shlc_i_status(comp)
struct slcompress *comp;
{
}
void
shlc_o_status(comp)
struct slcompress *comp;
{
}
int
slhc_remember(comp, bpp)
struct slcompress *comp;
struct mbuf **bpp;
{
return -1;
}
#endif /* !defined(VJCOMPRESS) && defined(ASY) */
#ifdef SERVERS
static int
dostart(argc,argv,p)
int argc;
char *argv[];
void *p;
{
return subcmd(Startcmds,argc,argv,p);
}
static int
dostop(argc,argv,p)
int argc;
char *argv[];
void *p;
{
return subcmd(Stopcmds,argc,argv,p);
}
#endif /* SERVERS */
dotest(argc,argv,p)
int argc;
char *argv[];
void *p;
{
int32 stime,ftime;
char *bufa,*bufb;
int i;
bufa = malloc(1024);
bufb = malloc(1024);
stime = msclock();
for(i=0;i<1000;i++)
memcpy(bufa,bufb,1024);
ftime = msclock();
printf("Time for 1000 1024-byte copies: %lu ms\n",ftime - stime);
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -