mars_nwe-0.96.pl06
This commit is contained in:
parent
42aa23ed0b
commit
164365d514
8
CHANGES
8
CHANGES
@ -52,4 +52,10 @@ Erste 'oeffentliche' Version
|
|||||||
geschrieben.
|
geschrieben.
|
||||||
- SAP Responses gehen nun immer ueber den SAP Socket.
|
- SAP Responses gehen nun immer ueber den SAP Socket.
|
||||||
- Routing Bereich (SAP's) erweitert.
|
- Routing Bereich (SAP's) erweitert.
|
||||||
|
- SAP Broadcasts haben nun Packettyp '4'.
|
||||||
|
- Volume Info's (Volume Size usw.) korrigiert.
|
||||||
|
- Nun auch neue Konstante MAX_NW_SERVERS in config.h
|
||||||
|
- Routing and Server Tabelle (Info) kann nun in Datei ausgegeben werden.
|
||||||
|
- Es kann nun gesteuert werden (nw.ini:310), dass wdogs zu einer
|
||||||
|
connection nur gesendet werden, falls der client ueber eine device
|
||||||
|
net < angebbarer anzahl tics ist. (z.B. fuer IPX ueber ISDN)
|
||||||
|
32
connect.c
32
connect.c
@ -1,4 +1,4 @@
|
|||||||
/* connect.c 02-Jan-96 */
|
/* connect.c 13-Jan-96 */
|
||||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -698,7 +698,7 @@ static int build_verz_name(NW_PATH *nwpath, /* gets complete path */
|
|||||||
while (*xp++ == '.' && completition > -1) {
|
while (*xp++ == '.' && completition > -1) {
|
||||||
p1--; /* steht nun auf letztem Zeichen '/' od. ':' */
|
p1--; /* steht nun auf letztem Zeichen '/' od. ':' */
|
||||||
if (p1 < panf) completition = -0x9c ;
|
if (p1 < panf) completition = -0x9c ;
|
||||||
/* Falscher Pfad, denn weiter zurueck gehts nicht */
|
/* wrong path, don't can go back any more */
|
||||||
else {
|
else {
|
||||||
while (p1 > panf && *(--p1) != '/');;
|
while (p1 > panf && *(--p1) != '/');;
|
||||||
if (p1 == panf) *p1='\0';
|
if (p1 == panf) *p1='\0';
|
||||||
@ -1081,7 +1081,7 @@ int nw_server_copy(int qfhandle, uint32 qoffset,
|
|||||||
return(retsize);
|
return(retsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(- 0x88); /* Falscher Filehandle */
|
return(- 0x88); /* wrong filehandle */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1374,7 +1374,7 @@ int nw_search(uint8 *info,
|
|||||||
}
|
}
|
||||||
return(searchsequence);
|
return(searchsequence);
|
||||||
} else return(-0xff); /* not found */
|
} else return(-0xff); /* not found */
|
||||||
} else return(completition); /* Falscher Pfad */
|
} else return(completition); /* wrong path */
|
||||||
}
|
}
|
||||||
|
|
||||||
int nw_dir_search(uint8 *info,
|
int nw_dir_search(uint8 *info,
|
||||||
@ -1468,7 +1468,7 @@ int nw_free_dir_handle(int dir_handle)
|
|||||||
{
|
{
|
||||||
if (dir_handle && --dir_handle < (int)used_dirs) {
|
if (dir_handle && --dir_handle < (int)used_dirs) {
|
||||||
NW_DIR *d=&(dirs[dir_handle]);
|
NW_DIR *d=&(dirs[dir_handle]);
|
||||||
if (!d->inode) return(-0x9b); /* Falscher Handle */
|
if (!d->inode) return(-0x9b); /* wrong handle */
|
||||||
else {
|
else {
|
||||||
d->inode = 0;
|
d->inode = 0;
|
||||||
xfree(d->path);
|
xfree(d->path);
|
||||||
@ -1500,7 +1500,7 @@ int nw_get_directory_path(int dir_handle, uint8 *name)
|
|||||||
name[0] = '\0';
|
name[0] = '\0';
|
||||||
if (dir_handle > 0 && --dir_handle < (int)used_dirs) {
|
if (dir_handle > 0 && --dir_handle < (int)used_dirs) {
|
||||||
int volume = dirs[dir_handle].volume;
|
int volume = dirs[dir_handle].volume;
|
||||||
if (volume < used_vols){
|
if (volume > -1 && volume < used_vols){
|
||||||
result=sprintf((char*)name, "%s:%s", vols[volume].sysname, dirs[dir_handle].path);
|
result=sprintf((char*)name, "%s:%s", vols[volume].sysname, dirs[dir_handle].path);
|
||||||
if (name[result-1] == '/') name[--result] = '\0';
|
if (name[result-1] == '/') name[--result] = '\0';
|
||||||
} else result = -0x98;
|
} else result = -0x98;
|
||||||
@ -1512,10 +1512,10 @@ int nw_get_directory_path(int dir_handle, uint8 *name)
|
|||||||
int nw_get_vol_number(int dir_handle)
|
int nw_get_vol_number(int dir_handle)
|
||||||
/* Get Volume Nummmer with Handle */
|
/* Get Volume Nummmer with Handle */
|
||||||
{
|
{
|
||||||
int result = -0x9b; /* Falsches Handle */
|
int result = -0x9b; /* wrong handle */
|
||||||
if (dir_handle > 0 && --dir_handle < (int)used_dirs) {
|
if (dir_handle > 0 && --dir_handle < (int)used_dirs) {
|
||||||
result = dirs[dir_handle].volume;
|
result = dirs[dir_handle].volume;
|
||||||
if (result >= used_vols) result = -0x98; /* Falsches Volume */
|
if (result < 0 || result >= used_vols) result = -0x98; /* wrong volume */
|
||||||
}
|
}
|
||||||
XDPRINTF((5,0,"nw_get_vol_number:0x%x: von Handle=%d", result, dir_handle+1));
|
XDPRINTF((5,0,"nw_get_vol_number:0x%x: von Handle=%d", result, dir_handle+1));
|
||||||
return(result);
|
return(result);
|
||||||
@ -1545,10 +1545,22 @@ int nw_get_volume_name(int volnr, uint8 *volname)
|
|||||||
{
|
{
|
||||||
int result = -0x98; /* Volume not exist */;
|
int result = -0x98; /* Volume not exist */;
|
||||||
if (volnr < used_vols) {
|
if (volnr < used_vols) {
|
||||||
|
if (volname != NULL) {
|
||||||
strcpy(volname, vols[volnr].sysname);
|
strcpy(volname, vols[volnr].sysname);
|
||||||
result = strlen(volname);
|
result = strlen(volname);
|
||||||
} else volname[0] = '\0';
|
} else result= strlen(vols[volnr].sysname);
|
||||||
|
} else {
|
||||||
|
if (NULL != volname) *volname = '\0';
|
||||||
|
if (volnr < MAX_NW_VOLS) result=0;
|
||||||
|
}
|
||||||
|
if (nw_debug > 4) {
|
||||||
|
char xvolname[10];
|
||||||
|
if (!volname) {
|
||||||
|
volname = xvolname;
|
||||||
|
*volname = '\0';
|
||||||
|
}
|
||||||
XDPRINTF((5,0,"GET_VOLUME_NAME von:%d = %s: ,result=0x%x", volnr, volname, result));
|
XDPRINTF((5,0,"GET_VOLUME_NAME von:%d = %s: ,result=0x%x", volnr, volname, result));
|
||||||
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1675,7 +1687,7 @@ int nw_get_vol_info(int volnr)
|
|||||||
/* returns >= 0 if OK, else errocode < 0 */
|
/* returns >= 0 if OK, else errocode < 0 */
|
||||||
{
|
{
|
||||||
int result = -0x98; /* Volume not exist */;
|
int result = -0x98; /* Volume not exist */;
|
||||||
if (volnr < used_vols) {
|
if (volnr > -1 && volnr < used_vols) {
|
||||||
result =0;
|
result =0;
|
||||||
}
|
}
|
||||||
XDPRINTF((5,0,"NW_GET_VOL_INFO von VOLNR:%d, result=0x%x", volnr, result));
|
XDPRINTF((5,0,"NW_GET_VOL_INFO von VOLNR:%d, result=0x%x", volnr, result));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* config.h: 03-Jan-96 */
|
/* config.h: 14-Jan-96 */
|
||||||
/* some of this config is needed by make, others by cc */
|
/* some of this config is needed by make, others by cc */
|
||||||
#define FILENAME_NW_INI "/etc/nwserv.conf" /* full name of ini (conf) file */
|
#define FILENAME_NW_INI "/etc/nwserv.conf" /* full name of ini (conf) file */
|
||||||
#define PATHNAME_PROGS "/sbin" /* path location of progs */
|
#define PATHNAME_PROGS "/sbin" /* path location of progs */
|
||||||
@ -13,5 +13,4 @@
|
|||||||
#define IPX_DATA_GR_546 1 /* allow ipx packets > 546+30 Byte */
|
#define IPX_DATA_GR_546 1 /* allow ipx packets > 546+30 Byte */
|
||||||
|
|
||||||
#define MAX_NW_ROUTES 50 /* max. networks (internal + external) */
|
#define MAX_NW_ROUTES 50 /* max. networks (internal + external) */
|
||||||
|
#define MAX_NW_SERVERS 40 /* max. count of servers */
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# (C)opyright 1993, 1995, Martin Stover, Softwareentwicklung, Marburg
|
# (C)opyright 1993, 1995, Martin Stover, Softwareentwicklung, Marburg
|
||||||
# last change: 20-Dec-95
|
# last change: 14-Jan-96
|
||||||
# MAR.S NW-Server Emulator
|
# MAR.S NW-Server Emulator
|
||||||
# Einfache Konfiguration, alles ab # ist Kommentar.
|
# Einfache Konfiguration, alles ab # ist Kommentar.
|
||||||
# Jeder Eintrag beginnt mit einer Zahl und dann folgt der Inhalt.
|
# Jeder Eintrag beginnt mit einer Zahl und dann folgt der Inhalt.
|
||||||
@ -86,5 +86,13 @@
|
|||||||
#############################
|
#############################
|
||||||
210 10 # 1 .. 600 (default 10) seconds after server really goes down
|
210 10 # 1 .. 600 (default 10) seconds after server really goes down
|
||||||
# # after a down command
|
# # after a down command
|
||||||
|
#############################
|
||||||
|
300 0 # > 0 print routing info to file every x broadcasts. ( minuts )
|
||||||
|
301 /tmp/nw.routes # filename.
|
||||||
|
302 1 # creat new filename=1, append to file=0
|
||||||
|
#############################
|
||||||
|
310 7 # send wdog's only to device net < x tics.
|
||||||
|
# 0 = allways send wdogs. < 0 = never send wdogs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# makefile.unx 09-Jan-96
|
# makefile.unx 12-Jan-96
|
||||||
VPATH=..
|
VPATH=..
|
||||||
O=.o
|
O=.o
|
||||||
C=.c
|
C=.c
|
||||||
@ -6,7 +6,7 @@ C=.c
|
|||||||
DEBUG=-DDB
|
DEBUG=-DDB
|
||||||
V_H=0
|
V_H=0
|
||||||
V_L=96
|
V_L=96
|
||||||
P_L=5
|
P_L=6
|
||||||
#define D_P_L 1
|
#define D_P_L 1
|
||||||
DISTRIB=mars_nwe
|
DISTRIB=mars_nwe
|
||||||
#if D_P_L
|
#if D_P_L
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Begin3
|
Begin3
|
||||||
Title: mars_nwe
|
Title: mars_nwe
|
||||||
Version: 0.96pl4
|
Version: 0.96pl6
|
||||||
Entered-date: 09-Jan-96
|
Entered-date: 14-Jan-96
|
||||||
Description: full novell-server-emulator (src),beta
|
Description: full novell-server-emulator (src),beta
|
||||||
file-services, bindery-services, printing-services
|
file-services, bindery-services, printing-services
|
||||||
needs no kernelchanges, usefull for testing ipx
|
needs no kernelchanges, usefull for testing ipx
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* ncpserv.c */
|
/* ncpserv.c */
|
||||||
#define REVISION_DATE "09-Jan-96"
|
#define REVISION_DATE "14-Jan-96"
|
||||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
8
net.h
8
net.h
@ -61,12 +61,16 @@
|
|||||||
*( (uint8*) (b) ) = *( ((uint8*) (&a)) +1); \
|
*( (uint8*) (b) ) = *( ((uint8*) (&a)) +1); \
|
||||||
*( ((uint8*) (b)) +1) = *( (uint8*) (&a)); }
|
*( ((uint8*) (b)) +1) = *( (uint8*) (&a)); }
|
||||||
|
|
||||||
|
|
||||||
#define U32_TO_BE32(u, ar) { uint32 a= (u); uint8 *b= ((uint8*)(ar))+3; \
|
#define U32_TO_BE32(u, ar) { uint32 a= (u); uint8 *b= ((uint8*)(ar))+3; \
|
||||||
*b-- = (uint8)a; a >>= 8; \
|
*b-- = (uint8)a; a >>= 8; \
|
||||||
*b-- = (uint8)a; a >>= 8; \
|
*b-- = (uint8)a; a >>= 8; \
|
||||||
*b-- = (uint8)a; a >>= 8; \
|
*b-- = (uint8)a; a >>= 8; \
|
||||||
*b = (uint8)a; }
|
*b = (uint8)a; }
|
||||||
|
|
||||||
|
#define U16_TO_16(u, b) { uint16 a=(u); memcpy(b, &a, 2); }
|
||||||
|
#define U32_TO_32(u, b) { uint32 a=(u); memcpy(b, &a, 4); }
|
||||||
|
|
||||||
#define GET_BE16(b) ( (int) *(((uint8*)(b))+1) \
|
#define GET_BE16(b) ( (int) *(((uint8*)(b))+1) \
|
||||||
| ( ( (int) *( (uint8*)(b) ) << 8) ) )
|
| ( ( (int) *( (uint8*)(b) ) << 8) ) )
|
||||||
|
|
||||||
@ -112,6 +116,10 @@
|
|||||||
# define MAX_NW_ROUTES 50
|
# define MAX_NW_ROUTES 50
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAX_NW_SERVERS
|
||||||
|
# define MAX_NW_SERVERS MAX_NW_ROUTES
|
||||||
|
#endif
|
||||||
|
|
||||||
#if IPX_DATA_GR_546
|
#if IPX_DATA_GR_546
|
||||||
# define IPX_MAX_DATA 1058
|
# define IPX_MAX_DATA 1058
|
||||||
#else
|
#else
|
||||||
|
16
net1.c
16
net1.c
@ -1,4 +1,4 @@
|
|||||||
/* net1.c, 09-Jan-96 */
|
/* net1.c, 14-Jan-96 */
|
||||||
|
|
||||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||||
*
|
*
|
||||||
@ -39,17 +39,23 @@ void print_t_info(struct t_info *t)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *visable_ipx_adr(ipxAddr_t *p)
|
char *xvisable_ipx_adr(ipxAddr_t *p, int modus)
|
||||||
{
|
{
|
||||||
static char str[200];
|
static char str[200];
|
||||||
if (p)
|
if (p) {
|
||||||
|
if (!modus) {
|
||||||
sprintf(str,"net=%x:%x:%x:%x, node=%x:%x:%x:%x:%x:%x, sock=%02x:%02x",
|
sprintf(str,"net=%x:%x:%x:%x, node=%x:%x:%x:%x:%x:%x, sock=%02x:%02x",
|
||||||
(int)p->net[0], (int)p->net[1], (int)p->net[2], (int)p->net[3],
|
(int)p->net[0], (int)p->net[1], (int)p->net[2], (int)p->net[3],
|
||||||
(int)p->node[0], (int)p->node[1], (int)p->node[2], (int)p->node[3],
|
(int)p->node[0], (int)p->node[1], (int)p->node[2], (int)p->node[3],
|
||||||
(int)p->node[4], (int)p->node[5], (int)p->sock[0], (int)p->sock[1]);
|
(int)p->node[4], (int)p->node[5], (int)p->sock[0], (int)p->sock[1]);
|
||||||
else
|
} else if (modus== 1) {
|
||||||
|
sprintf(str,"%02X:%02X:%02X:%02X,%02x:%02x:%02x:%02x:%02x:%02x,%02x:%02x",
|
||||||
|
(int)p->net[0], (int)p->net[1], (int)p->net[2], (int)p->net[3],
|
||||||
|
(int)p->node[0], (int)p->node[1], (int)p->node[2], (int)p->node[3],
|
||||||
|
(int)p->node[4], (int)p->node[5], (int)p->sock[0], (int)p->sock[1]);
|
||||||
|
} else strcpy(str, "??");
|
||||||
|
} else
|
||||||
strcpy(str, "net=UNKOWN(NULLPOINTER)");
|
strcpy(str, "net=UNKOWN(NULLPOINTER)");
|
||||||
|
|
||||||
return(str);
|
return(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
net1.h
6
net1.h
@ -1,4 +1,4 @@
|
|||||||
/* net1.h 11-Sep-95 */
|
/* net1.h 14-Jan-96 */
|
||||||
|
|
||||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||||
*
|
*
|
||||||
@ -23,7 +23,9 @@ extern void print_t_info(struct t_info *t);
|
|||||||
extern void print_ud_data(struct t_unitdata *ud);
|
extern void print_ud_data(struct t_unitdata *ud);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern char *visable_ipx_adr(ipxAddr_t *p);
|
extern char *xvisable_ipx_adr(ipxAddr_t *p, int modus);
|
||||||
|
#define visable_ipx_adr(adr) xvisable_ipx_adr((adr), 0)
|
||||||
|
|
||||||
extern void print_ipx_addr(ipxAddr_t *p);
|
extern void print_ipx_addr(ipxAddr_t *p);
|
||||||
extern void print_ipx_data(IPX_DATA *p);
|
extern void print_ipx_data(IPX_DATA *p);
|
||||||
extern void print_sip_data(SIP *sip);
|
extern void print_sip_data(SIP *sip);
|
||||||
|
45
nwconn.c
45
nwconn.c
@ -1,4 +1,4 @@
|
|||||||
/* nwconn.c 09-Jan-96 */
|
/* nwconn.c 13-Jan-96 */
|
||||||
/* one process / connection */
|
/* one process / connection */
|
||||||
|
|
||||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||||
@ -159,9 +159,9 @@ static void handle_ncp_serv()
|
|||||||
if ((result = nw_get_volume_name(volume, xdata->name))>-1){
|
if ((result = nw_get_volume_name(volume, xdata->name))>-1){
|
||||||
struct fs_usage fsp;
|
struct fs_usage fsp;
|
||||||
if (!nw_get_fs_usage(xdata->name, &fsp)) {
|
if (!nw_get_fs_usage(xdata->name, &fsp)) {
|
||||||
U16_TO_BE16(38, xdata->sec_per_block); /* hard coded */
|
U16_TO_BE16(1000, xdata->sec_per_block); /* hard coded */
|
||||||
U16_TO_BE16(fsp.fsu_blocks, xdata->total_blocks);
|
U16_TO_BE16(fsp.fsu_blocks/1000, xdata->total_blocks);
|
||||||
U16_TO_BE16(fsp.fsu_bavail, xdata->avail_blocks);
|
U16_TO_BE16(fsp.fsu_bavail/1000, xdata->avail_blocks);
|
||||||
U16_TO_BE16(fsp.fsu_files, xdata->total_dirs);
|
U16_TO_BE16(fsp.fsu_files, xdata->total_dirs);
|
||||||
U16_TO_BE16(fsp.fsu_ffree, xdata->avail_dirs);
|
U16_TO_BE16(fsp.fsu_ffree, xdata->avail_dirs);
|
||||||
U16_TO_BE16(0, xdata->removable);
|
U16_TO_BE16(0, xdata->removable);
|
||||||
@ -371,8 +371,7 @@ static void handle_ncp_serv()
|
|||||||
} else if (*p == 0x15){ /* liefert Volume Information */
|
} else if (*p == 0x15){ /* liefert Volume Information */
|
||||||
/******** Get Volume Info with Handle ****/
|
/******** Get Volume Info with Handle ****/
|
||||||
struct XDATA {
|
struct XDATA {
|
||||||
uint8 reserve1;
|
uint8 sectors[2];
|
||||||
uint8 len;
|
|
||||||
uint8 total_blocks[2];
|
uint8 total_blocks[2];
|
||||||
uint8 avail_blocks[2];
|
uint8 avail_blocks[2];
|
||||||
uint8 total_dirs[2]; /* anz dirs */
|
uint8 total_dirs[2]; /* anz dirs */
|
||||||
@ -387,9 +386,9 @@ static void handle_ncp_serv()
|
|||||||
if (result > -1) {
|
if (result > -1) {
|
||||||
struct fs_usage fsp;
|
struct fs_usage fsp;
|
||||||
if (!nw_get_fs_usage(xdata->name, &fsp)) {
|
if (!nw_get_fs_usage(xdata->name, &fsp)) {
|
||||||
xdata->len = 8; /* blocks entries */
|
U16_TO_BE16(1000, xdata->sectors);
|
||||||
U16_TO_BE16(fsp.fsu_blocks, xdata->total_blocks);
|
U16_TO_BE16(fsp.fsu_blocks/1000, xdata->total_blocks);
|
||||||
U16_TO_BE16(fsp.fsu_bavail, xdata->avail_blocks);
|
U16_TO_BE16(fsp.fsu_bavail/1000, xdata->avail_blocks);
|
||||||
U16_TO_BE16(fsp.fsu_files, xdata->total_dirs);
|
U16_TO_BE16(fsp.fsu_files, xdata->total_dirs);
|
||||||
U16_TO_BE16(fsp.fsu_ffree, xdata->avail_dirs);
|
U16_TO_BE16(fsp.fsu_ffree, xdata->avail_dirs);
|
||||||
U16_TO_BE16(0, xdata->removable);
|
U16_TO_BE16(0, xdata->removable);
|
||||||
@ -459,7 +458,8 @@ static void handle_ncp_serv()
|
|||||||
input->dir_handle);
|
input->dir_handle);
|
||||||
if (result > -1) data_len = result;
|
if (result > -1) data_len = result;
|
||||||
else completition = (uint8) (-result);
|
else completition = (uint8) (-result);
|
||||||
} else if (*p == 0x20){ /* scan volume user disk restrictions */
|
} else if (*p == 0x20){
|
||||||
|
/* scan volume user disk restrictions */
|
||||||
uint8 volnr = *(p+1);
|
uint8 volnr = *(p+1);
|
||||||
uint32 sequenz = GET_BE32(p+2);
|
uint32 sequenz = GET_BE32(p+2);
|
||||||
struct XDATA {
|
struct XDATA {
|
||||||
@ -468,8 +468,11 @@ static void handle_ncp_serv()
|
|||||||
uint8 id[4];
|
uint8 id[4];
|
||||||
uint8 restriction[4];
|
uint8 restriction[4];
|
||||||
} *xdata = (struct XDATA*) responsedata;
|
} *xdata = (struct XDATA*) responsedata;
|
||||||
|
int result = nw_get_volume_name(volnr, NULL);
|
||||||
|
if (result > -1) {
|
||||||
xdata->entries = 0x0;
|
xdata->entries = 0x0;
|
||||||
data_len = (8 * xdata->entries) + 1;
|
data_len = (8 * xdata->entries) + 1;
|
||||||
|
} else completition = (uint8) (-result);
|
||||||
} else if (*p == 0x21) {
|
} else if (*p == 0x21) {
|
||||||
/* change Vol restrictions for Obj */
|
/* change Vol restrictions for Obj */
|
||||||
uint8 volnr = *(p+1);
|
uint8 volnr = *(p+1);
|
||||||
@ -554,7 +557,7 @@ static void handle_ncp_serv()
|
|||||||
/* ncpfs need this call */
|
/* ncpfs need this call */
|
||||||
int volume = (int) *(p+1);
|
int volume = (int) *(p+1);
|
||||||
struct XDATA {
|
struct XDATA {
|
||||||
uint8 total_blocks[4];
|
uint8 total_blocks[4]; /* LOW-HI !! */
|
||||||
uint8 avail_blocks[4];
|
uint8 avail_blocks[4];
|
||||||
uint8 purgeable_blocks[4];
|
uint8 purgeable_blocks[4];
|
||||||
uint8 not_purgeable_blocks[4];
|
uint8 not_purgeable_blocks[4];
|
||||||
@ -571,11 +574,11 @@ static void handle_ncp_serv()
|
|||||||
struct fs_usage fsp;
|
struct fs_usage fsp;
|
||||||
memset(xdata, 0, sizeof(struct XDATA));
|
memset(xdata, 0, sizeof(struct XDATA));
|
||||||
if (!nw_get_fs_usage(name, &fsp)) {
|
if (!nw_get_fs_usage(name, &fsp)) {
|
||||||
xdata->sec_per_block = 38; /* hard coded */
|
xdata->sec_per_block = 1; /* hard coded */
|
||||||
U32_TO_BE32(fsp.fsu_blocks, xdata->total_blocks);
|
U32_TO_32(fsp.fsu_blocks, xdata->total_blocks);
|
||||||
U32_TO_BE32(fsp.fsu_bavail, xdata->avail_blocks);
|
U32_TO_32(fsp.fsu_bavail, xdata->avail_blocks);
|
||||||
U32_TO_BE32(fsp.fsu_files, xdata->total_dirs);
|
U32_TO_32(fsp.fsu_files, xdata->total_dirs);
|
||||||
U32_TO_BE32(fsp.fsu_ffree, xdata->avail_dirs);
|
U32_TO_32(fsp.fsu_ffree, xdata->avail_dirs);
|
||||||
}
|
}
|
||||||
xdata->namlen = strlen(name);
|
xdata->namlen = strlen(name);
|
||||||
strmaxcpy(xdata->name, name, xdata->namlen);
|
strmaxcpy(xdata->name, name, xdata->namlen);
|
||||||
@ -602,11 +605,11 @@ static void handle_ncp_serv()
|
|||||||
struct fs_usage fsp;
|
struct fs_usage fsp;
|
||||||
memset(xdata, 0, sizeof(struct XDATA));
|
memset(xdata, 0, sizeof(struct XDATA));
|
||||||
if (!nw_get_fs_usage(name, &fsp)) {
|
if (!nw_get_fs_usage(name, &fsp)) {
|
||||||
xdata->sec_per_block = 38; /* hard coded */
|
xdata->sec_per_block = 1; /* hard coded */
|
||||||
U32_TO_BE32(fsp.fsu_blocks, xdata->total_blocks);
|
U32_TO_32(fsp.fsu_blocks, xdata->total_blocks);
|
||||||
U32_TO_BE32(fsp.fsu_bavail, xdata->avail_blocks);
|
U32_TO_32(fsp.fsu_bavail, xdata->avail_blocks);
|
||||||
U32_TO_BE32(fsp.fsu_files, xdata->total_dirs);
|
U32_TO_32(fsp.fsu_files, xdata->total_dirs);
|
||||||
U32_TO_BE32(fsp.fsu_ffree, xdata->avail_dirs);
|
U32_TO_32(fsp.fsu_ffree, xdata->avail_dirs);
|
||||||
}
|
}
|
||||||
xdata->namlen = strlen(name);
|
xdata->namlen = strlen(name);
|
||||||
strmaxcpy(xdata->name, name, xdata->namlen);
|
strmaxcpy(xdata->name, name, xdata->namlen);
|
||||||
|
18
nwdbm.c
18
nwdbm.c
@ -1,4 +1,4 @@
|
|||||||
/* nwdbm.c 08-Jan-96 data base for mars_nwe */
|
/* nwdbm.c 13-Jan-96 data base for mars_nwe */
|
||||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -951,14 +951,19 @@ int nw_test_passwd(uint32 obj_id, uint8 *vgl_key, uint8 *akt_key)
|
|||||||
|
|
||||||
int nw_set_enpasswd(uint32 obj_id, uint8 *passwd)
|
int nw_set_enpasswd(uint32 obj_id, uint8 *passwd)
|
||||||
{
|
{
|
||||||
|
uint8 *prop_name="PASSWORD";
|
||||||
|
if (passwd && *passwd) {
|
||||||
nw_new_create_prop(obj_id, NULL, 0, 0, 0,
|
nw_new_create_prop(obj_id, NULL, 0, 0, 0,
|
||||||
"PASSWORD", P_FL_STAT|P_FL_ITEM, 0x44,
|
prop_name, P_FL_STAT|P_FL_ITEM, 0x44,
|
||||||
passwd, 16);
|
passwd, 16);
|
||||||
|
} else
|
||||||
|
(void)loc_delete_property(obj_id, prop_name, 0);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nw_set_passwd(uint32 obj_id, char *password)
|
int nw_set_passwd(uint32 obj_id, char *password)
|
||||||
{
|
{
|
||||||
|
if (password && *password) {
|
||||||
uint8 passwd[200];
|
uint8 passwd[200];
|
||||||
uint8 s_uid[4];
|
uint8 s_uid[4];
|
||||||
U32_TO_BE32(obj_id, s_uid);
|
U32_TO_BE32(obj_id, s_uid);
|
||||||
@ -984,6 +989,8 @@ int nw_set_passwd(uint32 obj_id, char *password)
|
|||||||
(int)passwd[15]));
|
(int)passwd[15]));
|
||||||
#endif
|
#endif
|
||||||
return(nw_set_enpasswd(obj_id, passwd));
|
return(nw_set_enpasswd(obj_id, passwd));
|
||||||
|
} else
|
||||||
|
return(nw_set_enpasswd(obj_id, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
int prop_add_new_member(uint32 obj_id, int prop_id, uint32 member_id)
|
int prop_add_new_member(uint32 obj_id, int prop_id, uint32 member_id)
|
||||||
@ -1085,7 +1092,10 @@ static void add_user(uint32 u_id, uint32 g_id,
|
|||||||
"UNIX_USER", P_FL_ITEM, 0x33,
|
"UNIX_USER", P_FL_ITEM, 0x33,
|
||||||
(char*)unname, strlen(unname));
|
(char*)unname, strlen(unname));
|
||||||
|
|
||||||
if (password && *password) nw_set_passwd(u_id, password);
|
if (password && *password) {
|
||||||
|
if (*password == '-') *password='\0';
|
||||||
|
nw_set_passwd(u_id, password);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nw_fill_standard(char *servername, ipxAddr_t *adr)
|
void nw_fill_standard(char *servername, ipxAddr_t *adr)
|
||||||
@ -1214,7 +1224,7 @@ void nw_init_dbm(char *servername, ipxAddr_t *adr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbmclose();
|
dbmclose();
|
||||||
while (anz--) loc_delete_property(objs[anz], (char*)NULL, props[anz]); /* Nun l”schen */
|
while (anz--) loc_delete_property(objs[anz], (char*)NULL, props[anz]); /* now delete */
|
||||||
nw_fill_standard(servername, adr);
|
nw_fill_standard(servername, adr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
135
nwroute.c
135
nwroute.c
@ -1,4 +1,4 @@
|
|||||||
/* nwroute.c 11-Jan-96 */
|
/* nwroute.c 14-Jan-96 */
|
||||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -32,16 +32,16 @@ static int anz_routes=0;
|
|||||||
static NW_ROUTES *nw_routes[MAX_NW_ROUTES];
|
static NW_ROUTES *nw_routes[MAX_NW_ROUTES];
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8 *name;
|
uint8 *name; /* Server Name */
|
||||||
int typ;
|
int typ; /* Server Typ */
|
||||||
ipxAddr_t addr;
|
ipxAddr_t addr; /* Server Addr */
|
||||||
int net; /* routing over NET */
|
uint32 net; /* routing over NET */
|
||||||
int hops;
|
int hops;
|
||||||
int flags;
|
int flags;
|
||||||
} NW_SERVERS;
|
} NW_SERVERS;
|
||||||
|
|
||||||
static int anz_servers=0;
|
static int anz_servers=0;
|
||||||
static NW_SERVERS *nw_servers[MAX_NW_ROUTES];
|
static NW_SERVERS *nw_servers[MAX_NW_SERVERS];
|
||||||
|
|
||||||
static void insert_delete_net(uint32 destnet,
|
static void insert_delete_net(uint32 destnet,
|
||||||
uint32 rnet, /* routernet */
|
uint32 rnet, /* routernet */
|
||||||
@ -116,9 +116,35 @@ static void insert_delete_net(uint32 destnet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void insert_delete_server(uint8 *name,
|
|
||||||
int styp,
|
NW_NET_DEVICE *find_netdevice(uint32 network)
|
||||||
ipxAddr_t *addr,
|
/* return the device over which the network is routed, I hope */
|
||||||
|
{
|
||||||
|
uint32 net=network;
|
||||||
|
int l=2;
|
||||||
|
XDPRINTF((3, 0, "find_netdevice of network=%lX", net));
|
||||||
|
while (l--) {
|
||||||
|
int k=-1;
|
||||||
|
while (++k < anz_net_devices) {
|
||||||
|
NW_NET_DEVICE *nd=net_devices[k];
|
||||||
|
if (nd->net == net) {
|
||||||
|
XDPRINTF((3, 0, "found netdevive %s, frame=%d, ticks=%d",
|
||||||
|
nd->devname, nd->frame, nd->ticks));
|
||||||
|
return(nd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!l) return(NULL);
|
||||||
|
k=-1;
|
||||||
|
while (++k < anz_routes && nw_routes[k]->net != network);;
|
||||||
|
if (k < anz_routes) net=nw_routes[k]->rnet;
|
||||||
|
else return(NULL);
|
||||||
|
}
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void insert_delete_server(uint8 *name, /* Server Name */
|
||||||
|
int styp, /* Server Typ */
|
||||||
|
ipxAddr_t *addr, /* Server Addr */
|
||||||
ipxAddr_t *from_addr,
|
ipxAddr_t *from_addr,
|
||||||
int hops,
|
int hops,
|
||||||
int do_delete, /* delete = 1 */
|
int do_delete, /* delete = 1 */
|
||||||
@ -141,7 +167,7 @@ void insert_delete_server(uint8 *name,
|
|||||||
while (++k < anz_servers && (nw_servers[k]->typ != styp ||
|
while (++k < anz_servers && (nw_servers[k]->typ != styp ||
|
||||||
!nw_servers[k]->name || strcmp(nw_servers[k]->name, sname)) ) {
|
!nw_servers[k]->name || strcmp(nw_servers[k]->name, sname)) ) {
|
||||||
if (nw_servers[k]->name) {
|
if (nw_servers[k]->name) {
|
||||||
XDPRINTF((3,0, "Server %s = typ=0x%04x",
|
XDPRINTF((10,0, "Server %s = typ=0x%04x",
|
||||||
nw_servers[k]->name, nw_servers[k]->typ));
|
nw_servers[k]->name, nw_servers[k]->typ));
|
||||||
}
|
}
|
||||||
if (freeslot < 0 && !nw_servers[k]->typ) freeslot=k;
|
if (freeslot < 0 && !nw_servers[k]->typ) freeslot=k;
|
||||||
@ -151,8 +177,8 @@ void insert_delete_server(uint8 *name,
|
|||||||
if (do_delete) return; /* nothing to delete */
|
if (do_delete) return; /* nothing to delete */
|
||||||
|
|
||||||
if (freeslot < 0) {
|
if (freeslot < 0) {
|
||||||
if (anz_servers == MAX_NW_ROUTES) {
|
if (anz_servers == MAX_NW_SERVERS) {
|
||||||
XDPRINTF((1, 0, "too many servers=%d, increase MAX_NW_ROUTES in config.h", anz_servers));
|
XDPRINTF((1, 0, "too many servers=%d, increase MAX_NW_SERVERS in config.h", anz_servers));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nw_servers[k] = (NW_SERVERS*)xcmalloc(sizeof(NW_SERVERS));
|
nw_servers[k] = (NW_SERVERS*)xcmalloc(sizeof(NW_SERVERS));
|
||||||
@ -164,9 +190,12 @@ void insert_delete_server(uint8 *name,
|
|||||||
nr->hops = 0xffff;
|
nr->hops = 0xffff;
|
||||||
} else if (do_delete) {
|
} else if (do_delete) {
|
||||||
nr=nw_servers[k];
|
nr=nw_servers[k];
|
||||||
|
if (!IPXCMPNODE(nr->addr.node, my_server_adr.node) ||
|
||||||
|
!IPXCMPNET (nr->addr.net, my_server_adr.net) ) {
|
||||||
if (nr->typ == 4) ins_del_bind_net_addr(nr->name, NULL);
|
if (nr->typ == 4) ins_del_bind_net_addr(nr->name, NULL);
|
||||||
xfree(nr->name);
|
xfree(nr->name);
|
||||||
memset(nr, 0, sizeof(NW_SERVERS));
|
memset(nr, 0, sizeof(NW_SERVERS));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
} else nr=nw_servers[k];
|
} else nr=nw_servers[k];
|
||||||
/* here now i perhaps must change the entry */
|
/* here now i perhaps must change the entry */
|
||||||
@ -284,7 +313,7 @@ static void send_rip_buff(ipxAddr_t *from_addr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_rip_broadcast(int mode)
|
static void send_rip_broadcast(int mode)
|
||||||
/* mode=0, standard broadcast */
|
/* mode=0, standard broadcast */
|
||||||
/* mode=1, first trie */
|
/* mode=1, first trie */
|
||||||
/* mode=2, shutdown */
|
/* mode=2, shutdown */
|
||||||
@ -355,7 +384,7 @@ void handle_rip(int fd, int ipx_pack_typ,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* <========================= SAP ============================> */
|
/* <========================= SAP ============================> */
|
||||||
void send_sap_broadcast(int mode)
|
static void send_sap_broadcast(int mode)
|
||||||
/* mode=0, standard broadcast */
|
/* mode=0, standard broadcast */
|
||||||
/* mode=1, first trie */
|
/* mode=1, first trie */
|
||||||
/* mode=2, shutdown */
|
/* mode=2, shutdown */
|
||||||
@ -363,7 +392,8 @@ void send_sap_broadcast(int mode)
|
|||||||
int k=-1;
|
int k=-1;
|
||||||
while (++k < anz_net_devices) {
|
while (++k < anz_net_devices) {
|
||||||
NW_NET_DEVICE *nd=net_devices[k];
|
NW_NET_DEVICE *nd=net_devices[k];
|
||||||
if (nd->ticks < 7 || mode) { /* isdn devices should not get SAP broadcasts everytime */
|
if (nd->ticks < 7 || mode) {
|
||||||
|
/* isdn devices should not get SAP broadcasts everytime */
|
||||||
IPX_DATA ipx_data;
|
IPX_DATA ipx_data;
|
||||||
ipxAddr_t wild;
|
ipxAddr_t wild;
|
||||||
int j=-1;
|
int j=-1;
|
||||||
@ -373,7 +403,8 @@ void send_sap_broadcast(int mode)
|
|||||||
U16_TO_BE16(SOCK_SAP, wild.sock);
|
U16_TO_BE16(SOCK_SAP, wild.sock);
|
||||||
while (++j < anz_servers) {
|
while (++j < anz_servers) {
|
||||||
NW_SERVERS *nw=nw_servers[j];
|
NW_SERVERS *nw=nw_servers[j];
|
||||||
if (!nw->typ || (nw->net == nd->net && nw->hops)) continue; /* no SAP to this NET */
|
if (!nw->typ || (nw->net == nd->net && nw->hops)
|
||||||
|
|| (mode == 2 && nw->hops) ) continue; /* no SAP to this NET */
|
||||||
memset(&ipx_data, 0, sizeof(ipx_data.sip));
|
memset(&ipx_data, 0, sizeof(ipx_data.sip));
|
||||||
strcpy(ipx_data.sip.server_name, nw->name);
|
strcpy(ipx_data.sip.server_name, nw->name);
|
||||||
memcpy(&ipx_data.sip.server_adr, &(nw->addr), sizeof(ipxAddr_t));
|
memcpy(&ipx_data.sip.server_adr, &(nw->addr), sizeof(ipxAddr_t));
|
||||||
@ -383,12 +414,12 @@ void send_sap_broadcast(int mode)
|
|||||||
U16_TO_BE16(16, ipx_data.sip.intermediate_networks);
|
U16_TO_BE16(16, ipx_data.sip.intermediate_networks);
|
||||||
} else {
|
} else {
|
||||||
U16_TO_BE16(nw->hops+1, ipx_data.sip.intermediate_networks);
|
U16_TO_BE16(nw->hops+1, ipx_data.sip.intermediate_networks);
|
||||||
|
/* I hope hops are ok here */
|
||||||
XDPRINTF((3, 0, "SEND SIP %s,0x%04x, hops=%d",
|
XDPRINTF((3, 0, "SEND SIP %s,0x%04x, hops=%d",
|
||||||
nw->name, nw->typ, nw->hops+1));
|
nw->name, nw->typ, nw->hops+1));
|
||||||
/* I hope 1 is ok here */
|
|
||||||
}
|
}
|
||||||
send_ipx_data(sockfd[SAP_SLOT],
|
send_ipx_data(sockfd[SAP_SLOT],
|
||||||
0,
|
4, /* this is the official packet typ for SAP's */
|
||||||
sizeof(ipx_data.sip),
|
sizeof(ipx_data.sip),
|
||||||
(char *)&(ipx_data.sip),
|
(char *)&(ipx_data.sip),
|
||||||
&wild, "SIP Broadcast");
|
&wild, "SIP Broadcast");
|
||||||
@ -397,6 +428,60 @@ void send_sap_broadcast(int mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FILE *open_route_info_fn(void)
|
||||||
|
{
|
||||||
|
static int tacs=0;
|
||||||
|
FILE *f=NULL;
|
||||||
|
if (print_route_tac > 0) {
|
||||||
|
if (!tacs) {
|
||||||
|
if (NULL != (f=fopen(pr_route_info_fn,
|
||||||
|
(print_route_mode) ? "w" : "a"))) {
|
||||||
|
tacs = print_route_tac-1;
|
||||||
|
} else print_route_tac=0;
|
||||||
|
} else tacs--;
|
||||||
|
}
|
||||||
|
return(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void send_sap_rip_broadcast(int mode)
|
||||||
|
/* mode=0, standard broadcast */
|
||||||
|
/* mode=1, first trie */
|
||||||
|
/* mode=2, shutdown */
|
||||||
|
{
|
||||||
|
send_sap_broadcast(mode);
|
||||||
|
send_rip_broadcast(mode);
|
||||||
|
if (!mode) {
|
||||||
|
FILE *f= open_route_info_fn();
|
||||||
|
if (f) {
|
||||||
|
int k=-1;
|
||||||
|
fprintf(f, "<--------- Routing Table ---------->\n");
|
||||||
|
fprintf(f, "%8s Hops Tics %9s Router Node\n", "Network", "RouterNet");
|
||||||
|
while (++k < anz_routes) {
|
||||||
|
NW_ROUTES *nr = nw_routes[k];
|
||||||
|
if (nr->net) {
|
||||||
|
fprintf(f, "%08lX %4d %4d %08lX %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||||
|
nr->net, nr->hops, nr->ticks, nr->rnet,
|
||||||
|
(int)nr->rnode[0], (int)nr->rnode[1], (int)nr->rnode[2],
|
||||||
|
(int)nr->rnode[3], (int)nr->rnode[4], (int)nr->rnode[5]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
k=-1;
|
||||||
|
fprintf(f, "<--------- Server Table ---------->\n");
|
||||||
|
fprintf(f, "%-20s %4s %9s Hops Server-Address\n","Name", "Typ", "RouterNet");
|
||||||
|
while (++k < anz_servers) {
|
||||||
|
NW_SERVERS *ns = nw_servers[k];
|
||||||
|
if (ns->typ) {
|
||||||
|
char sname[50];
|
||||||
|
strmaxcpy(sname, ns->name, 20);
|
||||||
|
fprintf(f, "%-20s %4d %08lX %4d %s\n", sname, ns->typ,
|
||||||
|
ns->net, ns->hops, xvisable_ipx_adr(&(ns->addr), 1));
|
||||||
|
}
|
||||||
|
} /* while */
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void query_sap_on_net(uint32 net)
|
static void query_sap_on_net(uint32 net)
|
||||||
/* searches for the next server on this network */
|
/* searches for the next server on this network */
|
||||||
{
|
{
|
||||||
@ -419,8 +504,18 @@ void get_servers(void)
|
|||||||
NW_NET_DEVICE *nd=net_devices[k];
|
NW_NET_DEVICE *nd=net_devices[k];
|
||||||
if (nd->ticks < 7) query_sap_on_net(nd->net); /* only fast routes */
|
if (nd->ticks < 7) query_sap_on_net(nd->net); /* only fast routes */
|
||||||
}
|
}
|
||||||
if (!anz_net_devices)
|
if (!anz_net_devices) query_sap_on_net(internal_net);
|
||||||
query_sap_on_net(internal_net);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int dont_send_wdog(ipxAddr_t *addr)
|
||||||
|
/* returns != 0 if tics are to high for wdogs */
|
||||||
|
{
|
||||||
|
NW_NET_DEVICE *nd;
|
||||||
|
if (!wdogs_till_tics) return(0); /* ever send wdogs */
|
||||||
|
else if (wdogs_till_tics < 0) return(1); /* never send wdogs */
|
||||||
|
if (NULL != (nd=find_netdevice(GET_BE32(addr->net))))
|
||||||
|
return((nd->ticks < wdogs_till_tics) ? 0 : 1);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
39
nwserv.c
39
nwserv.c
@ -1,4 +1,4 @@
|
|||||||
/* nwserv.c 09-Jan-96 */
|
/* nwserv.c 14-Jan-96 */
|
||||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -22,7 +22,10 @@
|
|||||||
uint32 internal_net = 0x0L; /* NETWORKNUMMER INTERN (SERVER) */
|
uint32 internal_net = 0x0L; /* NETWORKNUMMER INTERN (SERVER) */
|
||||||
ipxAddr_t my_server_adr; /* Address of this server */
|
ipxAddr_t my_server_adr; /* Address of this server */
|
||||||
char my_nwname[50]; /* Name of this server */
|
char my_nwname[50]; /* Name of this server */
|
||||||
|
int print_route_tac = 0; /* every x broadcasts print it */
|
||||||
|
int print_route_mode = 0; /* append */
|
||||||
|
char *pr_route_info_fn = NULL; /* filename */
|
||||||
|
int wdogs_till_tics = 0; /* send wdogs to all */
|
||||||
/* <========== DEVICES ==========> */
|
/* <========== DEVICES ==========> */
|
||||||
int anz_net_devices=0;
|
int anz_net_devices=0;
|
||||||
NW_NET_DEVICE *net_devices[MAX_NET_DEVICES];
|
NW_NET_DEVICE *net_devices[MAX_NET_DEVICES];
|
||||||
@ -223,12 +226,17 @@ static int start_nwclient(void)
|
|||||||
# define MAX_WDOG_TRIES 11 /* Standardtries */
|
# define MAX_WDOG_TRIES 11 /* Standardtries */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void modify_wdog_conn(int conn, int mode);
|
||||||
|
|
||||||
static void send_wdog_packet(ipxAddr_t *addr, int conn, int what)
|
static void send_wdog_packet(ipxAddr_t *addr, int conn, int what)
|
||||||
{
|
{
|
||||||
uint8 data[2];
|
uint8 data[2];
|
||||||
data[0] = (uint8) conn;
|
data[0] = (uint8) conn;
|
||||||
data[1] = (uint8) what;
|
data[1] = (uint8) what;
|
||||||
|
if (what == '?' && dont_send_wdog(addr)) {
|
||||||
|
modify_wdog_conn(conn, 0);
|
||||||
|
XDPRINTF((2,0, "No wdog to %s", visable_ipx_adr(addr)));
|
||||||
|
} else
|
||||||
send_ipx_data(sockfd[WDOG_SLOT], 17, 2, data, addr, "WDOG");
|
send_ipx_data(sockfd[WDOG_SLOT], 17, 2, data, addr, "WDOG");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,6 +697,18 @@ static void get_ini(int full)
|
|||||||
server_goes_down_secs = 10;
|
server_goes_down_secs = 10;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 300 : print_route_tac=atoi(inhalt);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 301 : new_str(pr_route_info_fn, inhalt);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 302 : print_route_mode=atoi(inhalt);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 310 : wdogs_till_tics=atoi(inhalt);
|
||||||
|
break;
|
||||||
|
|
||||||
default : break;
|
default : break;
|
||||||
} /* switch */
|
} /* switch */
|
||||||
} /* if */
|
} /* if */
|
||||||
@ -696,6 +716,9 @@ static void get_ini(int full)
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
if (client_mode < 2) client_mode=0;
|
if (client_mode < 2) client_mode=0;
|
||||||
|
if (print_route_tac && !pr_route_info_fn && !*pr_route_info_fn)
|
||||||
|
print_route_tac = 0;
|
||||||
|
if (!print_route_tac) xfree(pr_route_info_fn);
|
||||||
if (full) {
|
if (full) {
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
init_ipx(internal_net, node, ipxdebug);
|
init_ipx(internal_net, node, ipxdebug);
|
||||||
@ -730,8 +753,7 @@ static void get_ini(int full)
|
|||||||
|
|
||||||
static void send_down_broadcast(void)
|
static void send_down_broadcast(void)
|
||||||
{
|
{
|
||||||
send_sap_broadcast(2);
|
send_sap_rip_broadcast(2);
|
||||||
send_rip_broadcast(2); /* shutdown rip */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void close_all(void)
|
static void close_all(void)
|
||||||
@ -855,11 +877,15 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
U16_TO_BE16(SOCK_NCP, my_server_adr.sock);
|
U16_TO_BE16(SOCK_NCP, my_server_adr.sock);
|
||||||
if (!start_ncpserv(my_nwname, &my_server_adr)) {
|
if (!start_ncpserv(my_nwname, &my_server_adr)) {
|
||||||
/* Jetzt POLLEN */
|
ipxAddr_t server_adr_sap;
|
||||||
|
/* now do polling */
|
||||||
time_t broadtime;
|
time_t broadtime;
|
||||||
time(&broadtime);
|
time(&broadtime);
|
||||||
set_sigs();
|
set_sigs();
|
||||||
polls[NEEDED_SOCKETS].fd = fd_ncpserv_in;
|
polls[NEEDED_SOCKETS].fd = fd_ncpserv_in;
|
||||||
|
memcpy(&server_adr_sap, &my_server_adr, sizeof(ipxAddr_t));
|
||||||
|
U16_TO_BE16(SOCK_SAP, server_adr_sap.sock);
|
||||||
|
insert_delete_server(my_nwname, 0x4, &my_server_adr, &server_adr_sap, 0, 0, 0);
|
||||||
while (1) {
|
while (1) {
|
||||||
int anz_poll = poll(polls, NEEDED_POLLS, broadsecs);
|
int anz_poll = poll(polls, NEEDED_POLLS, broadsecs);
|
||||||
time(&akttime_stamp);
|
time(&akttime_stamp);
|
||||||
@ -943,8 +969,7 @@ int main(int argc, char **argv)
|
|||||||
if (akttime_stamp - server_down_stamp > server_goes_down_secs) break;
|
if (akttime_stamp - server_down_stamp > server_goes_down_secs) break;
|
||||||
} else {
|
} else {
|
||||||
if (akttime_stamp - broadtime > (broadsecs / 1000)) { /* ca. 60 seconds */
|
if (akttime_stamp - broadtime > (broadsecs / 1000)) { /* ca. 60 seconds */
|
||||||
send_sap_broadcast(broadsecs<3000); /* firsttime broadcast */
|
send_sap_rip_broadcast((broadsecs<3000) ? 1 :0); /* firsttime broadcast */
|
||||||
send_rip_broadcast(broadsecs<3000); /* firsttime broadcast */
|
|
||||||
if (broadsecs < 32000) {
|
if (broadsecs < 32000) {
|
||||||
rip_for_net(MAX_U32);
|
rip_for_net(MAX_U32);
|
||||||
get_servers();
|
get_servers();
|
||||||
|
11
nwserv.h
11
nwserv.h
@ -1,4 +1,4 @@
|
|||||||
/* nwserv.h 11-Jan-96 */
|
/* nwserv.h 14-Jan-96 */
|
||||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -19,7 +19,10 @@
|
|||||||
extern uint32 internal_net; /* NETWORKNUMMER INTERN (SERVER) */
|
extern uint32 internal_net; /* NETWORKNUMMER INTERN (SERVER) */
|
||||||
extern ipxAddr_t my_server_adr; /* Address of this server */
|
extern ipxAddr_t my_server_adr; /* Address of this server */
|
||||||
extern char my_nwname[50]; /* Name of this server */
|
extern char my_nwname[50]; /* Name of this server */
|
||||||
|
extern int print_route_tac; /* every x broadcasts print it */
|
||||||
|
extern int print_route_mode; /* append */
|
||||||
|
extern char *pr_route_info_fn; /* filename */
|
||||||
|
extern int wdogs_till_tics;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *devname; /* "eth0" or "isdnX" */
|
char *devname; /* "eth0" or "isdnX" */
|
||||||
@ -46,8 +49,7 @@ extern NW_NET_DEVICE *net_devices[];
|
|||||||
extern int sockfd[];
|
extern int sockfd[];
|
||||||
|
|
||||||
extern void ins_del_bind_net_addr(char *name, ipxAddr_t *adr);
|
extern void ins_del_bind_net_addr(char *name, ipxAddr_t *adr);
|
||||||
extern void send_rip_broadcast(int mode);
|
extern void send_sap_rip_broadcast(int mode);
|
||||||
extern void send_sap_broadcast(int mode);
|
|
||||||
extern void rip_for_net(uint32 net);
|
extern void rip_for_net(uint32 net);
|
||||||
extern void get_servers(void);
|
extern void get_servers(void);
|
||||||
|
|
||||||
@ -64,4 +66,5 @@ extern void insert_delete_server(uint8 *name,
|
|||||||
int do_delete, /* delete = 1 */
|
int do_delete, /* delete = 1 */
|
||||||
int flags);
|
int flags);
|
||||||
|
|
||||||
|
extern int dont_send_wdog(ipxAddr_t *addr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user