/************************************************************************/
/* */
/* ***** ***** */
/* ***** ***** */
/* ***** ***** */
/* ***** ***** */
/* *************** *************** */
/* ***************** ***************** */
/* *************** *************** */
/* ***** ***** TheNetNode */
/* ***** ***** Portable */
/* ***** ***** Network */
/* ***** ***** Software */
/* */
/* File os/go32/tcp.c (maintained by: DAA531) */
/* */
/* This file is part of "TheNetNode" - Software Package */
/* */
/* Copyright (C) 1998 - 2008 NORD>actively == FALSE)
{
/* Interface, L2Port setzen. */
printf("--- TCPIP Initialisieren KissType %d\n", Interface);
tpoi->actively = FALSE;
tpoi->l2port = EOF;
/* Um ein erhoehen. */
numactive++;
} /* Interface ist schon belegt. */
} /* Ungueltiges Interface. */
} /* for */
return(numactive);
}
/************************************************************************/
/* Level1 Exit */
/************************************************************************/
static void ExitL1TCP(void)
{
T_INTERFACE *tpoi;
register int i;
for (i = 0; i < MAXINTERFACE; i++)
{
tpoi = &ifp[i];
L1ExitTCP(tpoi->Interface);
}
}
/* DCD-Status liefern. */
static WORD DcdL1TCP(PORTINFO *port)
{
/* Sender ist immer frei. */
return(FALSE);
}
static void CtlL1TCP(int req, int port)
{
switch (req)
{
case L1CCMD :
case L1CRES :
break;
}
default_l1ctl(req, port); /* Flags loeschen */
};
static int IstomeL1TCP(int major, char *devname)
{
char name[20 + 1];
strncpy(name, devname, 20); /* Minor bestimmen und abschneiden */
name[20] = 0;
#ifdef L1TELNET
if (strnicmp(name, "TELNET", strlen(name))==0)
return(TEL_ID);
#endif /* L1TELNET */
#ifdef L1HTTPD
if (strnicmp(name, "HTTPD", strlen(name))==0)
return(HTP_ID);
#endif /* L1HTTPD */
#ifdef L1IPCONV
if (strnicmp(name, "IPCONV", strlen(name))==0)
return(CVS_ID);
#endif /* L1IPCONV */
#ifdef L1IRC
if (strnicmp(name, "IRC", strlen(name))==0)
return(IRC_ID);
#endif /* L1IPCONV */
return(NO_MINOR);
}
static int AttachL1TCP(int port, int minor, BOOLEAN check_only)
{
/* Zeiger auf das aktuelle Interface. */
T_INTERFACE *tpoi = &ifp[minor];
if (tpoi->actively == FALSE)
{
if (tpoi->l2port == EOF)
{
if (!check_only)
{
if (!L1InitTCP(tpoi->Interface, port, tpoi->tcpport))
return(FALSE);
portpar[port].minor = minor;
}
return(1);
}
if (tpoi->l2port == port)
return(1);
}
return(0); /* versuchte Doppeleintragung */
}
static int DetachL1TCP(int port)
{
/* Zeiger auf das aktuelle Interface. */
T_INTERFACE *tpoi = &ifp[portpar[port].minor];
/* Port deaktivieren. */
tpoi->l2port = EOF;
/* Schliesse Interface. */
L1ExitTCP(tpoi->Interface);
return(TRUE);
}
static void InfoL1TCP(int what, int port, MBHEAD *mbp)
{
/* Zeiger auf das aktuelle Interface. */
T_INTERFACE *tpoi = &ifp[portpar[port].minor];
switch (what)
{
case HW_INF_IDENT :
case HW_INF_INFO :
putprintf(mbp, "%s %u", tpoi->name, Htons(tpoi->tcpport));
break;
case HW_INF_STAT :
case HW_INF_CLEAR :
break;
/* durchfallen */
default:
default_l1info(what, port, mbp);
}
}
/* Pruefe auf TCP-Port. */
int CheckPortTCP(int port)
{
/* Inetrface ermitteln. */
T_INTERFACE *tpoi = &ifp[portpar[port].minor];
/* Nur wenn aktiv. */
if (tpoi->actively == TRUE)
{
switch (tpoi->Interface)
{
#ifdef L1TELNET
case KISS_TELNET :
if (tpoi->l2port == port)
return(TRUE);
#endif /* L1TELNET */
#ifdef L1HTTPD
case KISS_HTTPD :
if (tpoi->l2port == port)
return(TRUE);
#endif /* L1HTTPD */
#ifdef L1IPCONV
case KISS_IPCONV :
if (tpoi->l2port == port)
return(TRUE);
#endif /* L1IPCONV */
#ifdef L1IRC
case KISS_IRC :
if (tpoi->l2port == port)
return(TRUE);
#endif /* L1IRC */
/* Ungueltiges Interface. */
default :
return(FALSE);
} /* switch. */
}
else
return(FALSE);
}
static int RegisterTCP(void)
{
MAJOR *m;
if (InitL1TCP()) {
m = register_major();
m->name = "TCPIP";
m->istome = IstomeL1TCP;
m->exit = ExitL1TCP;
m->ctl = CtlL1TCP;
m->dcd = DcdL1TCP;
m->attach = AttachL1TCP;
m->detach = DetachL1TCP;
m->info = InfoL1TCP;
return(num_major);
}
return(0);
}
#endif /* TCP_STACK */
/*----------------------------------------------------------------------*/
/* End of os/go32/tcp.c */