home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
dax1.exe
/
CP
/
CPC
/
CPCONN.C
< prev
next >
Wrap
Text File
|
1992-07-15
|
6KB
|
118 lines
// ╔════════════════════════════════════════════════════════════════════╗
// ║ ║
// ║ module: cpconn.c ║
// ║ abstract: This module contains the connection code. ║
// ║ ║
// ║ environment: NetWare 3.x v3.11 ║
// ║ Network C for NLMs SDK v2.0d ║
// ║ CLib v3.11 ║
// ║ Network C for DOS v2.0 ║
// ║ NetWare C Interface DOS v1.2 ║
// ║ ║
// ║ This software is provided as is and carries no warranty ║
// ║ whatsoever. Novell disclaims and excludes any and all implied ║
// ║ warranties of merchantability, title and fitness for a particular ║
// ║ purpose. Novell does not warrant that the software will satisfy ║
// ║ your requirements or that the software is without defect or error ║
// ║ or that operation of the software will be uninterrupted. You are ║
// ║ using the software at your risk. The software is not a product ║
// ║ of Novell, Inc. or any of subsidiaries. ║
// ║ ║
// ╟────────────────────────────────────────────────────────────────────╢
// ║ maintenance history: ║
// ║ level date pi description ║
// ╟────────────────────────────────────────────────────────────────────╢
// ║ 001 01/24/92 kl initial release. ║
// ║ 002 07/14/92 kl windows port. ║
// ╚════════════════════════════════════════════════════════════════════╝
#include <stdio.h>
#include <string.h>
#include "cp/cpsys.h"
#include <nwmisc.h>
//------------------------------------------------------------------------
// Here are the init and de-init routines. For this version, they don't
// do anything...
//
#pragma off(unreferenced);
T_RC CPInitializeConnLogic(CPDATA *CPid){ return 0; }
T_RC CPDeInitializeConnLogic(CPDATA *CPid){ return 0; }
#pragma on(unreferenced);
//------------------------------------------------------------------------
//
// This function connects us to the server. Note that if the transport
// we are using is connectionless, this API just sets a flag and assumes
// that we will be able to send to the server.
//
T_RC CPConnectToServer(CPDATA *CPid)
{
if( CPid->sip == TRUE ) return CP_SESSION_IN_PROGRESS;
//
// Let the rest of the CP layer know that we are ready to
// send/recv requests/replies to/from the application server.
//
CPid->sip = TRUE;
return CP_SUCCESS;
}
//------------------------------------------------------------------------
// This API disconnects us from the server application. The DAP
// Layer will call this API when it is DeAllocating a session with
// the server.
//
T_RC CPDisConnectFromServer(CPDATA *CPid)
{
//
// Let the rest of the CP layer know that have shut down the
// session with the application server.
//
CPid->sip = FALSE;
return CP_SUCCESS;
}
//------------------------------------------------------------------------
// This API displays all of the data in the CPDATA structure passed.
// This is mostly used for debugging.
//
void CPDisplaySessionData(void *p, CPDATA *CPid)
{
int i;
FILE *f = (FILE *)p;
if( !CPid ) return;
fprintf(f,"\n\tCPid is (%p)\n",CPid);
fprintf(f,"\t\tThere is %s session in progress\n",CPid->sip ? "a" : "not a");
fprintf(f,"\t\tLocal socket is %x\n",IntSwap(CPid->skt));
fprintf(f,"\t\tIPXAddress of server is %08lx:%08lx%04x:%04x\n",
LongSwap(*(long *)IPXDESTNETP(CPid->ipxaddr)),
LongSwap(*(long *)IPXDESTNODEP(CPid->ipxaddr)),
IntSwap(*(short *)&IPXDESTNODEP(CPid->ipxaddr)[4]),
IntSwap(*(short *)IPXDESTSOCKETP(CPid->ipxaddr)));
fprintf(f,"\t\tSignature is %lx\n",CPid->cphdr.signature);
fprintf(f,"\t\tServerID is %lx\n",CPid->cphdr.serverID);
fprintf(f,"\n\tHere are the CPCOMMDATA structures\n");
for(i=0; i < CPCNUMSENDECBS; ++i ){
fprintf(f,"\t\tSend ECB %d\n",i);
fprintf(f,"\t\t\tinUseFlag is %x\n",INUSEFLAG(&CPid->sends[i].ecb));
fprintf(f,"\t\t\tcompletionCode is %x\n",COMPLETIONCODE(&CPid->sends[i].ecb));
fprintf(f,"\t\tIpxHeader %d\n",i);
fprintf(f,"\t\tCPMessage %d\n",i);
fprintf(f,"\t\t\tSignature is %lx\n",CPid->sends[i].cpmsg.cphdr.signature);
fprintf(f,"\t\t\tServerID is %lx\n\n",CPid->sends[i].cpmsg.cphdr.serverID);
}
fprintf(f,"\n");
for(i=0; i < CPCNUMRECVECBS; ++i ){
fprintf(f,"\t\tRecv ECB %d\n",i);
fprintf(f,"\t\t\tinUseFlag is %x\n",INUSEFLAG(&CPid->recvs[i].ecb));
fprintf(f,"\t\t\tcompletionCode is %x\n",COMPLETIONCODE(&CPid->recvs[i].ecb));
fprintf(f,"\t\tIpxHeader %d\n",i);
fprintf(f,"\t\tCPMessage %d\n",i);
fprintf(f,"\t\t\tSignature is %lx\n",CPid->recvs[i].cpmsg.cphdr.signature);
fprintf(f,"\t\t\tServerID is %lx\n\n",CPid->recvs[i].cpmsg.cphdr.serverID);
}
}