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 >
Text File  |  1992-07-15  |  6KB  |  118 lines

  1. //   ╔════════════════════════════════════════════════════════════════════╗
  2. //   ║                                                                    ║
  3. //   ║ module:      cpconn.c                                              ║
  4. //   ║ abstract:    This module contains the connection code.             ║
  5. //   ║                                                                    ║
  6. //   ║ environment: NetWare 3.x v3.11                                     ║
  7. //   ║              Network C for NLMs SDK v2.0d                          ║
  8. //   ║              CLib v3.11                                            ║
  9. //   ║              Network C for DOS v2.0                                ║
  10. //   ║              NetWare C Interface DOS v1.2                          ║
  11. //   ║                                                                    ║
  12. //   ║  This software is provided as is and carries no warranty           ║
  13. //   ║  whatsoever.  Novell disclaims and excludes any and all implied    ║
  14. //   ║  warranties of merchantability, title and fitness for a particular ║
  15. //   ║  purpose.  Novell does not warrant that the software will satisfy  ║
  16. //   ║  your requirements or that the software is without defect or error ║
  17. //   ║  or that operation of the software will be uninterrupted.  You are ║
  18. //   ║  using the software at your risk.  The software is not a product   ║
  19. //   ║  of Novell, Inc. or any of subsidiaries.                           ║
  20. //   ║                                                                    ║
  21. //   ╟────────────────────────────────────────────────────────────────────╢
  22. //   ║ maintenance history:                                               ║
  23. //   ║ level    date      pi   description                                ║
  24. //   ╟────────────────────────────────────────────────────────────────────╢
  25. //   ║  001   01/24/92    kl   initial release.                           ║
  26. //   ║  002   07/14/92    kl   windows port.                              ║
  27. //   ╚════════════════════════════════════════════════════════════════════╝
  28.  
  29. #include <stdio.h>
  30. #include <string.h>
  31. #include "cp/cpsys.h"
  32. #include <nwmisc.h>
  33.  
  34. //------------------------------------------------------------------------
  35. //  Here are the init and de-init routines.  For this version, they don't
  36. //  do anything...
  37. //
  38. #pragma off(unreferenced);
  39. T_RC    CPInitializeConnLogic(CPDATA *CPid){ return 0; }
  40. T_RC    CPDeInitializeConnLogic(CPDATA *CPid){ return 0; }
  41. #pragma on(unreferenced);
  42. //------------------------------------------------------------------------
  43. //
  44. //  This function connects us to the server.  Note that if the transport
  45. //  we are using is connectionless, this API just sets a flag and assumes
  46. //  that we will be able to send to the server.
  47. //
  48.  
  49. T_RC    CPConnectToServer(CPDATA *CPid)
  50. {
  51.         if( CPid->sip == TRUE ) return CP_SESSION_IN_PROGRESS;
  52.         //
  53.         //  Let the rest of the CP layer know that we are ready to
  54.         //  send/recv requests/replies to/from the application server.
  55.         //
  56.         CPid->sip = TRUE;
  57.         return CP_SUCCESS;
  58. }
  59.  
  60. //------------------------------------------------------------------------
  61. //  This API disconnects us from the server application.  The DAP
  62. //  Layer will call this API when it is DeAllocating a session with
  63. //  the server.
  64. //
  65.  
  66. T_RC    CPDisConnectFromServer(CPDATA *CPid)
  67. {
  68.         //
  69.         //  Let the rest of the CP layer know that have shut down the
  70.         //  session with the application server.
  71.         //
  72.         CPid->sip = FALSE;
  73.         return CP_SUCCESS;
  74. }
  75.  
  76. //------------------------------------------------------------------------
  77. //  This API displays all of the data in the CPDATA structure passed.
  78. //  This is mostly used for debugging.
  79. //
  80.  
  81. void    CPDisplaySessionData(void *p, CPDATA *CPid)
  82. {
  83.         int     i;
  84.         FILE    *f = (FILE *)p;
  85.  
  86.         if( !CPid ) return;
  87.         fprintf(f,"\n\tCPid is (%p)\n",CPid);
  88.         fprintf(f,"\t\tThere is %s session in progress\n",CPid->sip ? "a" : "not a");
  89.         fprintf(f,"\t\tLocal socket is %x\n",IntSwap(CPid->skt));
  90.         fprintf(f,"\t\tIPXAddress of server is %08lx:%08lx%04x:%04x\n",
  91.                  LongSwap(*(long *)IPXDESTNETP(CPid->ipxaddr)),
  92.                  LongSwap(*(long *)IPXDESTNODEP(CPid->ipxaddr)),
  93.                  IntSwap(*(short *)&IPXDESTNODEP(CPid->ipxaddr)[4]),
  94.                  IntSwap(*(short *)IPXDESTSOCKETP(CPid->ipxaddr)));
  95.         fprintf(f,"\t\tSignature is %lx\n",CPid->cphdr.signature);
  96.         fprintf(f,"\t\tServerID is %lx\n",CPid->cphdr.serverID);
  97.         fprintf(f,"\n\tHere are the CPCOMMDATA structures\n");
  98.         for(i=0; i < CPCNUMSENDECBS; ++i ){
  99.             fprintf(f,"\t\tSend ECB %d\n",i);
  100.             fprintf(f,"\t\t\tinUseFlag is %x\n",INUSEFLAG(&CPid->sends[i].ecb));
  101.             fprintf(f,"\t\t\tcompletionCode is %x\n",COMPLETIONCODE(&CPid->sends[i].ecb));
  102.             fprintf(f,"\t\tIpxHeader %d\n",i);
  103.             fprintf(f,"\t\tCPMessage %d\n",i);
  104.             fprintf(f,"\t\t\tSignature is %lx\n",CPid->sends[i].cpmsg.cphdr.signature);
  105.             fprintf(f,"\t\t\tServerID is %lx\n\n",CPid->sends[i].cpmsg.cphdr.serverID);
  106.         }
  107.         fprintf(f,"\n");
  108.         for(i=0; i < CPCNUMRECVECBS; ++i ){
  109.             fprintf(f,"\t\tRecv ECB %d\n",i);
  110.             fprintf(f,"\t\t\tinUseFlag is %x\n",INUSEFLAG(&CPid->recvs[i].ecb));
  111.             fprintf(f,"\t\t\tcompletionCode is %x\n",COMPLETIONCODE(&CPid->recvs[i].ecb));
  112.             fprintf(f,"\t\tIpxHeader %d\n",i);
  113.             fprintf(f,"\t\tCPMessage %d\n",i);
  114.             fprintf(f,"\t\t\tSignature is %lx\n",CPid->recvs[i].cpmsg.cphdr.signature);
  115.             fprintf(f,"\t\t\tServerID is %lx\n\n",CPid->recvs[i].cpmsg.cphdr.serverID);
  116.         }
  117. }
  118.